Why this matters
- Subject/observer — detailed pointwise breakdown in the section below.
- Push vs pull — detailed pointwise breakdown in the section below.
- CampusOS seat alerts — detailed pointwise breakdown in the section below.
- Memory leaks — detailed pointwise breakdown in the section below.
- Patterns are forces and solutions — name the force before the pattern.
SubjectnotifyObservers()
Observer A
Observer B
Observer C
Overview
Decouple event sources from listeners. Study each section below in order — every list is interview-ready reference material.
Subject/observer
Points to cover
- Definition — what Subject/observer 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
Push vs pull
Points to cover
- Definition — what Push vs pull 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 seat alerts
Points to cover
- Definition — what CampusOS seat alerts 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
Memory leaks
Points to cover
- Definition — what Memory leaks 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 "Subject/observer" on paper first, then in code
public final class ObserverPatternExample {
// 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.
- Subject/observer — review this slice before mock interviews.
- Push vs pull — review this slice before mock interviews.
- CampusOS seat alerts — review this slice before mock interviews.
- Memory leaks — review this slice before mock interviews.
Test yourself
Answer these before moving on — recall is what makes it stick.