---
title: "Discussion on \"Code Smell 119 - Stairs Code\" | Hashnode"
description: "Discussion on \"Code Smell 119 - Stairs Code\". Nested boolean conditions express a business rule. Not an IF"
url: "https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Code Smell 119 - Stairs Code](https://maximilianocontieri.com/code-smell-119-stairs-code?utm_source=hashnode&utm_medium=feed)

Nested boolean conditions express a business rule. Not an IF

Mar 8, 2022 · 2 min read · maximilianocontieri.com  
Read the article

-   [#programming](https://hashnode.com/tag/programming)
-   [#clean-code](https://hashnode.com/tag/clean-code)
-   [#code-smell-1](https://hashnode.com/tag/code-smell-1)
-   [#refactoring](https://hashnode.com/tag/refactoring)
-   [#coding-challenge](https://hashnode.com/tag/coding-challenge)

## Written by

[Maxi Contieri](https://hashnode.com/@mcsee)

@mcsee · Buenos Aires

  
[View profile](https://hashnode.com/@mcsee)

Software Engineer

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.

## Responses 2

Markdown supported · ⌘↵ to post

[Nate Sire](https://hashnode.com/@natesire)

[Mar 8, 2022](https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c/comment/622711c056920671339a18fe)

I often use object literals in place of if/else or switch statements. JS is nice about that.

[Maxi Contieri](https://hashnode.com/@mcsee)

[Mar 8, 2022](https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c/comment/622711c056920671339a18fe#reply-6227755533120280724e7626)

That's ok if it brings more declarativeness

But switches violate open closed principle so they are yet another code smell

[Miki Szeles](https://hashnode.com/@mszeles)

[Mar 8, 2022](https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c/comment/6226d6b956920671339a0d3a)

Thanks Maxi for this great writing. I totally agree with you. I very often introduce methods additional local variables just to make my code more understandable. 😊

[Maxi Contieri](https://hashnode.com/@mcsee)

[Mar 8, 2022](https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c/comment/6226d6b956920671339a0d3a#reply-6227751933120280724e7606)

This case might be (or may not) be another smell.

Do you have a code snippet ?

[Miki Szeles](https://hashnode.com/@mszeles)

[Mar 8, 2022](https://hashnode.com/posts/code-smell-119-stairs-code/6226ce6456920671339a0c0c/comment/6226d6b956920671339a0d3a#reply-62277d8e67104e8316e3ecbd)

No I do not have a code snipet, but introducing a variable for betternunderstandg is a widely accepted method in clean code. 😉😊[Maxi Contieri](https://hashnode.com/@mcsee)
