Categories: Software Architecture

What is the Liskov Substitution Principle(LSP) in SOLID Design Principles?

Liskov substitution principle is named after Barbara Liskov, a computer scientist who first formulated the principle in 1987.

It is one of the five SOLID principles of object-oriented design, which are widely used guidelines for writing clean and maintainable code.

The Liskov substitution principle is a concept in object-oriented programming that states that if a program is using a class hierarchy in which subclasses are inherited from a base class, then the objects of these subclasses should be able to be substituted for objects of the base class without affecting the correctness of the program.

In other words, if a piece of code works correctly with an object of a given class, it should also work correctly with an object of any subclass of that class.

The Liskov substitution principle helps ensure that code is modular and extensible, as it allows developers to add new subclasses without having to change the code that uses the base class.

Liskov substitution principle also helps prevent unexpected behavior in code, as it requires that subclasses do not introduce new behaviors that are not present in the base class.

Rajeev

Recent Posts

OWIN Authentication in .NET Core

OWIN (Open Web Interface for .NET) is an interface between web servers and web applications…

2 years ago

Serializing and Deserializing JSON using Jsonconvertor in C#

JSON (JavaScript Object Notation) is a commonly used data exchange format that facilitates data exchange…

2 years ago

What is CAP Theorem? | What is Brewer’s Theorem?

The CAP theorem is also known as Brewer's theorem. What is CAP Theorem? CAP theorem…

2 years ago

SOLID -Basic Software Design Principles

Some of the Key factors that need to consider while architecting or designing a software…

2 years ago

What is Interface Segregation Principle (ISP) in SOLID Design Principles?

The Interface Segregation Principle (ISP) is one of the SOLID principles of object-oriented design. The…

2 years ago

What is Single Responsibility Principle (SRP) in SOLID Design Priciples?

The Single Responsibility Principle (SRP), also known as the Singularity Principle, is a software design…

2 years ago