Domain-Driven Design (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is an Anemic Domain Model and why is it considered an Anti-Pattern?
junior Leveldomain-driven-designBasic
In Simple Words:
An anemic model is where domain classes are just dumb property bags with public getters and setters (get/set), containing zero business logic:
- All validation, calculations, and invariants are pushed into bloated procedural service classes (
OrderService). - Why It Fails: Invariants cannot be guaranteed because any developer can call
order.setStatus("COMPLETED")without executing required payment checks or firing events! - Tactical DDD replaces anemic models with Rich Domain Models that encapsulate their own rules.