Skip to main content

Properties Get No Respect

Posted by cayhorstmann on December 20, 2007 at 4:01 PM PST

height="130" />There has been another flurry of discussions about href="">closures
in Java and minor
language enhancements
, together with the usual flurry of “ href="">leave
the language alone” lamentations.

Conspicuously absent from this discussion was href="">my
pet unappreciated language feature, native properties. Properties get no
respect. Every few weeks, href="">another
blogger comes along and says “we need a property syntax”,
proposes something, and moves on to greener pastures.

At best, properties are dull. Programmers who work with Swing, JPA, JSF components, XMLEncoder/Decoder, and other "beanish" technology cringe every time they have another class with a bunch of annoying trivial getters and setters. But it isn't the end of the world. They can cringe and keep on coding. How much gratification is there in making people cringe less? Apparently not enough to put together a proposal that deals with all the pesky details.

devil height="75" />But it gets worse. While worrying about pesky details, the hapless property syntax designer needs to fend off a barrage of attacks from the
inevitable naysayers (“What's the big deal...Eclipse writes the getters
and setters for me”) and the OO purists (“Properties are the tool
of the devil...they break encapsulation”).

As a result, most of the effort about properties has been half-hearted and scattered about
in the blogosphere. There was never enough momentum to arrive at a
consensus. Nikolay Botev, a computer science student at SJSU, has done
something about that. In his independent study project, he collected every
reference about properties he could find, in Java and other languages, and
put all the information into a Wiki. He also added nifty voting buttons to
the Wiki.

/>While everyone else is madly milling about at the mall, please take a few
minutes to see check it out: href="">
If you are a properties enthusiast (you know who you are), please make an
account and add to the Wiki.

Happy holidays!