S.O.L.I.D Principles

S.O.L.I.D Principles Introduction

  •  SOLID principles are the look principle that allows us to manage most of the software design problems. 
  • The principles are a subset of many principles by Robart C Martin

S.O.L.I.D are 5 object-oriented principles that should be followed when design software 
  • S-  Single Responsibility Principle (SRP)
  • O- Open- Closed Principle (OCP)
  • L- Liskov Substitution Principle (LSP)
  • I - Interface Segregation Principle (ISP)
  • D- Dependency Inversion Principle (DIP)

Single Responsibility Principle (SRP)


And that responsibility should be entirely encapsulated by the class every module or class should have responsibility for one part of the functionality provided by the software
 





Open-Closed Principle (OCP)

Adding new classes, attributes, and methods, instead of changing the current ones or existing ones should implement any new functionality. Bertrand Meyer originated the term OCP.    

Why OCP?

if not followed 
  •    End up testing the entire functionality.
  •    QA term needs to test the entire now.
  •    Costly process for the origination. 
  •    Breaks the single responsibility as well. 
  •    Maintenance overheads increase on the classes.  

Liskov Substitution Principle(LSP)

Barbara Liskov introduced the concept of this principle in a 1987 conference. Formal definition created by Barbara Liskov and Jeannette wing in 1994. LSP is a subtyping relation, called (strong) behavioral subtyping. Extension of the Open Close Principle. Any subclass replacing parent class instantiation is not always fulfilling LSP  




Interface Segregation Principle (ISP)

One fat interface need to be split too much smaller and relevant interface so that clients can know about the interfaces that are relevant to them. 






 Dependency Inversion Principle (DIP)

  • High-level modules should not depend on low-level modules. Both should depend on abstractions
  • Abstractions should not depend on details. Details should depend on abstractions.

The interaction between low level and high-level modules should be thought of as an abstract interaction between them

Intention of usage

















Comments

Popular posts from this blog

HTTP Methods

KoaJS in NodeJS