A SOLID design principle. All subtypes must be substitutable for their base types. The validity of a model, viewed in isolated cannot be meaningfully validated. This means that we should design classes with the correct implementations to match the expectations of our clients.

Formal Definition

  • With be a property provable about objects of type
  • Then, should be true for all objects of type where is a subtype of

“If it looks like a duck, quacks like a duck, but needs batteries - you probably have the wrong abstraction”

Examples

Counter Example