Code Smell 62 - Flag Variables

Code Smell 62 - Flag Variables

Maxi Contieri
·Feb 8, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Flags indicate what happened. Unless their name is too generic.


  • Readability

  • Maintainability

  • Coupling


  1. Use meaningful names

  2. Try to avoid flags. They generate coupling.

Sample Code



We can search all the code for bad named flags.


  • Readability


Flags are widespread on production code. We should restrict their usage and use clear and intention revealing names.


More Info

If you lie to the compiler, it will get its revenge.

Henry Spencer

This article is part of the CodeSmell Series.

Share this


Technical Opinions are my own. I don't have the revealed truth.

Software Design is a creative activity. These are hints and not rigid rules.

I write on BackEnd Business Systems and OOP Design. My advice/experience might not suit other systems.

You can write me at info(at)