Skip to content

Comment on Java.evolved: Java has evolved. Your code can tooparent

Comments

This is the meme where the Padawan exposes public fields, the intermediate says you must use setters and getters, and the Jedi just exposes public fields.

(Records kind of made this moot, and for the better)

Except records are immutable and have getters and setters as builtins to replicate what we've been doing with Lombok.

So enforces what I was saying.

To be clear, Records don't have setters. They are immutable.

Yeah, sorry, typo.

Still they institutionalise getters, which is the opposite of what their argument was.

Well, they don't have "getters" either, they have accessors; x() instead of getX(). It's still bad, but at least it doesn't enforce JavaBeans conventions, which is where getters and setters actually originate [0].

0: https://en.wikipedia.org/wiki/JavaBeans

immutable
setters

sigh

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.