avoid anemic domain models

An anemic domain model is one where all the domain logic is outside the model itself.

Quote

The basic symptom of an Anemic Domain Model is that at first blush it looks like the real thing. There are objects, many named after the nouns in the domain space, and these objects are connected with the rich relationships and structure that true domain models have. The catch comes when you look at the behavior, and you realize that there is hardly any behavior on these objects, making them little more than bags of getters and setters.

[1]

Instead, you should have the domain logic inside your models, while still being sure to keep implementation details out of the domain. domain interaction with other services should be through interfaces

Quote

In general, the more behavior you find in the services, the more likely you are to be robbing yourself of the benefits of a domain model.


  1. AnemicDomainModel (Martin Fowler) ↩︎