๐ Refactoring an anti-pattern: complex extractions in function heads
Notes
People use function-head pattern matching as a logic control and as an extraction mechanism. Both uses are valid.
But when we use both at the same time in different function heads, we make it difficult to know whatโs important for logic flow and whatโs merely an extraction convenience.
Elixirโs documentation calls that the Complex extractions in clauses anti-pattern.
Letโs perform a refactoring to add clarity to our code.