SOLID design principle

SOLID is an acronym. which full meaning is

S – Single-responsibility principle
O – Open-closed principle
L – Liskov substitution principle
I – Interface segregation principle
D – Dependency Inversion Principle

When a developer develop a software if he flows this principle it is easy to maintenance and reuse and test his module. let see what is S.O.L.I.D is.

Understanding “S”- SRP (Single responsibility principle)

A class should have one and only one reason to change, meaning that a class should have only one job.

For example Student class represent student

Understanding “O” – Open closed principle

Objects or entities should be open for extension, but closed for modification.

Understanding “L”- LSP (Liskov substitution principle)

Every subclass/derived class should be substitutable for their base/parent class.

Understanding “I” – ISP (Interface Segregation principle)

A client should never be forced to implement an interface that it doesn’t use or clients shouldn’t be forced to depend on methods they do not use.

Understanding “D”- Dependency inversion principle

Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.

Leave a Reply

Your email address will not be published. Required fields are marked *