Questions tagged [domain-model]

A domain model is composed of the objects, behavior, relationships, and attributes that make up the industry that is the focus of development.

E.g. if you are in retail, you would model the "things" (classes) that are relevant, such as Sale, Product, and SalesTransaction. Read more here

359 questions
124
votes
10 answers

Rich vs Anemic Domain Model

I am deciding if I should use a Rich Domain Model over an Anemic Domain Model, and looking for good examples of the two. I have been building web applications using an Anemic Domain Model, backed by a Service --> Repository --> Storage layer system,…
Sam
  • 15,336
  • 25
  • 85
  • 148
83
votes
3 answers

Having Separate Domain Model and Persistence Model in DDD

I have been reading about domain driven design and how to implement it while using code first approach for generating a database. From what I've read and researched there are two opinions around this subject: Have 1 class that serves both as a…
Adrian Hristov
  • 1,957
  • 2
  • 16
  • 22
74
votes
1 answer

ORM Entities vs. Domain Entities under Entity Framework 6.0

I stumbled upon the following two articles First and Second in which the author states in summary that ORM Entities and Domain Entities shouldn't be mixed up. I face exactly this problem at the moment as I code with EF 6.0 using the Code First…
user2653422
  • 1,095
  • 1
  • 12
  • 18
69
votes
2 answers

Iterator versus Stream of Java 8

To take advantage of the wide range of query methods included in java.util.stream of Jdk 8 I am attempted to design domain models where getters of relationship with * multiplicity (with zero or more instances ) return a Stream, instead of an…
Miguel Gamboa
  • 8,855
  • 7
  • 47
  • 94
50
votes
2 answers

What exactly is the difference between a data mapper and a repository?

Well I've been trying to find out the difference between data mapper and repository, but up to now I still have not. It seems to me that the expert programmer said "Repository is another layer of abstraction over the mapping layer where query…
Lord Yggdrasill
  • 3,197
  • 4
  • 26
  • 42
47
votes
6 answers

Inheritance vs enum properties in the domain model

I had a discussion at work regarding "Inheritance in domain model is complicating developers life". I'm an OO programmer so I started to look for arguments that having inheritance in domain model will ease the developer life actually instead of…
42
votes
4 answers

What's the difference between Data Modelling and Domain Modelling?

By the way - with reference to data modelling I'm referring to logical or conceptual data models - not physical ones. The question came up during a discussion at work; naturally I leapt to Wikipedia to get some basic definitions in place - hoping…
Adrian K
  • 9,880
  • 3
  • 33
  • 59
37
votes
6 answers

What is Java domain model?

I am studying a Spring book and they mention Java domain model. What is that?
John
37
votes
5 answers

ASP.NET MVC Business Logic in Domain Model vs Service Layer

I have been reading about where to put business logic in ASP.NET MVC Project for a while and I still can't get clear on some things. 1 - Domain models. What are these really? In my Model folder I have only a bunch of classes corresponding to my…
29
votes
3 answers

what's the difference between service layer and domain model layer

for example, I have a user table, to be layer-ing, I create such POJOs: UserEntity.java UserDao.java UserBO.java (business object, domain model?) UserService.java (for service layer) what's the difference between UserBO.java and…
lovespring
  • 19,051
  • 42
  • 103
  • 153
20
votes
3 answers

Practical usage of the Unit Of Work & Repository patterns

I'm building an ORM, and try to find out what are the exact responsibilities of each pattern. Let's say I want to transfer money between two accounts, using the Unit Of Work to manage the updates in a single database transaction. Is the following…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
20
votes
5 answers

DDD: Entity identity before being persisted

In Domain Driven Design, one of the defining characteristic of an Entity is that it has an identity. Problem: I am not able to provide a unique identity to Entities on instance creation. This identity is only provided by the repository once the…
Dave New
  • 38,496
  • 59
  • 215
  • 394
18
votes
5 answers

Why the domain model should not be used as resources in REST API?

I came across a statement that the domain model designed in accordance with DDD should not be used as resources in a REST API (source). It is clear that a REST API is a contract of the application while the domain model is part of the…
Adam Siemion
  • 15,569
  • 7
  • 58
  • 92
15
votes
2 answers

Domain driven design: How to deal with complex models with a lot of data fields?

Well I am trying to apply domain driven design principles for my application, with a rich domain model that contains both data fields and business logic. I've read many DDD books, but it seems that their domain models(called entities) are very…
Lord Yggdrasill
  • 3,197
  • 4
  • 26
  • 42
12
votes
4 answers

Constructing an object graph from a flat DTO using visitor pattern

I've written myself a nice simple little domain model, with an object graph that looks like this: -- Customer -- Name : Name -- Account : CustomerAccount -- HomeAddress : PostalAddress -- InvoiceAddress : PostalAddress --…
MattDavey
  • 8,897
  • 3
  • 31
  • 54
1
2 3
23 24