News for hackers. Stuff that matters.
Re:Ruby is beautiful (but I'm moving to Python) by slashdot on Sunday November 28, 2010 @11:19PM (#1949362)
Actually, in idiomatic java, it'd be even longer:

You should make bar private, and add a setter. After all, we might want to change the rules on setting bar sometime, and you wouldn't want to have to go back and change everywhere that accesses it...

Re:Ruby is beautiful (but I'm moving to Python) by masklinn on Monday November 29, 2010 @02:34AM (#1949700)
> You should make bar private

It's package-access by default, that's enough to hide it from the third-party users of the class.

> and add a setter

The original code uses `attr_reader` which defines a readonly "property". The Java translation is a single getter, with no way to set the value from outside the class.