4 ms·
> I totally fail to parse any written explanation of liskov substitution principle Off the top of my head, "all child classes should be usable interchangeably
by MauranKilom 5y ago
> I totally fail to parse any written explanation of liskov substitution principle
Off the top of my head, "all child classes should be usable interchangeably when dealing with an interface/base class". I guess that's too imprecise to qualify as "written explanation"?
- Koshkin 5y agoThis doesn’t sound correct to me. The original statement is, Let ϕ(x) be a property provable about objects x of type T. Then ϕ(y) should be true for objects y of type S where S is a subtype of T. Here, objects of a base class are replaced with objects of derived classes.
- rfrey 5y agoI interviewed a guy once who used rho instead of phi when I asked this question. What a bozo.
- marcosdumay 5y ago> This doesn’t sound correct to me. Yet the GP says exactly the same thing as you said. He just ignored that the property belongs to the base class.
- kragen 5y agoThe GP said "usable interchangeably", which is vague enough to admit a wide variety of interpretations, including the more rigorous one Koshkin posted.
- marcosdumay 5y agoYet he got unambiguously declared wrong...
- karmakaze 5y agoOr 'is a' implies 'behaves as a'.