Opinions: API wrapping, how close to original API should you stay?

Ian Malpass ian at indecorous.com
Thu Oct 5 13:17:53 PDT 2006

Nik Clayton wrote:
> Ian Malpass wrote:
>> Nik Clayton wrote:
>>> Assuming you were writing to this API, would you prefer to use:
>>>    $ml->get_optimistic_lock()
>>>    $ml->get_OptimisticLock()
>>>    $ml->getOptimisticLock()
>>> to retrieve the value, or something else?
>> Could you support both 1 and 3? Or would that just cause confusion?
> It's easy enough to do.

Mm, yes. I suppose my use of "could" was more "given that you can, 
should you or would you want to" :)

> I'm not sure it'll lead to maintainable code in 
> the future though (in the sense of consumers of this object, rather than 
> the object itself).

You could explicitly separate the interfaces - have a Foo::Bar with a 
Foo::Bar::CamelCase for those who wanted it. At least then users would 
have opted for one or the other, rather than mixing the two willy-nilly.


More information about the MiltonKeynes-pm mailing list