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

It's more fundamental than just a rule of thumb, but it's not the only rule of good code.

Loose coupling (which implies getting rid of global state) is at least equally important, as is failing fast.



One problem is that junior and mid level developers have a lot of trouble figuring out good coupling because they are not experienced in the ways things can change.

I was reviewing some code yesterday and the developer had a bunch of interfaces for everything so she could swap out implementations and she was very proud of how modular everything was. The problem was that all of her interfaces accepted a File object instead of a stream so we could change what the behavior is but not what it acts on which is really the opposite of what we needed.


It's hard even if you're not a beginner. One of the hardest aspects of good design is choosing the appropriate level and location for coupling.

I find that most developers who think that they can predict what kind of coupling they will need for future requirements tend to be wrong, too, no matter how experienced. Only backwards-facing refactoring really works at producing a good result, coupling-wise.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: