My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
S.O.L.I.D : an object-oriented design(OOD)

S.O.L.I.D : an object-oriented design(OOD)

Vimal Tiwari's photo
Vimal Tiwari
·Oct 1, 2018

S.O.L.I.D is an acronym for the first five object-oriented design(OOD) principles by Robert C. Martin, popularly known as Uncle Bob.

S.O.L.I.D stands for:

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

Single-responsiblity principle : A class should have one and only one reason to change, meaning that a class should have only one job.

Open-closed principle : Objects or entities should be open for extension, but closed for modification. This simply means that a class should be easily extendable without modifying the class itself.

Liskov substitution principle : Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T. All this is stating is that every subclass/derived class should be substitutable for their base/parent class.

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.

Dependency Inversion principle : The last, but definitely not the least states that 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.