News for hackers. Stuff that matters.
Re:Data Classes for Java by wtetzner on Wednesday November 01, 2017 @10:55PM (#15607477)
> 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 think it's because you can't specify fields interfaces. If you different data classes, but you want them all to be "Named", you need "getName()" on your "Named" interface, because you can say that it should have a "name" field.

Of course, that's a language flaw, but it's one that people have to work around.

There are no comments on this comment yet.