Challenging the Single-Responsibility Principle
6 days ago
- #software architecture
- #reusability
- #SOLID principles
- The single-responsibility principle (SRP) is often misused, leading to overly fragmented systems.
- A helpful mantra for code placement: 'minimize code and maximize use cases' to promote reusability.
- Siedersleben's blood group law categorizes components into groups for better reusability and maintainability.
- Group 0: Generic components (e.g., Lodash, Luxon) can be used by any other group without reducing reusability.
- Group T: Technical components (e.g., knex, passport) are good candidates for open-sourcing.
- Group A: Domain components should be scanned to move reusable logic to Group 0 or T.
- Group AT: Anti-pattern where a technical component depends on a domain component—must be avoided.