Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M3318

Composition over Inheritance

Composition over Inheritance
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-31

Loading revision record…

Summary

When building systems, prioritize implementing functionality by assembling simple components (composition) rather than establishing deep hierarchical relationships (inheritance).

Definition

When building systems, prioritize implementing functionality by assembling simple components (composition) rather than establishing deep hierarchical relationships (inheritance). Scaffold use: Lego-like flexibility. Don't try to design a universal 'parent class' for everyone to inherit (inheritance leads to rigidity and fragility). Make small, beautiful building blocks that can be plugged in wherever needed. In organizational design, forming flexible project teams (composition) is superior to rigid bureaucracy (inheritance).

How to use

Lego-like flexibility. Don't try to design a universal 'parent class' for everyone to inherit (inheritance leads to rigidity and fragility). Make small, beautiful building blocks that can be plugged in wherever needed. In organizational design, forming flexible project teams (composition) is superior to rigid bureaucracy (inheritance).

Mechanism

Prioritize assembling simple components (composition) to implement functionality, rather than building deep hierarchical inheritance. Inheritance easily leads to rigidity and fragility (changes in the parent class affect subclasses), while composition is more flexible, replaceable, and reduces coupling.

Practice

In progress 0/4

Practice this model in one real situation:

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

Cases

  • Using plugin composition rather than large parent class inheritance makes the system easier to evolve.

Common pitfalls

  • Forcing deep inheritance for reuse; over-composition leading to fragmentation; neglecting necessary inheritance.
Sources

Source support: Explicit

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

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

RELATED MODELS