Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’m on board with the With and Builder patterns where it makes sense, but the final suggestion to make the fields public is just bad advice.

The author recognizes that mutable state gives you a lot to worry about, which I agree with. But public mutable fields make it even worse. Getters and setters at least minimize the surface area and give you some control over mutability.

There are many reasons why this is not the common practice, people have learned these lessons before.



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

Search: