The solution to pollution
In essence, we're striving to make sure that a newcomer to a project is never surprised by what they see. Everything should be clearly labeled, decisions should have logic behind them, and code should be in a place that makes sense for its functionality. We've briefly touched on how a namespace (such as utils
) can become a "bucket" for code that doesn't immediately fit. There are a couple of other situations in which we find ourselves creating a dumping ground for functions that nobody knows what to do with.
A global solution to a local problem
Our hero, the plucky programmer with a lot of heart and a burgeoning talent, is writing their latest application when they realize something.
I'm going to need this function a lot; potentially, in most of my UI components.
Worried, they consider the best way to implement it, then the best place for it to fit in the existing code base.
I need to call it from anywhere in the application. Also, my...