Software Design: Tidy First?

Guard Clause

Kent Beck's avatar
Kent Beck
Jan 28, 2022
∙ Paid

Imagine you have some code.

...some code...

Later you discover you only want to run it sometimes.

if (condition)
    ...some code...

Even later you discover a reason not to run the code.

if (condition)
   if (not other condition)
      ...some code...

As a reader, it's easy to get lost in the nested conditions. Tidy the above to:

User's avatar

Continue reading this post for free, courtesy of Kent Beck.

Or purchase a paid subscription.
© 2025 Kent Beck · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture