The short summary given above captures the main idea of LSP, but it is not self-sufficient by itself. In context of the following diagram, adherence to LSP means that ClientClass, which depends on SuperClass, can work seamlessly with instances of both SuperClass and SubClass, and should not be concerned with the distinction between the two: Robert Martin, in one of his papers, summarized LSP as follows:įunctions that use pointers or references to base classes must be able to use objects of derived classes without knowing it Robert C. The concepts underlying LSP had been initially introduced in Liskov’s 1988 paper titled “Data Abstraction and Hierarchy”, and were later restated and given a rigorous mathematical formulation in 1999 paper by Barbara Liskov and Jeannette Wing titled Behavioral Subtyping Using Invariants and Constraints. ![]() ![]() LSP is named after Barbara Liskov, who is a recognized computer scientist, a winner of 2008 Turing Award, and, judging by videos featuring her, a great teacher and a very nice lady. If you have difficulties understanding the examples, please read the introduction article. ![]() This post is part of a series that describe SOLID principles of Object Oriented Design. In this post we will discuss Liskov Substitution Principle of Object Oriented Design in details, and review a real design found in Android Open Source Project in order to understand its importance.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |