Revision Notes/SOLID Principles
Field Entry - SOLID Principles
Liskov Substitution Principle (LSP)
Objects of a subclass should be replaceable for objects of the parent class without breaking the application.
Field Note - Real-world Analogy
“Like a work contract. If someone is hired as a "Software Engineer", the company expects certain behaviors: shows up to meetings, writes code, does code reviews. If a subtype of employee — say a "Senior Engineer" — refuses to do code reviews, they're not substitutable. The job title promises certain behaviors that must be fulfilled.”
Field Observations - Key Topics Covered
LSP says: wherever you use an Animal, you should be able to put a Dog or a Cat in its place and everything still works correctly. If a subclass breaks this expectation, you've violated LSP and your inheritance hierarchy is wrong.
4 more observations inside
Sign in to read every key point in full
Ready to go deeper?
Open the complete revision note.
Sign in to read every field observation in full, including a runnable code example and side-by-side comparisons with related patterns.
Read Full Notes