🔄 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.

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.