Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Quick MCQ — Which SOLID principle says “open for extension, closed for modification”?

  • A) Single Responsibility Principle

  • B) Open/Closed Principle

  • C) Interface Segregation Principle

Correct: B — Open/Closed Principle.


Exercises (Pyodide-ready)

  1. Add a LoyaltyDiscount class that gives 5% off and test replacing NoDiscount with it.

  2. Implement Logger to collect logs into a list (instead of printing) and return them for assertion.

  3. Sketch (as a markdown cell) how you would split Order responsibilities further to follow SRP more strictly.


SOLID Principles

# Your code here