Software Engineering Architecture Lab

Open/Closed: Add Features Without Editing Old Code

Extend behaviour through new classes instead of growing if/else chains. Lesson 2 of Level 3: Object-Oriented Design.

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

Extend behaviour through new classes instead of growing if/else chains.

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