Comment

Comment by HumanDrivenDev

... To write such a class responsibly, one has to write a lot of low-value, repetitive code: constructors, accessors ...

If you're writing a plain data class, why on earth would you write getters and setters? Just make your fields public and be done with it.

I will be forever perplexed by the idea of getters and setters (and this extends to C#s syntax sugar). I have no idea what problem they solve. If you're at the level of plain data, then just make a class with public fields and no methods. If you're trying to write a 'higher level' object - then don't refer to the names of fields in your method names. The getter/setter/property approach is just the worst of both worlds. They make explicit reference to an objects internal fields, while at the same time obfuscating what happens when you actually access them.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton