API name change ideas for Infusion 1.0
Aaron Brown
aaron at thebrownproject.com
Tue Mar 31 16:18:05 UTC 2009
Colin Clark wrote:
> * Fluid.js: fluid.findKeyInObject()
> This is a framework utility that performs reverse lookups in an object:
> pass in a value, and you'll get its associated key. This name always
> confuses me about the order and nature of the arguments.
I'm new enough to fluid that I don't have an informed suggestion for
most of the name changes, but this one is pretty generic.
How about "fluid.getKeyByValue('some value')"
I think using the term "object" in the method call is unnecessary since
key-value pairings only happen in specific kinds of objects in the first
place. Fluid may have another naming convention for "get..." "set..."
functions, so fill in whatever term you'd normally use. The original
"find..." may also imply to the developer that it's not always a cheap
operation to perform - it requires an iterative scan over the hash to
find the result - so that prefix may be worth keeping.
By the way: Does this function return an array if multiple keys hold the
same value? If so, perhaps it should be "getKeysByValue", or even two
separate functions, one that returns the first match and one that
returns all.
- Aaron
--
Aaron Brown :: aaron at thebrownproject.com :: www.thebrownproject.com
More information about the fluid-work
mailing list