Open/Closed: Add, Don't Edit

When every new grading scale means editing the grade function that the whole school trusts, each new scale risks breaking the old ones; the open/closed principle says to leave working code closed to edits and open to additions, so a new scale is a new class that keeps a promise, and the grade code never changes.

By

Updated

Cheat sheet: Open/Closed: Add, Don't Edit
Category
Data Structures
Level
Apprentice
Tags
Interface, OOP, Open/Closed Principle, Polymorphism