Code Smell 17 - Global Functions
Discouraged by Object-Oriented Programmings, Many mixed languages support it. And developers abuse them.
- Wrap the function in a context object.
- External Resources Access, Database access, Time and Operating System resources.
Many modern languages avoid them. For the permissive ones, scope rules can be applied and automatically checked.
Structured programming considers global functions harmful. Yet, we can observe some bad practices cross paradigm boundaries.
- Singleton and Classes are global points of access.
The road to programming hell is paved with global variables.
This article is part of the CodeSmell Series.