← Graph

Open-Closed Principle

concept 1 connections

The 'O' in SOLID — software entities should be open for extension but closed for modification. In Rodzik's talk, 'Fredo's friends' suggest OCP as the fix when a new 'BetterDice' (with sides 1,1,3,4,5,6) breaks the tests: extracting a `Dice` abstraction and injecting it lets new dice variants be added without modifying the `Game` class or its tests.

category
pattern
about
Open-Closed Principle concept
Third iteration applies OCP to extract a Dice abstraction so new dice variants don't require modifying the Game class.

Provenance

Read by
4 extractions