ADR-008: Flavor Architecture Modernization
Context
The framework’s flavor architecture used class attributes to define components, which prevented dependency injection, made testing difficult, and couldn’t leverage the new graph-based dependency resolution system.Decision
Migrated from class attribute-based component definition to constructor-based initialization for all flavor components, enabling proper dependency injection and improved testability.Key Changes
- Constructor-Based Flavor Definition: Components defined through constructor parameters
- Dependency Injection Integration: Components receive dependencies through constructors
- Base Class Separation: Dedicated base classes for controllers, services, repositories, and config
- Graph-Based Resolution: Full compatibility with automatic dependency resolution
Migration Pattern
Old Class Attribute Pattern:Consequences
Positive
- Proper dependency injection through constructors
- Improved testability with easy mocking
- Configuration injection into specific components
- Runtime flexibility for conditional components
- Type safety with constructor parameters
- Compatibility with graph-based dependency resolution
Negative
- Migration effort for existing flavors
- Slightly more verbose component definitions
- Learning curve for dependency injection concepts
- Breaking change from class attribute pattern