Why this matters
- Interviewers expect pillars as design decisions, not textbook definitions.
- Each pillar answers a different change scenario — encapsulation vs polymorphism.
- CampusOS modules reuse the same pillar vocabulary across parking, booking, and feeds.
- Links to Core Java OOP — this article applies those ideas to class diagrams.
EncapsulationHide the data, expose behaviour
AbstractionPublish intent, hide mechanics
InheritanceReuse a parent contract
PolymorphismOne call, many outcomes
Overview
How encapsulation, abstraction, inheritance, and polymorphism show up in real class diagrams. Study each section below in order — every list is interview-ready reference material.
Encapsulation in CampusOS
Points to cover
- Definition — what Encapsulation in CampusOS 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
Abstraction boundaries
Points to cover
- Definition — what Abstraction boundaries 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
When inheritance helps
Points to cover
- Definition — what When inheritance helps 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
Polymorphism over switches
Points to cover
- Definition — what Polymorphism over switches 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 "Encapsulation in CampusOS" on paper first, then in code
public final class OopPillarsInPracticeExample {
// 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.
- Encapsulation in CampusOS — review this slice before mock interviews.
- Abstraction boundaries — review this slice before mock interviews.
- When inheritance helps — review this slice before mock interviews.
- Polymorphism over switches — review this slice before mock interviews.
Test yourself
Answer these before moving on — recall is what makes it stick.