Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Everything about Java 8. Parent comment
I used to write classes and then add fields and auto generate getters/setters.
Now I don't, I just make all the state private and if I find myself wanting a getter/setter I ask myself why.
Too much use of getters/setters is just reinventing the problem that private state was meant to avoid.
So for example rather than:
if(email.getState() == EmailState.SENT) {
I have:
if(email.wasItSent()) {
I used to write classes and then add fields and auto generate getters/setters.
Now I don't, I just make all the state private and if I find myself wanting a getter/setter I ask myself why.
Too much use of getters/setters is just reinventing the problem that private state was meant to avoid.
So for example rather than:
if(email.getState() == EmailState.SENT) {
I have:
if(email.wasItSent()) {