Skip to content

Commit 437d11f

Browse files
authored
Update README.md
1 parent b7904b7 commit 437d11f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

3 - Liskov Substition Principle/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Liskov Substitution Principle (LSP)
22

3-
The Liskov Substitution Principle (LSP) is a design principle from the SOLID principles that suggests that subtypes should be substitutable for their base types. In other words, any object or instance of a subtype should be able to be used in place of an instance of its base type without affecting the correctness of the program.
3+
The Liskov Substitution Principle (LSP) states that subtypes should be substitutable for their base types. Any object or instance of a subtype should be able to be used in place of an instance of its base type without affecting the correctness of the program.
44

5-
The LSP is important because it ensures that the behavior of the program remains consistent when working with different types of objects. It allows you to write code that is more flexible and adaptable, and makes it easier to add new types to your codebase without having to modify existing code.
5+
This principle ensures that the behavior of the program remains consistent when working with different types of objects. Therefore, it is easier to add new types to your codebase without having to modify existing code.
66

7-
To follow the LSP, it's important to ensure that all subclasses or subtypes of a class or interface adhere to the same behavior as the base class or interface. This means that the subclass should not introduce new behaviors that are not present in the base class, and it should not modify the behavior of any methods or properties that are inherited from the base class.
7+
You must ensure that all subclasses or subtypes of a class or interface adhere to the same behavior as the base class or interface. This means that the subclass should not introduce new behaviors that are not present in the base class, and it should not modify the behavior of any methods or properties that are inherited from the base class.
88

9-
In practice, this means that you should carefully consider the contract defined by the base class or interface, and ensure that any subclasses or subtypes adhere to that contract. This allows you to write code that is more generic and reusable, and reduces the amount of code duplication and maintenance required over time.
9+
In practice, this means that you should carefully consider the contract defined by the base class or interface, and ensure that any subclasses or subtypes adhere to that contract. This method will reduce the amount of code duplication and maintenance required over time.
1010

1111

1212
### Class diagram for the current example

0 commit comments

Comments
 (0)