Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M8725

Polymorphism

Polymorphism
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-28

Loading revision record…

Summary

The same interface can be carried by different implementations, letting a system choose the concrete behavior dynamically at runtime.

Definition

Polymorphism means that a single interface can be carried by different implementations, and the system can dynamically select which concrete behavior to execute at runtime. Its scaffolding value is designing for flexibility: it reserves room for change rather than hard-coding one specific implementation, so new variants can be added without rewriting the interface.

How to use

- Design for flexibility: reserve room for change rather than hard-coding one specific implementation. - Swap behavior at runtime: let the system choose which concrete implementation to execute behind one interface.

Mechanism

Polymorphic composition leverages object-oriented polymorphism to encapsulate behavioral differences as replaceable implementations, combined at runtime. The mechanism is that the same interface has multiple forms, enhancing extensibility and decoupling.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Payments use a unified Payable interface, with domestic and overseas implementations hot-swappable.

Common pitfalls

  • Creating useless abstractions for the sake of polymorphism, or inconsistent semantics among implementations.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/PolymorphismZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS