Breaking down the LSP
If that's about as clear as mud, don't worry; this principle isn't for the faint of heart. It helped me tremendously to break the definition apart, so let's give that a shot.
We'll start with the fact that we know we're going to be working with replacing instances of classes.
Next we know that we're going to be working with parent and child classes. This tells me that the principle revolves around object-oriented inheritance.
Lastly, it sounds like programs have to be able to allow for child class instances to seamlessly replace parent classes. This tells me that we need to focus on the messages that are sent along with ensuring that our parent and child classes can't have requirements that would cause conflicts.
Still ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access