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

No, the point of getters and setters is that the interface to get and set fields should be the same whether or not logic is being performed behind the scenes, and the caller should not need to know.

Making fields public makes it impossible to add logic in the future without changing other code. That breaks encapsulation and is generally non-idiomatic in languages with getters and setters.




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

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

Search: