← Graph

Liskov Substitution Principle

concept 1 connections

Barbara Liskov's design principle: any two objects that implement the same interface are substitutable for one another, regardless of whether they do the right thing, the wrong thing, something, or nothing. Bellware uses LSP to justify defaulting dependencies to inert null-object mimics — a `SignUp` only requires that whatever is assigned to `http_client` conforms to the HTTP-client protocol, so a real client, a fake, a JSON implementation or an L7 implementation are all valid substitutes. Also argues LSP (not the common 'is-a' reading of inheritance) is the real point of OO: 'is substitutable for', not 'is a'. Reducing OO to procedural reuse via base classes and mixins loses this.

category
pattern
about
Liskov Substitution Principle concept
Justifies defaulting dependencies to inert substitutes by appealing to LSP ('is substitutable for').

Provenance

Read by
2 extractions