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

get/set can be added with a single click in most IDEs and all the references to the private variable are fixed for you. However, having a public getter and public setter for a private field is not really that much safer than a public variable. It is still shared, mutable state and anyone holding a reference to the object can mess with its state.



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

Search: