Domain-Driven Design (DDD) was a popular approach for designing complex software systems around 15-20 years ago, especially when building monoliths or web services. However, there are super valid arguments against using DDD, specially you work with microservice architecture and particularly when working with Spring Boot. Here are some points to consider:
1. Overhead and Complexity
Argument: DDD introduces additional layers of abstraction that can increase the complexity of your microservice.
Impact: For microservices, this overhead is not justified. Spring Boot is often used to build lightweight, fast-to-develop services, and DDD can slow down development by requiring rigorous modeling and design upfront. Useless work, because in a microservice the important think is the spefic business domain the microservice has to own and the different contracts it has upstream against consumers of REST API but also other downstream consumers if your service needs to implement event sourcing or your microservice has to be an important component in your company's message driven architecture.
A simpler CRUD-based approach might suffice for straightforward microservices, reducing development time and cognitive load. For more central microservice you maybe implement Event Sourcing.
2. Learning Curve
Argument: DDD requires a deep understanding of its concepts and how to implement them effectively and it is knowledge about how to design, with right semantics etc. not to code.
Impact: Teams unfamiliar with DDD may struggle to apply it correctly, leading to poorly designed systems or wasted time. Spring Boot developers might prefer more straightforward patterns that align with their existing knowlegde
3. Misalignment with Microservice Granularity
Argument: DDD emphasizes bounded contexts, which might not always align with the granularity of microservices.
Impact: The use of DDD can lead to microservices that are too fine-grained, increasing operational complexity without providing significant business value.
Focus on business capabilities rather than strict DDD boundaries when defining microservices.
4. Over-Engineering
Argument: DDD encourages rich domain models, which can lead to over-engineering.
Impact: Not all microservices require complex domain logic. For example, a service that primarily handles data storage or integration with third-party APIs might not benefit from a full DDD approach.
5. Performance Considerations
Argument: DDD's emphasis on aggregates and consistency boundaries can lead to inefficient data access patterns.
Impact: In a microservices architecture, fetching large aggregates or enforcing transactional consistency across services can hurt performance. Spring Boot's simplicity and focus on lightweight services might clash with DDD's heavier design.
6. Tooling and Frameworks
Argument: Spring Boot provides excellent support for building RESTful services and integrating with databases, but it doesn't enforce or align with DDD principles.
Impact: Developers might need to write additional boilerplate code or use third-party libraries to implement DDD patterns, which can slow down development.
Leverage Spring Boot's strengths without forcing DDD where it doesn't fit.
7. Iterative Development
Argument: DDD requires a deep understanding of the domain upfront, which can be challenging in agile environments where requirements evolve frequently.
Impact: In fast-paced projects, the time spent on domain modeling might delay delivery. Spring Boot's rapid development capabilities might be better suited to iterative, feedback-driven approaches.
8. Not All Domains Are Complex
Argument: DDD is most valuable in domains with complex business rules and logic.
Impact: For domains that are primarily data-driven or lack complex rules, DDD adds unnecessary complexity. Spring Boot's simplicity shines in these scenarios.
9. Distributed Systems Challenges
Argument: DDD doesn't inherently address the challenges of distributed systems, such as eventual consistency, service discovery, or fault tolerance.
Impact: In a microservices architecture, these concerns are critical, and DDD alone won't solve them. Spring Boot's ecosystem (e.g., Spring Cloud) provides tools to handle these challenges, but they might not align neatly with DDD.
10. Team Dynamics
Argument: DDD requires close collaboration between developers and domain experts.
Impact: If the team lacks access to domain experts or struggles with communication, DDD might not deliver its intended benefits. Spring Boot and microservice architecture allows teams to work more independently.
Conclusion
DDD was maybe a powerful tool for designing web services or complex monoliths, but it is totally unnecessary with microservices and Spring Boot.
More readings: 1. https://no-kill-switch.ghost.io/the-failed-promise-of-domain-driven-design-part-1/