You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Task ID: 3.0 Parent Spec:docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.md Depends On: Task 1.0, Task 2.0 (conceptually independent, but sequential for consistency) Status: Ready for Implementation Estimated Time: 2-3 hours
This task implements comprehensive documentation for Classical Gang of Four Patterns (11.2.4), including Strategy, Factory, Observer, and Decorator patterns with working examples distributed across languages, explicit SOLID connections, and an interactive quiz.
📋 Specification Context
Project Overview
This specification defines the remaining Design Patterns subsections for Chapter 11 (Application Development) of the DevOps Bootcamp. This task introduces selected Gang of Four patterns that directly relate to SOLID principles and are commonly used in production applications.
User Story
US-4: Recognizing Classical Patterns
As a senior CSCI student preparing for professional work, I want to recognize Strategy, Factory, Observer, and Decorator patterns in existing codebases so that I can understand and contribute to enterprise projects.
Functional Requirements
ID
Requirement
U4-FR1
The system shall explain Strategy Pattern with examples demonstrating swappable algorithms and explicit connection to Open/Closed Principle
U4-FR2
The system shall explain Factory Pattern with examples demonstrating object creation abstraction and explicit connection to Dependency Inversion Principle
U4-FR3
The system shall explain Observer Pattern with examples demonstrating event-driven communication between objects
U4-FR4
The system shall explain Decorator Pattern with examples demonstrating behavior extension and explicit connection to Open/Closed Principle
U4-FR5
The system shall organize pattern explanations by problem domain: Creational (Factory), Behavioral (Strategy, Observer), Structural (Decorator)
U4-FR6
The system shall explicitly connect each pattern to relevant SOLID principles with cross-references to 11.2.1 content
U4-FR7
The system shall provide pattern recognition exercises using real-world code snippets
U4-FR8
The system shall include a self-directed exercise for students to identify patterns in a production codebase of their choice
U4-FR9
The system shall include an interactive quiz testing pattern recognition across code snippets in multiple languages
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
Documentation:docs/11-application-development/11.2.4-classical-patterns.md exists with complete content including front-matter, pattern explanations organized by category (Creational/Behavioral/Structural), SOLID connections, and exercises
Strategy Pattern:examples/ch11/classical-patterns/strategy/ contains working implementation with README and explicit connection to Open/Closed Principle
Factory Pattern:examples/ch11/classical-patterns/factory/ contains working implementation with README and explicit connection to Dependency Inversion Principle
Observer Pattern:examples/ch11/classical-patterns/observer/ contains working implementation with README demonstrating event-driven communication
Decorator Pattern:examples/ch11/classical-patterns/decorator/ contains working implementation with README and explicit connection to Open/Closed Principle
Quiz:src/quizzes/chapter-11/11.2.4/classical-patterns-quiz.js exists with multi-language pattern recognition questions following quizdown format
CLI Verification: Tests pass in all example directories (using appropriate test command per language)
SOLID Integration: Each pattern README includes explicit cross-reference to relevant section in 11.2.1
3.2 Write introduction explaining Gang of Four patterns, their organization (Creational/Behavioral/Structural), and focus on patterns most relevant to SOLID principles
3.3 Write Strategy Pattern section (Behavioral) explaining swappable algorithms, explicit connection to Open/Closed Principle (extending behavior without modification), and cross-reference to 11.2.1
3.4 Write Factory Pattern section (Creational) explaining object creation abstraction, explicit connection to Dependency Inversion Principle (depending on abstractions), and cross-reference to 11.2.1
3.5 Write Observer Pattern section (Behavioral) explaining event-driven communication, one-to-many dependencies, and use cases (UI updates, event systems)
3.6 Write Decorator Pattern section (Structural) explaining dynamic behavior extension, explicit connection to Open/Closed Principle (adding responsibilities without modification), and cross-reference to 11.2.1
3.7 Add pattern recognition section with guidance on identifying these patterns in production codebases
3.8 Add self-directed exercise description for students to identify patterns in a production codebase of their choice
Code Example Tasks (Multi-Language)
3.9 Create Strategy Pattern Python example in examples/ch11/classical-patterns/strategy/ with pyproject.toml, src/ (different algorithm implementations), README.md with OCP connection, and tests
3.10 Create Factory Pattern Go example in examples/ch11/classical-patterns/factory/ with go.mod, factory.go (creation abstraction), README.md with DIP connection, and tests
3.11 Create Observer Pattern TypeScript example in examples/ch11/classical-patterns/observer/ with package.json, tsconfig.json, src/ (subject/observer implementation), README.md, and tests
3.12 Create Decorator Pattern Python example in examples/ch11/classical-patterns/decorator/ with pyproject.toml, src/ (base component + decorators), README.md with OCP connection, and tests
Quiz and Verification Tasks
3.13 Create interactive quiz src/quizzes/chapter-11/11.2.4/classical-patterns-quiz.js with 8-10 questions covering pattern recognition from code snippets in multiple languages, SOLID connections, and when to use each pattern
3.14 Verify Strategy and Decorator Python examples run successfully with uv run main.py and tests pass with uv run pytest
3.15 Verify Factory Go example runs successfully with go run main.go and tests pass with go test ./...
3.16 Verify Observer TypeScript example runs successfully with npm run start and tests pass with npm test
3.17 Embed quiz in documentation using Docsify quiz syntax and verify it renders correctly with npm start
📁 Relevant Files
Files to Create
Documentation:
docs/11-application-development/11.2.4-classical-patterns.md - Main documentation
# Strategy Pattern (Python)cd examples/ch11/classical-patterns/strategy
uv run main.py
uv run pytest
# Factory Pattern (Go)cd examples/ch11/classical-patterns/factory
go run main.go
go test ./...
# Observer Pattern (TypeScript)cd examples/ch11/classical-patterns/observer
npm install
npm run start
npm test# Decorator Pattern (Python)cd examples/ch11/classical-patterns/decorator
uv run main.py
uv run pytest
Success Criteria
This task is complete when:
All 17 sub-tasks are checked off
All proof artifacts exist and are verified
Tests pass in all four example directories (Python, Go, TypeScript)
Each pattern README explicitly cross-references relevant SOLID principle in 11.2.1
Quiz includes pattern recognition questions with multi-language code snippets
npm start successfully renders documentation with embedded quiz
Documentation follows bootcamp conventions and clearly organizes patterns by GoF category
🎯 Task Overview
Task ID: 3.0
Parent Spec:
docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.mdDepends On: Task 1.0, Task 2.0 (conceptually independent, but sequential for consistency)
Status: Ready for Implementation
Estimated Time: 2-3 hours
This task implements comprehensive documentation for Classical Gang of Four Patterns (11.2.4), including Strategy, Factory, Observer, and Decorator patterns with working examples distributed across languages, explicit SOLID connections, and an interactive quiz.
📋 Specification Context
Project Overview
This specification defines the remaining Design Patterns subsections for Chapter 11 (Application Development) of the DevOps Bootcamp. This task introduces selected Gang of Four patterns that directly relate to SOLID principles and are commonly used in production applications.
User Story
US-4: Recognizing Classical Patterns
As a senior CSCI student preparing for professional work, I want to recognize Strategy, Factory, Observer, and Decorator patterns in existing codebases so that I can understand and contribute to enterprise projects.
Functional Requirements
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
docs/11-application-development/11.2.4-classical-patterns.mdexists with complete content including front-matter, pattern explanations organized by category (Creational/Behavioral/Structural), SOLID connections, and exercisesexamples/ch11/classical-patterns/strategy/contains working implementation with README and explicit connection to Open/Closed Principleexamples/ch11/classical-patterns/factory/contains working implementation with README and explicit connection to Dependency Inversion Principleexamples/ch11/classical-patterns/observer/contains working implementation with README demonstrating event-driven communicationexamples/ch11/classical-patterns/decorator/contains working implementation with README and explicit connection to Open/Closed Principlesrc/quizzes/chapter-11/11.2.4/classical-patterns-quiz.jsexists with multi-language pattern recognition questions following quizdown format📝 Sub-tasks
Documentation Tasks
docs/11-application-development/11.2.4-classical-patterns.mdwith front-matter (category: Application Development, technologies: Python/Go/TypeScript/Design Patterns, estReadingMinutes: 45, exercise definition)Code Example Tasks (Multi-Language)
examples/ch11/classical-patterns/strategy/with pyproject.toml, src/ (different algorithm implementations), README.md with OCP connection, and testsexamples/ch11/classical-patterns/factory/with go.mod, factory.go (creation abstraction), README.md with DIP connection, and testsexamples/ch11/classical-patterns/observer/with package.json, tsconfig.json, src/ (subject/observer implementation), README.md, and testsexamples/ch11/classical-patterns/decorator/with pyproject.toml, src/ (base component + decorators), README.md with OCP connection, and testsQuiz and Verification Tasks
src/quizzes/chapter-11/11.2.4/classical-patterns-quiz.jswith 8-10 questions covering pattern recognition from code snippets in multiple languages, SOLID connections, and when to use each patternuv run main.pyand tests pass withuv run pytestgo run main.goand tests pass withgo test ./...npm run startand tests pass withnpm testnpm start📁 Relevant Files
Files to Create
Documentation:
docs/11-application-development/11.2.4-classical-patterns.md- Main documentationsrc/quizzes/chapter-11/11.2.4/classical-patterns-quiz.js- Interactive quizStrategy Pattern (Python):
examples/ch11/classical-patterns/strategy/pyproject.toml- Python dependenciesexamples/ch11/classical-patterns/strategy/src/strategy.py- Strategy interface and implementationsexamples/ch11/classical-patterns/strategy/src/main.py- Executable demoexamples/ch11/classical-patterns/strategy/tests/test_strategy.py- Unit testsexamples/ch11/classical-patterns/strategy/README.md- Setup, explanation, and OCP connectionFactory Pattern (Go):
examples/ch11/classical-patterns/factory/go.mod- Go module definitionexamples/ch11/classical-patterns/factory/factory.go- Factory interface and implementationsexamples/ch11/classical-patterns/factory/main.go- Executable demoexamples/ch11/classical-patterns/factory/factory_test.go- Unit testsexamples/ch11/classical-patterns/factory/README.md- Setup, explanation, and DIP connectionObserver Pattern (TypeScript):
examples/ch11/classical-patterns/observer/package.json- Dependenciesexamples/ch11/classical-patterns/observer/tsconfig.json- TypeScript configexamples/ch11/classical-patterns/observer/src/observer.ts- Observer interfaceexamples/ch11/classical-patterns/observer/src/subject.ts- Subject implementationexamples/ch11/classical-patterns/observer/src/main.ts- Executable demoexamples/ch11/classical-patterns/observer/tests/observer.test.ts- Unit testsexamples/ch11/classical-patterns/observer/README.md- Setup and explanationDecorator Pattern (Python):
examples/ch11/classical-patterns/decorator/pyproject.toml- Python dependenciesexamples/ch11/classical-patterns/decorator/src/decorator.py- Component interface and decoratorsexamples/ch11/classical-patterns/decorator/src/main.py- Executable demoexamples/ch11/classical-patterns/decorator/tests/test_decorator.py- Unit testsexamples/ch11/classical-patterns/decorator/README.md- Setup, explanation, and OCP connectionFiles to Reference
docs/11-application-development/11.2.1-solid-principles.md- SOLID principles (for explicit cross-references)examples/ch11/solid-exercises/- Example of existing code structuresrc/quizzes/chapter-11/11.2.1/solid-principles-quiz.js- Example quiz format to follow🎓 Repository Standards
Code Example Standards (Multi-Language)
Python (Strategy, Decorator):
uvfor dependency managementpyproject.tomlfor project configurationuv run pytestGo (Factory):
go test ./...TypeScript (Observer):
npm testGeneral:
mainfilesDocumentation Standards
[Open/Closed Principle](11-application-development/11.2.1-solid-principles.md#open-closed-principle-ocp)##) for navigation-visible sections, H3 (###) as default within sectionsQuiz Standards
src/quizzes/chapter-11/11.2.1/solid-principles-quiz.js🔗 Related Documentation
docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.mddocs/specs/01-spec-design-patterns-section/01-tasks-design-patterns-section.mdCLAUDE.md(repository root)STYLE.md(repository root)🤖 AI Agent Instructions
Implementation Approach
Pattern Implementation Suggestions
Strategy Pattern (Python):
Factory Pattern (Go):
Observer Pattern (TypeScript):
Decorator Pattern (Python):
Quality Checklist
Multi-Language Testing Commands
Success Criteria
This task is complete when:
npm startsuccessfully renders documentation with embedded quiz