Object-Oriented Design in Java
Learn OOP design patterns and SOLID principles in Java by building a RideShare simulation. Covers Factory, Builder, Strategy, Observer, Decorator, Adapter, and Dependency Injection through hands-on refactoring.
View badge details
About This Course
Course Curriculum
14 Lessons
SOLID Principles
Learn all five SOLID principles with real Java examples from the FleetFlow ride-sharing domain. Covers Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion Principle with before/after code comparisons.
SOLID - Lab Exercises
Hands-on exercises refactoring a monolithic RideShareApp to apply SOLID principles. Students extract domain classes (SRP), split the Vehicle interface into focused role interfaces (ISP), and wire a MapService abstraction into TripDispatcher (DIP).
Factory and Builder Patterns
Learn the Factory and Builder creational patterns. Factory centralizes object creation behind a single method so callers never use new directly. Builder assembles complex objects with fluent setter chains. Both patterns are applied to the RideShare vehicle and trip creation scenarios.
Factory & Builder - Lab Exercises
Hands-on exercises implementing VehicleFactory with an arrow switch, building a fluent TripBuilder with validation, and adding a config-file vehicle loader. Students replace all direct new Car/Van/Motorcycle calls with factory calls.
Strategy Pattern
Learn the Strategy Pattern — defining a family of interchangeable algorithms encapsulated behind a common interface. Applied to RideShare pricing: StandardPricing, SurgePricing, and FlatRatePricing can be swapped at runtime without changing TripDispatcher. Also covers Strategy vs Template Method.
Strategy - Lab Exercises
Hands-on exercises implementing StandardPricing, SurgePricing, and FlatRatePricing strategies, injecting a strategy into TripDispatcher via constructor, adding a null-guarded setter, and building an interactive pricing menu that swaps the active strategy at runtime.
Observer Pattern
Learn the Observer Pattern — one-to-many dependency where subject notifies all observers on state change. Applied to Trip completion: ReceiptService, DriverEarningsService, and AnalyticsService are observers registered on Trip. Covers thread safety with CopyOnWriteArrayList and memory leak prevention.
Observer - Lab Exercises
Hands-on exercises implementing ReceiptService, DriverEarningsService, and AnalyticsService observers, making Trip observable with add/remove/notify methods, registering all observers in Main.java, and adding a StatusLogObserver to verify notification order.
Decorator and Adapter Patterns
Learn the Decorator Pattern (adding behavior at runtime without subclassing) and the Adapter Pattern (making incompatible interfaces work together). Decorator is applied to TripService add-ons; Adapter wraps LegacyGpsLibrary behind the MapService interface.
Decorator & Adapter - Lab Exercises
Hands-on practice applying the Decorator and Adapter patterns to the RideShare simulation. Extend trip pricing with stacked decorators and integrate a legacy GPS system through an adapter.
Dependency Injection
Learn how to implement Dependency Injection manually in Java by building a simple DI container, applying constructor injection throughout the RideShare app, and establishing a clean composition root using the AppContainer pattern.
Dependency Injection - Lab Exercises
Hands-on practice refactoring the RideShare simulation to use constructor injection throughout and wiring the entire object graph in a single AppContainer composition root.
Capstone Briefing
A comprehensive review of all six design patterns covered in the course and a detailed briefing on the RideShare capstone project requirements that students will implement in the final lesson.
Capstone Project
The final capstone project for Object-Oriented Design in Java. Students implement a complete RidePool feature that integrates all six design patterns: Factory, Builder, Strategy, Observer, Decorator, and Adapter — assembled with Dependency Injection in a composition root.