Code Smell 03 - Functions Are Too Long
Humans get bored beyond line 10.
- Low Cohesion
- High coupling
- Difficult to read
2) Create small objects dealing with some of the tasks. Unit test them.
3) Compose methods
All linters can measure and warn when methods are larger than a predefined threshold.
Also Known as
- Long Method
Extract long method into smaller pieces. Break complex algorithms in parts. You can also unit test these parts.
Programs are meant to be read by humans and only incidentally for computers to execute.
This article is part of the CodeSmell Series.