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
1
vote
2 answers

Rich domain model. Anti anemic domain model

A lot of discussions, like this and this, go with RICH DOMAIN MODEL and there are 2 strong reason about amenic, like 1 and 3: Now let's say that I need to make sure that I need to validate that the product exists in inventory and throw exception…
1
vote
1 answer

Can I use a rich domain model with WCF?

Is it possible to use DDD and a rich domain model if your application is like: windows client (WPF) windows service And communication happens with WCF? I'm used to have DTO's with only data state, and have business rules inside the Service layer,…
1
vote
2 answers

RDM vs ADM (yet again) or where is there a middle ground?

After spending endless hours on the web (and in books) trying to come to a conclusion about this subject, looking through many people's point of views, and different aspects trying to weight pros and cons, I have decided to post some key questions…
1
vote
1 answer

What are the criteria for labeling a domain model as anemic?

So far, I have not come across a blog post or an article which describes the objective criteria for tagging a domain model as anemic. I think, it would definitely help to set objective criteria for anemic domain models. Few years back, I designed a…
Anand Patel
  • 6,031
  • 11
  • 48
  • 67
1
vote
2 answers

Is this "anemic" model acceptable design?

I first want to say that I am not trying to accomplish a domain model in my current design. That being said, I currently am building an architecture that looks like the following: UI DTO <=> Service DTO <=> Business/Database DTO (using…
Justin Pihony
  • 66,056
  • 18
  • 147
  • 180
1
vote
1 answer

What is anemia in domain model?

From what I can grasp from Martin Fowler, anemia means to separate business logic from domain objects, which are reduced to trivial getters and setters, while the domain behavior is moved to service layer. Do I miss something? How can we call some…
Jan Turoň
  • 31,451
  • 23
  • 125
  • 169
1
vote
1 answer

Is valid to use EntityRepository inside another one?

For example, consider front page as in Jobeet tutorial: class CategoriesRepository extends EntityRepository { public function getWithJobs($limit) { $categories = $this->getContainingJobs(); $jobsRepo =…
keram
  • 2,321
  • 4
  • 24
  • 29
0
votes
1 answer

Anaemic data model ( ADM Vs RDM)

I'm trying to understand the differences between the ADM and RDM. The way I see it is the adM and RDM discussion all comes down to where you actually determine your workflow ( collaboration of objects). The RDM injects the data repository object and…
caa
  • 406
  • 1
  • 8
  • 16
0
votes
1 answer

Scala, Spring and ActiveRecord with decoupled persistence

I've been doing some reading lately and one thing that I've come across was this article about the Anaemic Domain Model from Martin Fowler. I know, it's old, but somehow very actual in Java world. So I'm trying to move towards a more domain-driven…
Cristian Vrabie
  • 3,972
  • 5
  • 30
  • 49
0
votes
2 answers

Persistence and Domain layers separation within a Rich Domain Model application

There is a concept that talks about the separation of the persistent layer from the domain layer to make the domain layer more robust - it would not be dependent on the actual implementation of the repository in persistence layer, but only on the…
0
votes
1 answer

Adding business logic to JPA entities

Having the next scenario, where I have to apply some static filters with JPA specifications(add WHERE clauses) to a JPA entity to get a list of dogs filtered for example, I receive an id from an entity and I have to apply the same filters but send…
fernando1979
  • 1,727
  • 2
  • 20
  • 26
0
votes
1 answer

Is this considered as procedural programming (or anemic pattern)?

Let's say there are two classes, one is the user class, which contains the user information; the other one is the payment transaction class. The scenario is simple, if the user's age is > 65, create type A payment transaction; otherwise, create type…
0
votes
2 answers

Should I populate member variables with data from a database in the constructor

I am constructing an object using data from a database table by passing the primary key of the row of data I want to use to construct the object. Should the population of the member varibles of this object take place in the constructor or another…
rogermushroom
  • 5,486
  • 4
  • 42
  • 68
0
votes
3 answers

ObjectContext aware entity in EF to avoid Anemic Domain Model

In Entity Framework, is it possible to make the framework inject the DbContext into each object (entity) that is attached to or retrieved from the Context? I'm an NHibernate guy and I know it is possible in NH, -- sorry if it is a stupid question in…
0
votes
1 answer

How to make the best of an Anemic Domain Model given no other choice

So I started my 2nd developer job after spending 10 years at my first company and not really feeling I earned the title of a senior developer. It was java development but we were working with an anemic domain model and the application in my opinion…