Skip to content
aipatterns.dev

Category

Simplifying Conditional Expressions

Techniques that flatten, name, merge and replace conditionals so branching logic reads as a list of plain decisions.

What these techniques solve

Conditionals grow by accretion. Each bug fix adds a clause, each feature adds a branch, and the result is nested if blocks with duplicated tails, control flags and null checks scattered across callers. These techniques make each decision explicit, remove repetition between branches, and move type-based branching into the types themselves.

A reader should see the normal path first and each exception as one named, early decision.

Members

How to choose within this category

See also

Original writing and examples. Topic coverage follows Refactoring.Guru, which explains this topic with its own illustrations.