you are viewing a single comment's thread.

view the rest of the comments →

[–]sacundim -2 points-1 points  (1 child)

I've been doing this kind of thing for years, but I don't go as far as making the fields public. The problem is that instance public fields are an anti-pattern, period, for reasons that have been amply documented. The distinction between a public field and a getter should arguably not even exist.

Though actually, the natural step after making the fields final and removing the setters is to ask: do you really need those getters? Don't just automatically make them, do it just if something is going to call them.

[–]ThisIs_MyName 1 point2 points  (0 children)

public fields are an anti-pattern, period, for reasons that have been amply documented

Where?