All Courses
OOP: DESIGN PATTERNS

Chapter 16 Mega Enhancement Roadmap

Current Condition Check

Chapter 16 existed, but it was too short to work as a full learning module. The old files introduced Factory, Strategy, Observer, Adapter, Command, and Singleton, but most lessons had only a tiny definition, one code block, and one short guide. The chapter had no full chapter metadata, no pattern-selection map, no structured "Common Mistakes" coverage per lesson, no chapter cheat sheet table, no runnable example under examples/, and no assert-based test under tests/.

Skill Contract Applied

  • Use the actual repository TOC, not the older skill TOC that stopped at Chapter 14.
  • Keep Chapter 16 as 16_DESIGN_PATTERNS.
  • Each lesson must include definition, why it matters, syntax, explained C++ code, rules, common mistakes, and a quick check.
  • Each single lesson section must stay within the skill file target of 300-600 words excluding code.
  • Prefer short, compile-friendly examples with clear comments.
  • Add a chapter-level summary and practical exercises.
  • Verify local links and run the provided build/test workflow.

Word Count Audit

The skill file target for a single top-level section is 300-600 words excluding code.

Lesson Words excluding code Status
16.1_Factory.md 369 Within target
16.2_Strategy.md 354 Within target
16.3_Observer.md 339 Within target
16.4_Adapter.md 335 Within target
16.5_Command.md 338 Within target
16.6_Singleton_When_Not_To_Use.md 401 Within target

Enhancement Roadmap

  • [x] Correct the local writing skill TOC so Chapter 16 is recognized.
  • [x] Replace the short README with a chapter-level learning module overview.
  • [x] Rewrite 16.1_Factory.md with intent, syntax, code, mistakes, and viva-ready answers.
  • [x] Rewrite 16.2_Strategy.md with runtime algorithm selection and dependency injection.
  • [x] Rewrite 16.3_Observer.md with one-to-many notification and lifetime warnings.
  • [x] Rewrite 16.4_Adapter.md with legacy-interface conversion and wrapper design.
  • [x] Rewrite 16.5_Command.md with action objects, invokers, and undo-ready thinking.
  • [x] Rewrite 16.6_Singleton_When_Not_To_Use.md with safe syntax and overuse warnings.
  • [x] Expand PRACTICE.md into active recall, implementation, debugging, design review, and mini-project work.
  • [x] Add examples/16_design_patterns/pattern_catalog.cpp as a runnable demonstration.
  • [x] Add tests/design_patterns_test.cpp as a root Makefile test.
  • [x] Run markdown link verification and C++ build/test verification.

Final Learning Outcome

After this enhancement, a student should be able to choose a pattern by design pressure, explain the tradeoff, implement a small C++ version safely, and identify when a pattern is being overused.