Code Smell 21 - Anonymous Functions Abusers
Functions, lambdas, closures. So high order, nondeclarative, and hot.
Reify algorithms in method object / Strategy
- Closures and anonymous functions are very useful to model code blocks, promises etc. So It'd difficult to tear them apart.
Humans read code. Software works ok with anonymous functions but maintainability is compromised when multiple closures are invoked.
Object-oriented programming increases the value of these metrics by managing this complexity. The most effective tool available for dealing with complexity is abstraction. Many types of abstraction can be used, but encapsulation is the main form of abstraction by which complexity is managed in object-oriented programming.
This article is part of the CodeSmell Series.
These busters are the most hard to debug! Not like debugging was an option, if code smells very much to begin with 😏