> 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.
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.