Tutorial: How to apply SOLID Software Design Principles to Spring Boot Application
Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
This article is the first 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 first part is about SRP. Before jumping to concrete example, let’s have some theory.
A module should be responsible to one and only one actor. Robert C. Martin.