Lexicon

Replace Boolean with Enum

Kind: technique

Layer: Structural Core

Record: lexicon:replace-boolean-with-enum

Canonical: Lexicon

A technique for replacing a boolean parameter or flag with a closed set of named values.

Listed in Lexicon terms, after Name Constant.

Category

  • Core Vocabulary

Refactors

  • Primitive Obsession
  • Stringly Typed Programming
  • Boolean Trap
  • Intent-Revealing Interface

Linked from

  • Anti-patterns
  • Schema / Canonical Data / Semantics