Earlier quoted context omitted.
> Scala, Groovy, Clojure, JRuby, etc. I am yet to work in a Java project where I am allowed to use any of them. Regarding the properties I really don't get what is the big deal. No one used to complain about C++ properties, that besides having to write accessors and mutator methods, one needs to declare them on the header files as well. Or the first version of C# properties isn't much shorter than how it is done in J…
> isn't much shorter than how it is done in java The savings in screen space and visual cortex neurons doesn't come from the one or two properties that need logic, it comes from the dozen avoided /** * Gets the foo * @return the foo */ public Foo getFoo() { return foo; } /** * Sets the foo * @param foo */ public void setFoo(final Foo foo) { this.foo = foo; }
Now you're left with something that could be fit on three lines (the "final" for the parameter is also useless and can be removed):
public Foo getFoo() { return foo; }
public void setFoo(Foo foo) { this.foo = foo; }
Even if you don't write the actual source like that, a good editor like IntelliJ can automatically display them like that (code folding).The C# version is about the same length:
public Foo Foo {
get { return foo; }
set { foo = value; }
}
Also, you don't have to write the get/set methods yourself. You hit a few keys and your editor generates them.