-
Notifications
You must be signed in to change notification settings - Fork 51
Add Data Layer Patterns documentation and Go examples (11.2.2) #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…Record, Optimistic/Pessimistic Locking) Co-authored-by: jburns24 <19497855+jburns24@users.noreply.github.com>
… examples Co-authored-by: jburns24 <19497855+jburns24@users.noreply.github.com>
|
Create a starter project for Exercise 1 in the Data Layer Patterns documentation that demonstrates the anti-pattern of direct data access scattered throughout the codebase. This will serve as the "before" state that participants need to refactor. Requirements
Key Principles
Todo List
|
- Create starter project with anti-patterns (direct SQL in handlers, no abstraction) - Demonstrate tightly coupled code with duplicated queries - Mix business logic with data access throughout handlers - Update exercise instructions to use leading questions instead of step-by-step solution - Remove specific implementation steps to encourage critical thinking Co-authored-by: jburns24 <19497855+jburns24@users.noreply.github.com>
Created the exercise starter project in commit c17623e. Starter Project (
Updated Exercise Instructions:
The starter code demonstrates realistic legacy code patterns that students will need to identify and refactor on their own. |
Implements comprehensive documentation for Data Layer Patterns (Repository, Active Record, Optimistic/Pessimistic Locking) with working Go examples, interactive quiz, and hands-on refactoring exercise as specified in Task 1.0.
Documentation (
docs/11-application-development/11.2.2-data-layer-patterns.md)Go Examples (
examples/ch11/data-patterns/)Five self-contained examples with comprehensive tests (all passing):
Repository Pattern (
repository/):Active Record Pattern (
active-record/):Optimistic Locking (
concurrency/optimistic/):Pessimistic Locking (
concurrency/pessimistic/):Exercise Starter (
repository-exercise-starter/):Refactoring Exercise
Exercise Starter Project (
examples/ch11/data-patterns/repository-exercise-starter/):Exercise Instructions (in documentation):
Quiz (
src/quizzes/chapter-11/11.2.2/)12 questions covering pattern recognition, concurrency scenarios, and decision-making trade-offs using quizdown format.
Configuration Updates
docs/_sidebar.md.markdownlint.jsonto support<quizdown>elements and table stylesdocs/README.mdOriginal prompt
This section details on the original issue you should resolve
<issue_title>Task 1.0: Data Layer Patterns Documentation and Examples (11.2.2)</issue_title>
<issue_description># GitHub Issue: Task 1.0 - Data Layer Patterns Documentation and Examples (11.2.2)
🎯 Task Overview
Task ID: 1.0
Parent Spec:
docs/specs/01-spec-design-patterns-section/01-spec-design-patterns-section.mdStatus: Ready for Implementation
Estimated Time: 2-3 hours
This task implements comprehensive documentation for Data Layer Patterns (11.2.2), including Repository, Active Record, and Concurrency patterns (Optimistic/Pessimistic Locking) with working Go 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. Building on the completed SOLID Principles foundation (11.2.1), this spec focuses on architectural patterns (data layer and business logic) and classical Gang of Four patterns that students will encounter in production applications.
User Story
US-1: Understanding Data Layer Patterns
As a bootcamp apprentice learning production development, I want to understand Repository and Active Record patterns so that I can structure data access logic in enterprise applications.
US-2: Managing Concurrent Data Access
As a developer building multi-user applications, I want to understand Optimistic and Pessimistic Locking patterns so that I can handle concurrent data modifications safely.
Functional Requirements
✅ Acceptance Criteria (Proof Artifacts)
The following artifacts must exist and be verified for task completion:
docs/11-application-development/11.2.2-data-layer-patterns.mdexists with complete content including front-matter, pattern explanations, decision guidance, and exercisesexamples/ch11/data-patterns/repository/contains working Go implementation with README, tests, and clear interface abstractionexamples/ch11/data-patterns/active-record/contains working Go implementation with README demonstrating domain objects with encapsulated data accessexamples/ch11/data-patterns/concurrency/optimistic/contains SQLite-based demonstration with README showing version-based conflict detectionexamples/ch11/data-patterns/concurrency/pessimistic/contains SQLite-based demonstration with README showing exclusive access controlsrc/quizzes/chapter-11/11.2.2/data-layer-patterns-quiz.jsexists with pattern recognition questions following quizdown formatgo test ./...passes in all example directoriesnpm start📝 Sub-tasks
Documentation Tasks
docs/11-application-development/11.2.2-data-layer-patterns.mdwith front-matter (category: Application Development, technologies: Go/SQLite/Design Patterns, estReadingMinutes: 45, exercise definition)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.