'Substitution Principle' By Barbara Liskov
~ One of the most important SOLID Principle, well known for its capability to increase efficiency in OOP Language like Java - 'Liskov's Substitution Principle' can be described in two statements :-
~ Suppose, in Java coding terms, we should distribute classes into parent - child relationship. By using Java's Major Pillar - Inheritance, we can keep some common methods in parent class / interface and can be implemented in the child classes.
~ For example :-
~ The above example can be considered as one of the pragmatic example in Web Development. In which, Microservices can be programmed using LSP. The reason why we usually have to replace a microservice is that there is a new version of it. So, if my entity is a microservice, the equivalent entity is the new version of it. So, applying LSP to microservices, we don’t want to break existing clients of the service, but replace it with a better or enhanced one.
~ Benefits Of LSP :-