Liskov Substitution Principle | SOLID Principles

In this post, I am going to discuss the third design principle of SOLID, which is the Liskov Substitution Principle.

The SOLID principles are a set of five principles for object-oriented class design. These best practices and rules should be followed when designing a class.

Single Responsibility Principle (SRP)| SOLID Principles

In this tutorial, I am going to discuss the Single Responsibility Principle of SOLID design principles.

I am going to discuss what is Single Responsibility Principle? How does this principle help us to write clean and maintainable code?

SOLID principles are made popular by Robert C. Martin. You can read his amazing book clean architecture.

Single Responsibility Principle

This principle states that a class should have only one reason to change.

Multiple reasons for change indicate a class has many responsibilities. A class that has many responsibilities is harder to maintain and also it increases the possibility of bugs.

To understand this principle, let’s take an example.