Add Task 4.0: Integrated Refactoring Exercise (11.2.5) #826
+19,136
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements comprehensive refactoring exercise synthesizing Repository, Service Layer, and Strategy patterns. Students transform a deliberately flawed e-commerce system while preserving behavior through 37 tests.
Implementation
Starter Application - Authentic anti-patterns for teaching
routes.ts) with 7+ SOLID violationsSolution Application - Clean architecture demonstrating
IPaymentStrategy/IShippingStrategyinterfacesIOrderRepository/IProductRepositoryOrderServiceindex.tsDocumentation & Analysis
Behavior Preservation
Identical test suite runs against both implementations:
37/37 tests pass in both versions, proving refactoring preserves behavior.
Files
docs/11-application-development/11.2.5-refactoring-exercise.md- Main exercise documentationexamples/ch11/refactoring-exercise/starter/- Flawed implementation (14 files)examples/ch11/refactoring-exercise/solution/- Refactored implementation (32 files)examples/ch11/refactoring-exercise/analysis-guide.md- SOLID violation analysisexamples/ch11/refactoring-exercise/research-notes.md- OSS evaluation justificationNavigation updated in
docs/_sidebar.md.Original prompt
This section details on the original issue you should resolve
<issue_title>Task 4.0: Integrated Refactoring Exercise (11.2.5)</issue_title>
<issue_description># GitHub Issue: Task 4.0 - Integrated Refactoring Exercise (11.2.5)
🎯 Task Overview
Task ID: 4.0
Parent Spec:
docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.mdStatus: Ready for Implementation
Estimated Time: 8-12 hours
This task implements a comprehensive refactoring exercise (11.2.5) that synthesizes Repository Pattern, Service Layer, and Strategy Pattern. Students refactor a TypeScript e-commerce order processing system with intentional anti-patterns into clean, SOLID-compliant architecture.
Key Deliverables:
📋 Specification Context
Project Overview
This specification defines the remaining Design Patterns subsections for Chapter 11 (Application Development) of the DevOps Bootcamp. Task 4.0 is the capstone exercise that synthesizes learning from Data Layer Patterns (11.2.2), Business Logic Patterns (11.2.3), Classical GoF Patterns (11.2.4), and SOLID Principles (11.2.1).
User Story
US-5: Applying Multiple Patterns in Realistic Refactoring
As a bootcamp apprentice learning design patterns, I want to refactor a poorly-structured application using Repository, Service Layer, and Strategy patterns so that I can understand how patterns work together to solve real architectural problems.
US-5.1: Identifying Anti-Patterns
As a developer learning SOLID principles, I want guidance on identifying code smells and violations so that I can recognize similar issues in production codebases.
US-5.2: Preserving Behavior Through Refactoring
As a developer refactoring legacy code, I want comprehensive tests that validate behavior so that I can safely restructure code without breaking functionality.
Functional Requirements
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
docs/11-application-development/11.2.5-refactoring-exercise.mdexists with complete instructions including front-matter, 5-phase structure (Analysis/Planning/Implementation/Verification/Comparison), setup steps, success criteria, and reflection questionsexamples/ch11/refactoring-exercise/research-notes.mddocuments OSS project evaluation and justification for building custom applicationexamples/ch11/refactoring-exercise/starter/contains TypeScript application with package.json, tsconfig.json, jest.config.js, src/routes.ts (450-line God Obj...💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.