Why this matters
- Interface
PricingStrategywithprice(Order) - CampusOS parking: nearest spot, cheapest spot, handicapped-first
- Spring-style: inject strategy via constructor
- Strategy: client chooses algorithm; often set once per operation
- Patterns are forces and solutions — name the force before the pattern.
Creational
Factorychoose implementation
Builderstep-by-step assembly
Structural
Decoratorstack behaviour
Facadesimple entry point
Behavioral
Strategyswap algorithm
Observernotify subscribers
Statebehaviour by mode
Overview
Swap algorithms at runtime without touching the client. Study each section below in order — every list is interview-ready reference material.
Pricing strategies
Points to cover
- Interface
PricingStrategywithprice(Order) - Implementations: Regular, StudentDiscount, PremiumMember
- Client holds
PricingStrategyfield — set at runtime - New pricing rule = new class, zero edits to checkout flow
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- Spot assignment
- Registration
- vs State pattern
Test yourself
Answer these before moving on — recall is what makes it stick.