O - Open Closed (OCP)

About

Classes should be open to extension and closed for modification.

The behavior of a module can be extended without modifying its source code.

Whenever you need to add new functionality to a class, don't just modify the existent class.

Instead create a base class, and for each added functionality you make it in a new class to extend the base one.

circle-info

Using Factories to create similar implementations.

Drawing

Last updated