Guest MemberLanguage   English
Software Architecture · SOLID Principles

How would you answer an interview scenario involving Liskov Substitution Principle?

AdvancedUpdated 2026-08-09

For an interview scenario involving Liskov Substitution Principle, I would first clarify the business goal, scale, constraints, and the failure or quality attribute the interviewer wants to explore. LSP requires implementations of an abstraction to preserve the expectations and guarantees of that abstraction. In this scenario, a read-only collection inherits an interface requiring Add. Explain the LSP problem and redesign. For production, define precise contracts, avoid overly broad base types, and test implementations against shared behavioral expectations. I would then explain the main alternatives and tradeoffs, identify likely failure modes, and describe how I would validate the solution through testing, observability, security controls, and recovery or rollback planning.

#solid-principles#lsp