Software Engineering Architecture Lab

Composition Over Inheritance

Assemble behaviour from parts instead of building deep class trees. Lesson 5 of Level 3: Object-Oriented Design.

Level 3 · Object-Oriented Design · Lesson 5 of 6

Assemble behaviour from parts instead of building deep class trees.

Continue learning

All lessons in OO Design

  1. Single Responsibility: One Reason to Change
  2. Open/Closed: Add Features Without Editing Old Code
  3. Liskov Substitution: Subtypes That Keep Their Promises
  4. Interface Segregation & Dependency Inversion
  5. Composition Over Inheritance
  6. Encapsulation, Tell Don’t Ask & the Law of Demeter