Hacker News new | past | comments | ask | show | jobs | submit login

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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: