Lexicon

Leaf-vs-Container Special-Casing

Kind: anti-pattern

Layer: Design Patterns Core

Record: lexicon:leaf-vs-container-special-casing

Canonical: Lexicon

Branching client code on whether an element is a leaf or a container instead of treating them through one interface.

Listed in Lexicon terms, after Direct External Coupling and before Leaky Subsystem API.

Category

  • Structural Patterns

Negated by

  • Composite Pattern

Violates

  • Composite Pattern

Linked from

  • Structural Patterns