SOLID Design Principle

SOLID principles are the set of principle fist given by Robert.C.Martin. SOLID principle as name given its set of principle that allows building SOLID software system.

Unlike OOD and Design Pattern, SOLID principles are related with the design and maintenance of software system.SOLID prinicples helps in designing a software which is easy to maintain, easy to expand , easy to understand, easy to implement, easy to explain.

S.O.L.I.D is acronym for

Single Responsibility Principle : Principle is related to Designing software module, class or function that should perform only one task. So this principle is about Creation.

Open/Close Principle : Principle is applied after 1 (Single Responsibility Principle), again this principle is related to Designing module, class or function. But it about closing already designed thing for modification but opening designed thing for extension i.e. extending functionality. So this principle is about extension.

Liskov Substitution Principle : Principle is related to substitution of child in place of its parent. So principle is about relationship i.e. inheritance.

Interface Segregation Principle : Principle is related to designing of interfaces as one of the basic rules of designing says depends on abstraction. Principle is about design interface such a way, so that client of interface not force to implement not required things. So principle is about efficient interface design.

Dependency Inversion Principle  : Principle is related to designing decoupling modules, classes of software system. This principle mostly applied after 4 (Interface Segregation principle) because interface are one form of abstraction and this principle is related to Details (module/class) should depend on abstraction, and abstraction should not depend on detail. So this principle is about creating loosely coupled system.

Now we will see them the above principles in more detail with examples .

Single Responsibility Principle : In principle it says that an implementation (class / function) should perform only one task or implementation and it (class / function) should be changed for only one reason.

So in simple words it says that whatever the developer implements (class / function) in code during development should perform only one task and developer should only have one reason to change the implementation (class / function).

Example of a class not following Single Responsibility Principle.

https://www.codeproject.com/Articles/1009577/Solid-Principle-In-Detail
https://www.codeproject.com/Tips/1033646/SOLID-Principle-with-Csharp-Example


Comments

  1. Good Product Design draws in even more clients thereby offering an organisation a hedge above other rivals out there.It is likewise important since it brings together three essential concerns, the principle, the package as well as the procedure.Good product design is essential in changing out-of-date designs.

    ReplyDelete

Post a Comment

Popular posts from this blog

Deploy standalone Spring MVC Application in Docker Container

Refactor Code : Separate Query from Modifier

HTTP : Must known Protocol (Part 1)