Applying the Open/Closed Principle

The Open/Closed Principle (part of the SOLID principles) states that our modules or classes should be open for extension but closed for modification. It promises change in your codebase without actual change.

The OCP is an absolute must-know in order to build maintainable and modular software solutions.

In this training session we uncover the secrets of the Open/Closed Principle by example. There is a bit more to it than just having interfaces and different implementations!
We will cover how to prepare a code base for the OCP, how to effectively apply this principle and what to look out for. We will tackle the misconception that the OCP is only about extending the code. The additions we are making still need to be used somehow. We will see different ways of managing that.

I have also written a more in-depth article about the Open/Closed Principle which you can read here.

The Open/Closed Principle explained

What if you do not apply the Open/Closed Principle?

Preparing for applying the Open/Closed Principle

Exploring the OCP using composition and interfaces

Exploring the OCP by extracting behaviour

Exploring the OCP using inheritance