Skip to content

Comment on Why the "private" keyword is the modern day "goto"

Comments

I agree, at least partially, with the author.

In Java, I use package visibility a lot and since starting to use Ruby in a big way about 5 years ago, I often just make attributes public - no getters/setters. A bit sloppy, but makes code shorter and easier to read. I admit that this makes APIs less stable, etc.

On large or huge projects, I would follow conventional wisdom for Java best practices, but for smaller projects, shorter code and better readability works for me.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.