SOLID are five basic principles
(in OOP) which help to create good software architecture. In this blog I am
just giving quick and short description for it.
SOLID is an acronym where:-
·
S stands for SRP (Single responsibility principle):- A class
should have only one responsibility, not multiple. This is for separation
of concern.
·
O stands for OCP (Open closed principle):- Extension
should be preferred over modification. Meaning rather
than “MODIFYING” go for “EXTENSION”.
·
L stands for LSP (Liskov substitution principle):- A parent
class object should be able to refer child objects during runtime polymorphism. LISKOV principle says the parent should
easily replace the child object. LISKOV can be implemented through Interface (multiple
inheritance).
·
I stands for ISP (Interface segregation principle):- Client
should not be forced to use an interface if it does not need it. Can be achieved
be rather than modifying existing interface create new
interface which will inherits from existing interface.
·
D stands for DIP (Dependency inversion principle):- High
level modules should not depend on low level modules but should depend on
abstraction. Both should depend on abstractions. Also Abstractions should not depend on details. Details should depend on abstractions
Comments
Post a Comment