Code Smell 60 - Global Classes
Classes are handy. We can call them and invoke them any time. Is this good?
Classes are global unless we use Namespaces.
Use namespaces, module qualifiers or similar
Avoid namespace polluting, keep the Global names as short as possible.
Class single Responsibility is to create instances.
We can use almost any linter or create dependency rules searching for bad class references.
We should restrict our classes to small domains and expose just facades to the outside. This greatly reduces coupling.
Write shy code — modules that don't reveal anything unnecessary to other modules and that don't rely on other modules' implementations.
This article is part of the CodeSmell Series.