Architecture Exercises
Architecture Exercises
Section titled “Architecture Exercises”Apply clean architecture principles and common design patterns through these exercises.
Exercises in This Section
Section titled “Exercises in This Section”| Exercise | Difficulty | Time | Description |
|---|---|---|---|
| Clean Layers | Easy | 20 min | Structure code with domain, application, and infrastructure layers |
| Repository Pattern | Medium | 25 min | Implement the repository pattern with interfaces |
| DI Container | Hard | 30 min | Build a simple dependency injection container |
Key Concepts Covered
Section titled “Key Concepts Covered”- Clean Architecture: Separating concerns into layers
- Dependency Rule: Inner layers don’t depend on outer layers
- Repository Pattern: Abstracting data access
- Dependency Injection: Providing dependencies from outside
- Interface Segregation: Small, focused interfaces
Prerequisites
Section titled “Prerequisites”Before starting these exercises, you should be comfortable with:
- Go interfaces
- Structs and methods
- Chapter 8: Clean Architecture in Go
- Chapter 9: Dependency Injection
- Start from the domain layer and work outward
- Define interfaces at the point of use, not implementation
- Keep your domain entities free of infrastructure concerns