Skip to main content

What is an "Anemic Domain Model"?

Suggest an edit

An Anemic Domain Model is an antipattern in which domain objects hold only data, but no behavior.

Signs:

  1. Entities are just sets of fields with getters and setters.
  2. All business logic is pushed into services or controllers.
  3. The Encapsulation principle is broken: data is "naked," and behavior is smeared around.

Example:

python
order.status = "paid" # instead of order.pay()

Problem: the code loses its connection to business meaning, rules get duplicated, and testing is hard. DDD solution: bring behavior back into the domain, so objects don't just describe data, but act as participants in the business process.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

Suggest an edit