Takeaways
- KISS: Avoid overengineering or overoptimization
- MAGIC to protect your developers
- Enemy data in your DTO: Keep them out
- Extract it when it grows: SRP or DRY
- THE ONION, DIP: Domain agnostic to externals
- TESTS : Let them smash your design.
Core Principles
- Passes the tests
- Reveals intent
- No duplication
- Fewest elements
Modelling data
- Value object - small, immutable data
- Data Transfer Objects - No methods!
- Expose enttities in API
Organizing Logic
- Extract mappers
- Facade: Domain services, Domain objects