An interesting observation of what IMHO constitutes the biggest flaw in the
so called Glasgow spec, aka JavaBeans and POJOs;
It is said that a method in the verb form is a property (which in turn is a
noun).

>From that stems a lot of nastiness that we now take for granted and some
even call 'goodness'. And I think a proper 'Property' spec would have
emerged if it wasn't for this "JavaBean spec" making a naming convention
(which people not even follow slavishly, since you can get away with it, for
instance array access.

I kind of agree with both Noel and Greg in their argumentation. Is
consistency more important than habbit? I don't know, but IF now consistency
(Glasgow spec) is chosen, be prepared to be called out on it whereever else.
The worst situation IMHO is saying you are consistent, but not being so...

-- Cheers
Niclas

On 27 Nov 2009 23:41, "Greg Brown" <[email protected]> wrote:

I actually think the array length property makes sense - it is simply a
public final field and doesn't need a "get" prefix. However, I think this
raises an interesting point. I imagine that the designers of the JDK
collections were attempting to maintain parity with "length" when they
created the "size()" method. I would further guess that they chose "size()"
instead of "length()" because "length()" doesn't make as much sense for a
map or set as it does for a list. I'd suggest that "getLength()" is actually
more consistent with array "length" than "size()", since "getLength()" is
simply the bean equivalent of a public "length" field.

Of course, this is neither here nor there.  :-)  I personally prefer
getLength(), but to each his/her own.

On Nov 27, 2009, at 10:07 AM, Noel Grandin wrote: > I see the rationale, but
in API design, there...

Reply via email to