Native properties? Please not!
January 11, 2007 Leave a comment
Seems like there are many opinions about native (language-level) property support for the Java language. I guess I am more the conservative type of programmer. I can’t figure out enough good reasons to add such a feature to the language without introducing a whole lot of possibilities to shoot yourself into the feet.
One of the cool things about properties (IMO) is that they are actually _not_ necessarily only getter and setter methods around field. If I understand it correctly, this is the whole idea behind properties. You can implement certain behaviour for properties (like, dynamically creating/fetching the property values). How would you do that if your property looks similar to a field? Ok, you could probably still write getters and setters, but this is where it starts confusing. And, honestly, auto-boxing, varargs, static imports, that is more confusion to the originally-clean language Java. I don’t need more of this.
But then again, maybe all those discussions will finally lead to a clean implementation of native properties. Then I will of course not stand against it. But please don’t add such half finished shit like it happened with auto boxing and some other things in jdk5. Ah, and did I already mention that I don’t like the idea of language-level XML support either? I mean, there’s JDOM, a couple of objectXML mappers etc. Who needs language level XML support then? But ok, this is another story…