Nov 16 meeting notes

David Herman dherman at mozilla.com
Wed Nov 23 16:38:25 PST 2011


On Nov 23, 2011, at 3:17 PM, Bill Frantz wrote:

> I did a lot of Java programming 10 to 15 years ago. Most of the pain has subsided into distant memory, but the pain of different method names used to find out how many objects are currently in a collection is still fresh in my memory.

Fair enough.

> I "duck classify" all objects which store "things" and later give them back without using or modifying them as "collections". Collections include arrays, sets, bags, b-trees, hash tables, etc.

I do too. To me "size()" felt natural: it's the closest to the way I would say it common speaking: "get the size of the collection." (I'm okay with "count()" too, but for operations that don't modify a data structure, I find it natural to name them after the result they produce rather than the action they perform. I don't talk about the "count" of a collection.)

> Please give me one way of finding out how many "things" are in a collection so I don't have to remember what "language lawyer" interpretation defined this particular collection's method name.

Yay insults! I love insults.

> (I survived the Algol68 report. If you want to have only one precise meaning for a word, don't borrow one from a natural language. Otherwise just accept that in technical usage, a word's meaning(s) may be only loosely connected to its natural language meanings.)

I'm just basing this on my experience. I'm used to "the number of things in this collection" being called the "size" not the "length".

Also, as someone pointed out in this thread, the length of an array is *not* the same as the number of indexed elements of the array, thanks to holes. So not only are the words different in English (IME, IMHO, YMMV, yadda yadda yadda) but the actual operations we're talking about are different.

Dave



More information about the es-discuss mailing list