Member-only story
How to apply SOLID Software Design Principles to Spring Boot Application (Part 3)
LSP: Liskov Substitution Principle
(skip the first paragraph if you have already read other parts of this blog series)
This article is the third 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 third part is about LSP. Before jumping to concrete example, let’s have some theory.
If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms…