Why this matters
- Contract definition — detailed pointwise breakdown in the section below.
- Square-rectangle trap — detailed pointwise breakdown in the section below.
- Pre/post conditions — detailed pointwise breakdown in the section below.
- CampusOS payment types — detailed pointwise breakdown in the section below.
- SOLID is scored as refactor skill, not acronym recall.
SRPOne reason to change
OCPExtend, don't modify
LSPSubtypes substitutable
ISPSmall interfaces
DIPDepend on abstractions
Overview
Subtypes must honour the parent's promise — or the hierarchy is lying. Study each section below in order — every list is interview-ready reference material.
Contract definition
Points to cover
- Definition — what Contract definition means in one clear sentence
- When to use — the force or smell that triggers this concept
- CampusOS example — where this appears in parking, booking, or library modules
- How to explain — pointwise bullets you can say aloud in an interview
- Common mistake — what weak candidates do instead
- Refactor move — one concrete change that improves the design
Square-rectangle trap
Points to cover
- Definition — what Square-rectangle trap means in one clear sentence
- When to use — the force or smell that triggers this concept
- CampusOS example — where this appears in parking, booking, or library modules
- How to explain — pointwise bullets you can say aloud in an interview
- Common mistake — what weak candidates do instead
- Refactor move — one concrete change that improves the design
Pre/post conditions
Points to cover
- Definition — what Pre/post conditions means in one clear sentence
- When to use — the force or smell that triggers this concept
- CampusOS example — where this appears in parking, booking, or library modules
- How to explain — pointwise bullets you can say aloud in an interview
- Common mistake — what weak candidates do instead
- Refactor move — one concrete change that improves the design
CampusOS payment types
Points to cover
- Definition — what CampusOS payment types means in one clear sentence
- When to use — the force or smell that triggers this concept
- CampusOS example — where this appears in parking, booking, or library modules
- How to explain — pointwise bullets you can say aloud in an interview
- Common mistake — what weak candidates do instead
- Refactor move — one concrete change that improves the design
// CampusOS — apply "Contract definition" on paper first, then in code
public final class LiskovAndContractsExample {
// 1. Name entities from the problem statement
// 2. Draw relationships before writing methods
// 3. Introduce patterns only when a force appears
}
Quick recall
Everything you need if you only revisit this box.
- Contract definition — review this slice before mock interviews.
- Square-rectangle trap — review this slice before mock interviews.
- Pre/post conditions — review this slice before mock interviews.
- CampusOS payment types — review this slice before mock interviews.
Test yourself
Answer these before moving on — recall is what makes it stick.