Member-only story
How to apply SOLID Software Design Principles to Spring Boot Application (Part 2)
OCP: Open-Closed Principle
(skip the first paragraph if you have already read other parts of this blog series)
This article is the second part of the blog series, dedicated to well-known software design principles, that evolved over time and were finally summarised by Robert C. Martin with initials of the corresponding principles. These principles guide us how to build well-designed software systems, giving best practices for arranging classes, functions, building blocks. We will look at each principle in depth and apply it to the Spring Boot Application. The idea is refactoring existing software based on these principles from architectural point of view.
The word S.O.L.I.D. stands for:
- SRP: Single Responsibility Principle
- OCP: Open-Closed Principle
- LSP: Liskov Substitution Principle
- ISP: Interface Segregation Principle
- DIP: Dependency Inversion Principle
This second part is about OCP. Before jumping to concrete example, let’s have some theory.
A Software artifact should be open for extension but closed for modification.