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: 2.0 Parent Spec:docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.md Depends On: Task 1.0 (conceptually independent, but sequential for consistency) Status: Ready for Implementation Estimated Time: 1-2 hours
This task implements comprehensive documentation for Business Logic Patterns (11.2.3), including Transaction Script, Domain Model, and Service Layer patterns with working TypeScript examples 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 focuses on patterns for organizing business logic, helping students understand trade-offs between simplicity and complexity management.
User Story
US-3: Organizing Business Logic
As a developer facing design decisions, I want to understand when to use Transaction Script versus Domain Model patterns so that I can choose the appropriate approach for my application's complexity.
Functional Requirements
ID
Requirement
U3-FR1
The system shall explain Transaction Script Pattern with examples showing procedural organization of business logic
U3-FR2
The system shall explain Domain Model Pattern with examples showing object-oriented encapsulation of business rules
U3-FR3
The system shall provide comparative examples solving the same business problem with both Transaction Script and Domain Model approaches
U3-FR4
The system shall include decision guidance on pattern selection based on domain complexity, team experience, and maintenance expectations
U3-FR5
The system shall demonstrate Service Layer pattern for orchestrating domain objects and transaction boundaries
U3-FR6
The system shall include anti-patterns showing business logic scattered across layers
U3-FR7
The system shall provide a self-directed exercise for students to implement business logic using the pattern appropriate for given complexity
U3-FR8
The system shall include an interactive quiz testing conceptual understanding and decision-making for business logic patterns
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
Documentation:docs/11-application-development/11.2.3-business-logic-patterns.md exists with complete content including front-matter, pattern explanations, comparative analysis, and exercises
Transaction Script:examples/ch11/business-patterns/transaction-script/ contains working TypeScript implementation with README showing procedural organization
Domain Model:examples/ch11/business-patterns/domain-model/ contains working TypeScript implementation with README showing OOP encapsulation
Comparative Example:examples/ch11/business-patterns/comparison/ contains same business problem solved with both patterns, with README explaining trade-offs
Service Layer:examples/ch11/business-patterns/service-layer/ contains working TypeScript implementation with README demonstrating orchestration
Quiz:src/quizzes/chapter-11/11.2.3/business-logic-patterns-quiz.js exists with decision-making questions following quizdown format
CLI Verification:npm test passes in all example directories
Integration Verification: Quiz renders correctly in Docsify when served with npm start
2.2 Write Transaction Script Pattern section explaining procedural organization of business logic, benefits (simplicity, directness), and when to use it (simple domains)
2.3 Write Domain Model Pattern section explaining object-oriented encapsulation of business rules, benefits (rich behavior, maintainability), and when to use it (complex domains)
2.4 Write Service Layer Pattern section explaining orchestration of domain objects, transaction boundaries, and API exposure patterns
2.5 Write comparative analysis section contrasting Transaction Script vs Domain Model with decision criteria based on complexity, team experience, and maintenance expectations
2.6 Write anti-patterns section showing business logic scattered across layers (controllers, views, data access)
2.7 Add self-directed exercise description for implementing business logic using pattern appropriate for given complexity level
Code Example Tasks
2.8 Create Transaction Script TypeScript example in examples/ch11/business-patterns/transaction-script/ with package.json, tsconfig.json, src/order-processing.ts (procedural functions), src/main.ts, README.md, and tests
2.9 Create Domain Model TypeScript example in examples/ch11/business-patterns/domain-model/ with package.json, tsconfig.json, src/order.ts, src/customer.ts (rich domain objects), src/main.ts, README.md, and tests
2.10 Create comparative example in examples/ch11/business-patterns/comparison/ showing same business problem (e.g., order discounting) solved with both Transaction Script and Domain Model approaches, with detailed README comparing trade-offs
2.11 Create Service Layer TypeScript example in examples/ch11/business-patterns/service-layer/ with package.json, tsconfig.json, src/services/order-service.ts (orchestration), src/domain/ (domain objects), src/main.ts, README.md, and tests
Quiz and Verification Tasks
2.12 Create interactive quiz src/quizzes/chapter-11/11.2.3/business-logic-patterns-quiz.js with 6-8 questions covering pattern selection decisions, recognizing patterns in code, and understanding trade-offs
2.13 Verify all TypeScript examples run successfully with npm run start and tests pass with npm test
2.14 Embed quiz in documentation using Docsify quiz syntax and verify it renders correctly with npm start
📁 Relevant Files
Files to Create
docs/11-application-development/11.2.3-business-logic-patterns.md - Main documentation
🎯 Task Overview
Task ID: 2.0
Parent Spec:
docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.mdDepends On: Task 1.0 (conceptually independent, but sequential for consistency)
Status: Ready for Implementation
Estimated Time: 1-2 hours
This task implements comprehensive documentation for Business Logic Patterns (11.2.3), including Transaction Script, Domain Model, and Service Layer patterns with working TypeScript examples 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 focuses on patterns for organizing business logic, helping students understand trade-offs between simplicity and complexity management.
User Story
US-3: Organizing Business Logic
As a developer facing design decisions, I want to understand when to use Transaction Script versus Domain Model patterns so that I can choose the appropriate approach for my application's complexity.
Functional Requirements
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
docs/11-application-development/11.2.3-business-logic-patterns.mdexists with complete content including front-matter, pattern explanations, comparative analysis, and exercisesexamples/ch11/business-patterns/transaction-script/contains working TypeScript implementation with README showing procedural organizationexamples/ch11/business-patterns/domain-model/contains working TypeScript implementation with README showing OOP encapsulationexamples/ch11/business-patterns/comparison/contains same business problem solved with both patterns, with README explaining trade-offsexamples/ch11/business-patterns/service-layer/contains working TypeScript implementation with README demonstrating orchestrationsrc/quizzes/chapter-11/11.2.3/business-logic-patterns-quiz.jsexists with decision-making questions following quizdown formatnpm testpasses in all example directoriesnpm start📝 Sub-tasks
Documentation Tasks
docs/11-application-development/11.2.3-business-logic-patterns.mdwith front-matter (category: Application Development, technologies: TypeScript/Design Patterns, estReadingMinutes: 30, exercise definition)Code Example Tasks
examples/ch11/business-patterns/transaction-script/with package.json, tsconfig.json, src/order-processing.ts (procedural functions), src/main.ts, README.md, and testsexamples/ch11/business-patterns/domain-model/with package.json, tsconfig.json, src/order.ts, src/customer.ts (rich domain objects), src/main.ts, README.md, and testsexamples/ch11/business-patterns/comparison/showing same business problem (e.g., order discounting) solved with both Transaction Script and Domain Model approaches, with detailed README comparing trade-offsexamples/ch11/business-patterns/service-layer/with package.json, tsconfig.json, src/services/order-service.ts (orchestration), src/domain/ (domain objects), src/main.ts, README.md, and testsQuiz and Verification Tasks
src/quizzes/chapter-11/11.2.3/business-logic-patterns-quiz.jswith 6-8 questions covering pattern selection decisions, recognizing patterns in code, and understanding trade-offsnpm run startand tests pass withnpm testnpm start📁 Relevant Files
Files to Create
docs/11-application-development/11.2.3-business-logic-patterns.md- Main documentationsrc/quizzes/chapter-11/11.2.3/business-logic-patterns-quiz.js- Interactive quizexamples/ch11/business-patterns/transaction-script/package.json- Dependenciesexamples/ch11/business-patterns/transaction-script/tsconfig.json- TypeScript configexamples/ch11/business-patterns/transaction-script/src/order-processing.ts- Procedural business logicexamples/ch11/business-patterns/transaction-script/src/main.ts- Executable demoexamples/ch11/business-patterns/transaction-script/tests/order-processing.test.ts- Unit testsexamples/ch11/business-patterns/transaction-script/README.md- Setup and explanationexamples/ch11/business-patterns/domain-model/package.json- Dependenciesexamples/ch11/business-patterns/domain-model/tsconfig.json- TypeScript configexamples/ch11/business-patterns/domain-model/src/order.ts- Rich domain objectexamples/ch11/business-patterns/domain-model/src/customer.ts- Domain objectexamples/ch11/business-patterns/domain-model/src/main.ts- Executable demoexamples/ch11/business-patterns/domain-model/tests/order.test.ts- Unit testsexamples/ch11/business-patterns/domain-model/README.md- Setup and explanationexamples/ch11/business-patterns/comparison/package.json- Dependenciesexamples/ch11/business-patterns/comparison/tsconfig.json- TypeScript configexamples/ch11/business-patterns/comparison/src/transaction-script/- Transaction Script solutionexamples/ch11/business-patterns/comparison/src/domain-model/- Domain Model solutionexamples/ch11/business-patterns/comparison/src/main.ts- Side-by-side demoexamples/ch11/business-patterns/comparison/tests/- Tests for both approachesexamples/ch11/business-patterns/comparison/README.md- Detailed comparisonexamples/ch11/business-patterns/service-layer/package.json- Dependenciesexamples/ch11/business-patterns/service-layer/tsconfig.json- TypeScript configexamples/ch11/business-patterns/service-layer/src/services/order-service.ts- Service orchestrationexamples/ch11/business-patterns/service-layer/src/domain/- Domain objectsexamples/ch11/business-patterns/service-layer/src/main.ts- Executable demoexamples/ch11/business-patterns/service-layer/tests/order-service.test.ts- Unit testsexamples/ch11/business-patterns/service-layer/README.md- Setup and explanationFiles to Reference
docs/11-application-development/11.1-layers.md- Layered architecture foundationdocs/11-application-development/11.2.1-solid-principles.md- SOLID principles for cross-referencesdocs/11-application-development/11.2.2-data-layer-patterns.md- Data layer patterns (will be completed in Task 1.0)src/quizzes/chapter-11/11.2.1/solid-principles-quiz.js- Example quiz format to follow🎓 Repository Standards
Code Example Standards
src/,tests/,README.md,package.json,tsconfig.jsonnpm testDocumentation Standards
TypeScript,Design Patternsas technology tags##) for navigation-visible sections, H3 (###) as default within sections<img>tags, place indocs/11-application-development/img11/if neededQuiz 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
Business Domain Suggestions
For the comparative example, consider using:
Choose a domain that's simple enough to understand quickly but complex enough to show the difference between procedural and OOP approaches.
Quality Checklist
npm testDependencies
Success Criteria
This task is complete when:
npm testpasses in all example directoriesnpm startsuccessfully renders documentation with embedded quiz