Skip to main content

JSE 7 No Arrows Please

Posted by jhook on December 28, 2006 at 9:11 PM PST

I'm finding so much of Java's APIs to be extremely literal and long-winded at times. While this produces self documenting code, I'd still like to see some better ideas for the getter/setter shorthand than '->'.

More on the topic here: Dion's Blog

I'm of the opinion that if you are willing to make a commitment to closures, then we do the same for properties-- something similar to C#. Spending time extending the long winded get/set convention is the wrong direction for the spec. Do everyone a favor and do properties right-- leaving the old Bean Property spec alone for APIs to accommodate and treating properties as a first class citizen in the metadata starting in SE 7.

Property[] p = class.getProperties();

Aside from the misread syntax of an assignment arrow ('->'), I can see a lot of people get confused by implying method associations by some naming convention. Actually introducing a literal property syntax into the spec will make code much more maintainable in the long run, than visual guessing games around field accessors.

Some senior developers may scoff at the thought of bean naming conventions as confusing, but from being on web/el/mvc dev lists for many years, you are guaranteed to get those people who have problems with reading properties because they didn't capitalize/lowercase the right letter.

Please SE folks-- think outside the box.