Last Revision — April 19, 2022
2 Min Read
Complex Method God Method Brain Method
Bloaters
Measured Smells
Within a Class
- Large Class (causes)
- Side Effects (causes)
- Dubious Abstraction (co-exist)
- Side Effects (co-exist)
- Long Parameter List (co-exist)
- Flag Arguments (caused)
Martin Fowler in book (1999): "Refactoring: Improving the Design of Existing Code"
One of the most apparent complications developers can encounter in the code is the length of a method. The more lines of code a function has, the more the developer has to strain himself mentally to comprehend what the particular block of code does thoroughly. The longer a procedure is, the more difficult it is to understand it [1]. It is also harder to change or extend [2]. In addition, reading more lines requires more time, which quickly adds up because the code is read more than it is written [3]. Fowler strongly believes in short methods as a better option.
The author adds another code line rather than breaking the flow to identify the helper objects [4].