Why is anemic model bad?

Why is anemic model bad?

Why is Anemic Domain Model harmful? One could say that the Anemic Domain Model is not going along with Object-Oriented Design. The separation of logic into other class is just not correct in OOD approach. Having a pure OOD is not the goal in and of itself.

What is anemic domain model?

Anemic domain model is the use of a software domain model where the domain objects contain little or no business logic (validations, calculations, business rules etc.).

Is anemic domain model bad?

In a truly object-oriented design in fact, you should have nothing but behavior — the data is private and can only be accessed via methods. In fact, in OOD, not having enough behavior around a data type is considered a Bad Thing, and even has a name: the “anemic domain model”.

Which is anemic model or rich domain model?

A rich domain model applies OO principles like encapsulation, information hiding and bringing data and logic together and therefore a anemic model is an anti pattern from an OO perspective. For a deeper insight take a look at my blog https://www.link-intersystems.com/blog/2011/10/01/anemic-vs-rich-domain-models/

What does rich domain model mean in CRUD?

Rich domain model = a collection of objects that expose behavior. If you want to create a simple CRUD application, maybe an anemic model with a classic MVC framework is enough. But if you want to implement some kind of logic, anemic model means that you will not do object oriented programming.

What makes an anemic model an anti pattern?

In an anemic model the data models can not guarantee that they are in a legal state while in a rich domain model they can. A rich domain model applies OO principles like encapsulation, information hiding and bringing data and logic together and therefore a anemic model is an anti pattern from an OO perspective.

What’s the difference between rich domain and service model?

With the Rich Domain Model: The service layer is thin and used only for third party services. In other words, if you need to send data via REST, RPC or even to send emails, using services is the way to go. Otherwise, the logic goes most of the time in the domain objects.