Roman writes disparagingly of proposals to add properties to Java.

Properties seemed cool when I first heard about them. They seem like a nice tool for maintaining source compatibility — for allowing local refactorings between fields and methods, without requiring massive changes to the rest of the code. In gcjx, I used something a bit like properties (I think you can emulate them in C++, with some work, but I picked something a bit simpler) for just this reason.

But upon further reflection I don’t really see the point of adding them to Java. Java is more concerned with binary compatibility. And, for properties to be binary compatible, they have to be implemented as functions from the beginning (or as a new VM feature — but that seems like overkill). And if you are doing that, you might as well consider that your IDE can generate the methods for you already.

Regardless of what happens here, I think it is interesting that the Java language debates have moved to the blogs. There are several influential Java people blogging about these topics on a regular basis. We’re also starting to see language experimentation being done in the OpenJDK javac.

Share if you liked it


  • Don’t forget the readability difference. The difference between



    widget.height = scene.table.redBall.height;

    is immense.

    OTOH, the Java platform developers seem to consistently ignore readability differences and rely on IDEs to make the ugly syntax usable, so keeping properties might be the logical decision.

  • Good point about readability. I think I tend not to write code like that.

    There are a few nice pro-properties rationales out there, for instance “Properties are Design Features.

    I do think the Java platform developers have added some readability features. This is where static import and foreach originated.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>