Hacker News new | ask | show | jobs
by esrauch 5265 days ago
All of your objects are immutable? Besides that's hardly an argument for having public members, being able to remove the setter or getter (or conditionally throw exceptions in them) is one of the exact reasons why you write them.

The intent of the comment you are replying to "best practice is if you would add a public member, instead add a private member and a setter & getter" which is generally correct.

1 comments

Yep, I think I misread his comment, which was probably a misread of my original post, which I'll admit wasn't stated very clearly.