W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1999

Re: DOM Range comments

From: David Brownell <david-b@pacbell.net>
Date: Tue, 28 Dec 1999 18:52:06 -0800
Message-ID: <38697756.A69B9179@pacbell.net>
To: www-dom@w3.org
keshlam@us.ibm.com wrote:
> 
> >Why the Java binding is getIsCollapsed() ?

Consistency -- the attribute is named "isCollapsed", and there's
a consistent (and automated) mapping from attribute names to accessors.


> Interesting point.
> 
> The standard Java (or, more accurately, Java Beans) design pattern is that
> getters for boolean properties have names which follow one of two patterns,
> either getWhatever() -- as for any other property -- or isWhatever().  If
> the attribute's name is isCollapsed, then getIsCollapsed() may be confusing
> but does follow Java's conventions.

Information and a minor correction.

The info:  the pattern was first associated with IDL ... CORBA's C binding
used it before Green, I mean Oak, I mean Java was much more than a dream.
And I know that the folk who did the JavaBeans (oneword[tm]) stuff knew
that convention quite well.

The minor correction:  attribute "X" may only map to "isX" if it's boolean,
as it is in this case.  That's a pure JavaBeans-ism, unused in DOM AFAIK.


>	 But it might be worth considering
> changing the property name from isCollapsed to simply collapsed. That would
> undo this minor cognative clash, and I don't think it would adversely
> impact comprehensibility of code.

Cognate of what?  :-)

That'd mean "getCollapsed" in most IDL bindings, which would make more
sense at least to me!

- Dave
Received on Tuesday, 28 December 1999 21:52:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT