Skip to main content

People, Get, Ready

Posted by editor on January 8, 2007 at 7:10 AM PST


Getters, setters, dot-operators, arrows, and other property offenses

With the closure proposal lying low recently, and the early draft of the Java Module System (JSR 277) having come and gone from its public comment period, another topic has taken center stage in the JDK 7 language debate: properties. Well, not the properties themselves, per se, but the getting and setting of them. Handled well, a consistent approach could be both human-readable and machine-readable, reducing the boilerplate typing of the current JavaBeans conventions while allowing (but hopefully not requiring?) IDEs, visual GUI builders, and similar tools to set up everything for the programmer.

Devil's in the details, of course. Various proposals are bouncing around the blogosphere, bringing plaudits and hackles about syntactic sugar, C# envy, featuritis and other code smells. Not that that's a bad thing -- it's ideal that the Java community is having this argument now, not after JDK 7 comes out and lots of developers suddenly get buyer's remorse over the final implementation (which is how a lot of people feel about the way that generics went down).


The properties puzzle tops today's Weblogs, as Rémi Forax declares All your property are belong to us:
"This blog entry proposes a way to define properties in Java and provides an updated version of the prototype java compiler with property support."

Cay Horstmann thinks the outcry over the possible use of an arrow operator, ->, for property access has been overblown. In
Arrows in the Back, he writes:
"There has been a flurry of recent blogs on native property syntax, much of it rather emotional. This blog tries to get past the emotions, hoping to garner interest in the real issues that need to be solved for native properties."

Jacob Hookom continues his blog series in
Persistence Caching Part II:
"After more investigation, and monitoring-- I continue my rant :-)"


In Java Today,
the 106th issue of the Java Tools Community Newsletter has been posted. This issue has tool news from around the web, announcements of new community projects and a graduation from the incubator, and a "Tool Tip" about publishing artifacts in the java.net Maven 2 repository.

A new Java Desktop Community incubated project bills itself as Yet Another Swing Binding library, "an attempt to make data/swing binding more simple and intuitive. While, WYSIWIG GUI builders like Matisse speed user interface construction, desktop developers also need a rapid tool for binding swing components to data models. This framework's main focus is to make such binding simple and a one call operation, and at the same time allow customization through a well-defined interface."

In the ONJava article Discovering a Java Application's Security Requirements, Mark Petrovic
shows how to write a SecurityManager that instead of granting or rejecting
access, simply logs all the calls made to it and, with the help of a Perl
script, can convert these logs into a custom security policy. He writes,
"once we have the broad, fine-grained policy it discovers, we can use it
as a starting point in developing a production runtime policy or simply
study it to better understand and appreciate our application's security needs."


This week's Spotlight is on the SIP Communicator project, an audio/video Internet phone and instant messenger which recently put out a 1.0 alpha 1 release after more than a year of development. SIP Communicator supports some of the most popular instant messaging and telephony protocols such as SIP, Jabber, AIM/ICQ, MSN and soon others like Yahoo and IRC. More information on using the project is available in a FAQ list.


Returning to the subject of propertries, today's Forums, starts off with a debate in the thread

Re: Java7 anti-features, in which mklemm writes:
"What is proposed here is completely different from the property support in C#. C# only has a different syntax, but essentially the same semantics as in current java, for property definition. The one difference is the syntactical grouping of the getter and setter for one property in the same place in the source code, which is IMHO a good idea. The other difference is the call syntax for properties so the property can be accessed like a public instance variable, which is pretty ugly, but MS has advertised to do so since the first versions of their MFC libraries."

campbell updates the state of resolution-independence in
Re: How about to provide a vector GUI in JDK7:
"Support for hi-dpi displays in Swing applications is something we've been working on for JDK 7. We're trying to keep the burden on Swing developers low, so that existing applications will look good on hi-dpi displays without major modifications. That said, to take complete advantage of hi-dpi displays and "resolution independence," developers will most likely want to update their applications to include high resolution artwork. We'd like to provide some utilities to ease this transition (e.g. multi-resolution icon class, some amount of SVG support?), but a lot of it comes down to educating developers about the issues they may face when making their apps look great on hi-dpi displays. There are lots of ideas on the table, and we'll be blogging about all of it in the near future."

Deployment propblems have anksingla2 confused about the state of
Java on the Mac:
"I recently packaged a program I was writing as a jar. Since I was using Netbeans, I packaged it using Java 5 release 10 and Java 6, the dev kits that are available for download. Unfortunately, neither jar worked on my friends' computers that had Macs. For PC users it worked fine, but they couldn't upgrade their versions of Java. I asked the Apple Campus Rep (who happened to be one of these friends) what his take on the situation was and he mentioned that Sun doesn't support Apple. I thought I'd cross check that with Java devs. Does Sun support Java on Macs? If not, why?"


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.

Getters, setters, dot-operators, arrows, and other property offenses