Jan 29

Why Is Everything a Language Extension?

Category: Java

Now it’s Java properties.

I say once again - the last thing to do is to extend the language. Before that try a new API or have your IDE do it. In the case of Java properties I really don’t see any reason whatsoever for this being in the language as it’s blatantly something that can be done in the IDE plenty well enough. That just leaves a couple of arguments:

  1. More readable - I can understand perfectly well from the method name what set* and get* do, surely I’m not the only one?
  2. Reduces boilerplate - Indirecting through a method allows more flexibility and a modern IDE can fold these things away so we don’t have to see them. Finally, some boilerplate actually makes code more explicit and therefore more easily understood which is far more important.

Elliotte and others already have the rest of the reasoning nailed so I’m not wasting any more breath.

2 Comments so far

  1. Fabrizio Giudici January 30th, 2007 11:48 am

    Referring also to your previous post, what do you think about a possible Java language extension to pass (don’t know what, but something) through firewalls? ;-)

  2. Calum Shaw-Mackay January 31st, 2007 1:26 am

    I’ve mentioned this in one of the many properties discussions, that Sun really isn;t actually asking Java developers what they want. I can;t think of anyone in their right mind that would have XML at a language level (please remember the fallen ones…SQLJ anyone?). As for properties, really, I don’t understand what the fuss is about. Closures maybe, there’s even some latitude for operator overloading (mainly indexers on Collections, but that’s another issue entirely) but property syntax?

    Sun should be more concerned with things like the Isolation API, and MVM, and taking advantage of multi-core processors, perhaps even being able to run the Swing EDT on a separate core to your application threads……