Is Liskov Substitution Principle incompatible with Introspection or Duck Typing?
Do I understand correctly that Liskov Substitution Principle cannot be observed in languages where objects can inspect themselves, like what is usual in duck typed languages?
Is this a violation of the Liskov Substitution Principle?
Say we have a list of Task entities, and a ProjectTask
sub type. Tasks can be closed at any time, except ProjectTasks
which cannot be closed once they have a status of Started. The UI should ensure the option to close a started ProjectTask
is never available, but some safeguards are present in the domain:
How to verify the Liskov substitution principle in an inheritance hierarchy?
Inspired by this answer:
What can go wrong if the Liskov substitution principle is violated?
I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what might go wrong if I as a developer do not think about the principle while writing object-oriented code.
Does Liskov Substitution Principle also apply to classes implementing an interface?
LSP states that classes should be substitutable for their base classes, meaning that derived and base classes should be semantically equivalent.
LSP vs OCP / Liskov Substitution VS Open Close
I am trying to understand the SOLID principles of OOP and I’ve come to the conclusion that LSP and OCP have some similarities (if not to say more).
Liskov substitution and abstract classes / strategy pattern
I’m trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much!
Does the state Pattern violate Liskov Substitution Principle?
This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
Do changes in performance violate the Liskov Substitution Principle?
Say I have:
How does strengthening of preconditions and weakening of postconditions violate Liskov substitution principle?
I read that Liskov’s substitution principle is violated if :