News for hackers. Stuff that matters.
Re:Data Classes for Java by wvenable on Thursday November 02, 2017 @12:35AM (#15607864)
> 99%+ of getters and setters could be replaced with public fields.

Actually it makes more sense the other way around. Fields are just an optimization; the different between fields and properties is one has direct memory access and the other is a method. Properties/methods are far more powerful: their implementation can change, they can be virtual and overridden, etc.

Maybe we could have had just properties and the JIT could have optimized them into direct memory access if they were backed by a simple field.

There are no comments on this comment yet.