Drop The If-Else If You Want Better Code Quality and Higher Flexibility

If-else and switch cases are no different from hardcoded values.

Nicklas Millard
The Better Software Initiative

--

By Nicklas Millard

Given the practically universal recognition of the importance of writing flexible, maintainable software, it’s natural to ask “Why do developers keep using traditional branching such as if-else statements?”

To begin with, if-else is part of any developer’s Programming 101 curriculum. Everybody learns it. It’s easy to implement (at first) and reads well (until more conditions are added).

However, after years of experience creating green field projects and maintaining other’s code, I’ve felt firsthand what a mess traditional branching causes and its crippling effect on velocity.

In terms of velocity: never measure productivity by the number of features you complete. Measure it by the features that stay done. It’s not done if you go back to add more to it.

Writing if-else and switch cases is the active avoidance of the hard work of analyzing and anticipating how your system will change throughout its lifetime.

--

--

Nicklas Millard
The Better Software Initiative

I mostly write to "future me" sharing what I learn and my opinion on software development practices. youtube.com/@nmillard | open for contracts in Jan 2026.