I spent an hour trying to figure out what a validation class did. By the end, I liked the concept and mentioned it in a daily wrap-up meeting. It was rightly rebuked as being full of code smells.
- Method 1 in the class created two array lists
- The method passed those empty lists to Method 2 with a full array of Strings
- Method 2 iterated through the array, each time passing both empty lists to Method 3
- Method 3 did a validity check and mutated one of the lists
- The whole of the class was dependent on difficult-to-test side effects
Good code doesn’t take an hour to understand. If intention is not immediately obvious, it’s not good code.