Code Smell 22 - Helpers
5 November, 2022
0
0
0
Contributors
TL;DR: Helpers don't help. They are a non-cohesive bunch of messy subroutines.
Problems
•
Readability
•
The Least surprise principle
•
Bijection Fault
•
Static methods
Solutions
1.
Find a suitable name
2.
If the helper is a library, break all the services as different methods.
3.
Methods should always be fulfilled by objects. Static methods are another code smell.
4.
Avoid extracting the helpers to Anonymous Functions.
Sample Code
Wrong
Right
Detection
•
Tags
•
Conclusion
Relations
Also known as
•