News for hackers. Stuff that matters.
Re:Everything about Java 8 by Hermel on Wednesday March 27, 2013 @01:29PM (#5450748)
The point is that a language should not add features that make it easier to write bad code.
Re:Everything about Java 8 by rictic on Wednesday March 27, 2013 @01:45PM (#5450871)
The point of getters and setters is to avoid exposing internal state to the outside. In this way you're not getting direct modification of fields, you're sending a signal: "hey Date object, get me your representation as an integer number of seconds since epoch", the outside doesn't care whether the Date internally uses the seconds since epoch representation, or whether it translates to this representation just for this method.
Re:Everything about Java 8 by evanspa on Wednesday March 27, 2013 @01:41PM (#5450841)
Getters / Setters don't automatically mean that the internal state of an object is exposed. For example, an object may internally have mutable linked-list of something, but a Getter that returns an array (immutable) of immutable members.

What is the alternative to Getters / Setters (or, properties, which is basically just syntactic sugar) in an OO language?

Re:Everything about Java 8 by zmmmmm on Wednesday March 27, 2013 @08:12PM (#5452738)
That's being way too dogmatic.

The problem with taking encapsulation to an extreme is that you are trading off against flexibility. The more you hide your state the less any external party can implement their own logic using that state, and the more separate concerns have to be bundled into the class hiding the state because they can't be dealt with anywhere else. Everything in software design is a tradeoff.

Re:Everything about Java 8 by PySlice on Wednesday March 27, 2013 @09:49PM (#5453002)
I wonder what those dogmatic programmers do when they are confronted with a problem in the real world where they need to find a balance between "encapsulation" and "single responsibility".

I guess their brains simply deadlock.