Solid Open Closed Principle Example



Solid Open Closed Principle Example

Solid Open Closed Principle Example

Ever hear about the Open Closed principle which says components should be open for extension but closed for modification? Well, it’s a very simple idea, but it’s easier to understand if you have a code example or two.

So here we go, a simple example of how the software development best practice and design pattern known as the open closed principle works.

In this case we’ll use Java code, but the same concepts apply for Python, JavaScript, Rust, GoLang and any other computer programming language.