Head-First-Design-Pattern-CPP-Examples icon indicating copy to clipboard operation
Head-First-Design-Pattern-CPP-Examples copied to clipboard

Head First Design Pattern: C++ Examples

Head First Design Patterns: A Brain-Friendly Guide by Eric Freeman, Elisabeth Robson, Bert Bates and Kathy Sierra

These are my C++ implementations of all the exercises in Head First Design Pattern I did them for my own learning. I hope that they will be useful to someone else.

Please let me know if you found a mistake or a bug.

Cheers!

NOTE: stay tune for the rest of the patterns

Contents

  • Chapter 1. Strategy
  • Chapter 2. Observer
    • Weather-O-Rama: push model
    • Weather-O-Rama: pull model
  • Chapter 3. Decorator
    • starBuzz Coffee Shop
  • Chapter 4. Factory
    • Simple Factory
    • The Factory Method
    • Abstract Factory
  • Chapter 5. Singleton
    • Classic Singleton
    • Chocolate Boiler
    • Thread Safe:
      • Synchronized
      • Eagerly created instance
      • Double-checked lock
      • Subclassed
  • Chapter 6. Command
    • Simple Remote Control
    • Remote Control
    • Remote Control with undo
    • Remote Control Party Macros
    • Dinner Order using lambda function
  • Chapter 7. Adapter and Facade
    • Adapter
      • Object Adapter
      • Class Adapter
    • Facade
  • Chapter 8. Template Method
    • Barista: Coffee and Tea
    • sort
  • Chapter 9. Iterator and Composite
    • Iterator
      • Diner Merger
      • Diner Merger - built-in Java Iterator
      • Diner/Cafe Merger
    • Composite
      • Menu
      • Menu Iterator
  • Chapter 10. State
    • Gumball Machine - without state pattern
    • Gumball Machine - with state pattern
    • Gumball Machine - with Winner State