Questions tagged [anemic-domain-model]

A domain model is "anemic" if it has little or no behavior. A model that only contains things, parties and places with no activities, is considered anemic. For example, a model that has only a 'Car' and a 'Car Dealership' is anemic because there is no activity (behavior) in the model that joins the two. For example, a 'CarSale' or 'CarService' activity represents behavior that joins the two and makes the model useful. Contrast with an "anemic object".

Having a domain layer that is only getters and setters for data values to/from the database is not a good OO design. Read more here

66 questions
2
votes
2 answers

Anemic Model vs DTO vs Active Records

It's not very clear to me how a class should be designed: Anemic Model Domain states: The fundamental horror of this anti-pattern is that it's so contrary to the basic idea of object-oriented designing; which is to combine data and process…
2
votes
3 answers

Resolving Anemic Domain Model example

I am reviewing areas where I can optimize the design for my mortgage calculation tool, mostly for learning purposes. After reading about Anemic Domain Models, I became interested in creating Rich Models, and noticed that my current implementation…
jexx2345
  • 678
  • 2
  • 8
  • 15
2
votes
2 answers

Why is entity bean considered as anemic?

I read several articles informing that entity beans in a Java EE environment are considered as anemic (means only containing getters and setters without implementing behaviour). What prevents me to put behaviour into entity beans ? So that session…
Mik378
  • 21,881
  • 15
  • 82
  • 180
1
vote
1 answer

Stateless service-centric approach vs stateful rich models

Say I have set of items defined. Those items have to be grouped into different sets. E.g Items can be like public Item { public int id; public String name; } and sets have their own settings like which items belong to this set, what is…
grafthez
  • 3,921
  • 4
  • 28
  • 42
1
vote
3 answers

anemic domain model and domain services

If domain entities aren't anemic, so they embed specific-usage behavior inside themselfes, is there a need/point to use/build specific domain services? How about validation should it go inside an entity? What way is more flexible for unit…
lexeme
  • 2,915
  • 10
  • 60
  • 125
1
vote
3 answers

how to avoid anemic domain model?

I'm trying to learn Domain Driven Design by example and I need your advice. Let's say I have an entity called Tender. I receive a Soap Message from outer service; the message has all the information about tender(tenderId, tenderSum, ...) What I…
mik
  • 1,575
  • 6
  • 22
  • 33
1
vote
1 answer

JPA/Hibernate: Sub-typing vs. strategy 'pattern'

The following is a JPA annotated type hierarchy, in which all data fields (and associated getters and setters) are members of the supertype along with abstract methods for implementing business logic. There are any number of subtypes which implement…
1
vote
0 answers

Architecture downside of putting service reference inside domain model? (java)

The topic is refering to the solution bellow and wonder what drawbacks it has in a generic context and also in a particular context. Questions to be answered: What kind of architecture should be picked for this kind of problem/application in java…
1
vote
2 answers

DDD vs Anemic Domain Model

Could you please tell me what is the difference between the model Anemic Domain Model and the DDD? what is the most used nowadays ? which model is relevent when using an application the spring framework (spring data ...)?
Yassine Bsf
  • 99
  • 1
  • 9
1
vote
0 answers

Entity Framework - Persistence Model different from Domain Model

I have following lagacy code. There is a seperation between Pesistence Model and the (anemic) Domain Model. What is the benefit of this seperation and the implicit conversion ? Do you see any drawbacks ? I know that with implicit conversion…
1
vote
1 answer

Application Architecture - User.CreatePost(Post) or PostsService.CreatePost(Post, User)?

Basically, my app will work just like stackoverflow, where you login and post something, other people come and interact. Thinking on DDD terms, and trying to avoid an anemic model, i'm now faced with this decision: Should my User entity holds the…
Leonardo
  • 10,737
  • 10
  • 62
  • 155
1
vote
1 answer

Pros and Cons of Anemic Domain Model

What are pros and cons of Anemic Domain Model in your experience? Despite what wiki says. Update: I'm after answers that are based on experiences of this pattern applied in large scale enterprise applications!
1
vote
2 answers

DDD - injecting Factories in aggregate root Entity constructor

I'm writing an app with DDD in mind and trying to avoid having an anemic domain model by delegating doman logic and behaviour to entities. There's an issue I'm running into with constructing entities that are aggregate roots and need to create…
1
vote
3 answers

Full Anemia - Where can I move this data out of my Model?

I was given a few dozen legacy SQL statements that are each hundred(s) of lines long. Each SQL is mapped to code with its own unique POCO in a shared Models project. For example, the SQL Select Name, Birthday From People has an equivilent POCO in…
Suamere
  • 5,691
  • 2
  • 44
  • 58
1
vote
1 answer

difference between anemic domain model and active record

based on this answer, I found that the same idea behind the anemic domain model is in active record! in active record pattern database fields are the same as domain properties (correct me if I'm wrong), so based on the answer I previously mentioned…
Ehsan
  • 816
  • 9
  • 27