SOLID: The First 5 Principles of Object-Oriented Design
In software development, we encounter numerous scenarios where our codebase is not scalable enough. That kind of behaviour could cause problems in future that will be very difficult to maintain.
The SOLID idea gives you a set of 5 rules that are:
-
The Single-Responsibility principle (SRP)
-
The Open-closed principle
-
The Liskow Substitution principle (LSP)
-
The Interface Segregation principle (ISP)
-
The Dependency Injection principle (DIP)
Single Responsibility Principle (SRP)
In this principle, every module, class or function in a program should consist of a single responsibility that describes and encapsulates that part of a program’s functionality.
Here is the following example: