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.
339 questions
1
vote
2
answers
147
views
DDD Model to handle Localizations
I'm trying to refine my domain model for the internationalization feature, I wanted to get your input on the best approach to structuring Culture and Localization entities following Domain-Driven ...
1
vote
1
answer
102
views
Is providing a method of a domain entity with a data/ service provider object a bad design?
I have an entity called User, and it has a method to change the user's email address. I'm using a strongly typed object for representing the email address.
public class User: BaseEntity
{
// Some ...
1
vote
1
answer
62
views
Enforcing reasonable values when modeling one's domain
Should one enforce reasonable values when modeling one's domain?
Here's an example:
Assume that we have a scheduling application that schedules visits for people who require assistance and normally ...
0
votes
4
answers
363
views
Should I model constraints which are valid, but which have no current function in the domain?
When domain modelling, should a valid constraint - or "natural" constraint - be modelled, even if there are no current business processes which rely on the constraint being asserted.
As an ...
-2
votes
2
answers
335
views
Enumeration in every entity?
According to Eric's definition of entities: "An object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identity"
Does that mean apart from all ...
0
votes
1
answer
124
views
Functional interfaces or decorator-like implementations [closed]
Consider Chess as an example. Say, we have a lot of domain objects that are alike, in this case chess pieces. I have two proposes to implementing the behaviour of chess pieces. Both uses the following ...
1
vote
2
answers
523
views
How to design an entity that has different fields depending on a type?
I have a specific domain entity that has a given type and some attributes. Based on the type, it can have another set of type-depending attributes. Normally, I would create a class for each type and ...
2
votes
3
answers
278
views
Is it necessary or "class obsession" (opposite to primitive obsession) to create classes for non-business fields?
I know there are some posts talk about primitive obsession : When is primitive obsession not a code smell?, Is "avoid the yo-yo problem" a valid reason to allow the "primitive obsession&...
2
votes
1
answer
546
views
Domain models: Can they be an abstract class
When talking about having a rich domain model successfully, in real applications, it needs to, somehow, access some abstraction of complex functionality (instead of being a row state calculator the ...
1
vote
1
answer
583
views
Does calling an external API a part of transactional boundary
I have the following requirements :
A player in an FPS Shooter game has health points, where he can take damage and regain health.
One of the ways to regain health is by using a Health Booster that ...
7
votes
5
answers
2k
views
Do software engineers use UML diagrams of object models, domain models, system sequence diagrams and operation contracts?
Do software developers actually use UML diagrams, and more specifically object models, domain models, system sequence diagrams and operation contracts? I am taking a computer science degrees, and we'...
0
votes
1
answer
399
views
Domain Modeling / Architecture
I'm experimenting with some projects at the moment and I am stuck trying to decide on the correct approach to this question.
Given a simple architecture like this consisting of
Domain - (Person and ...
1
vote
2
answers
959
views
DDD for team composition
I have been asked by the BA/PM community in my company how DDD/domain modelling can be used as a tool when deciding how to form, split teams and how to decide their missions.
I have my own thoughts on ...
2
votes
4
answers
2k
views
Why are async/await allowed inside the domain model of DDD?
I am trying to challenge my understanding of DDD by pushing it to the extreme.
My question is not about a specific practical use case.
Rather my question is an abstract one related to DDD in general.
...
2
votes
1
answer
540
views
Internal/external commands in CQRS
I have several questions related to CQRS in eventually consistent systems with a need of resilient Command/Event processing.
Is it OK to have external/public synchronous Commands (triggered by API, e....
0
votes
1
answer
1k
views
Handling asynchronous domain events with multiple handlers & allowing them to fail independently
We're building a service using DDD, CQRS, & Hexagonal Architecture that allows the user to upload a CSV feed for which every row will be transformed and sent to a third party over HTTP.
We have ...
-1
votes
1
answer
361
views
Do usecase-class work with domain-model or data-model at cleanarchitecture?
I interessted in the "usecases" and "how they interacts with the "context" at "clean architecture".
If I understand right, there will be two contexts.
First is the ...
1
vote
2
answers
399
views
DDD rich domain model - dynamic dependencies - EAA
class Product...
public static Product newWordProcessor(String name) {
return new Product(name, new CompleteRecognitionStrategy());
}
Martin Fowler presents this code in his book "Patterns of ...
1
vote
0
answers
126
views
Allowing an invalid state before an entity creation process is completed?
A lot of sites will save the progress of the creation of an entity or some process. For example, stackoverflow will allow you to draft a question before you post it. If StackOverflow used DDD, I would ...
1
vote
2
answers
1k
views
Software design patterns for versioning of domain entities/logic
I'm looking for specific software design patterns that can help me understand how versioning of the same entity where the domain logic has changed between the versions, can be solved. The following ...
0
votes
1
answer
230
views
DDD: Where to put safety checks? Where to put the check if the user is allowed to do this?
I have a pretty simple domain model. Basically users, companies and groups. A user can add members to a group and remove them. But the user can only do that for his own company.
Where do I put the ...
-1
votes
1
answer
275
views
Model Driven Engineering vs. User Centered Design
I try to understand the difference between software development approaches like MDE, and design processes like UCD:
UCD is a framework of iterative processes. The end-user is the center of the ...
1
vote
0
answers
45
views
Separating Typeorm Entities from Domain Entities [duplicate]
Is it a bad approach to add domain logic inside typeorm entities if following the domain model pattern to organize business logic.
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm&...
-1
votes
2
answers
351
views
More efficient FIFO inventory calculation?
I am implementing a basic ledger system for which I want to calculate costs based on the FIFO system. Is there a more clever method than an O(n) search?
Example
Suppose I have two lists of ...
0
votes
0
answers
264
views
Domain-driven Design: Aggregate root property is a collection of other independent aggregate roots
In my domain model I've got two principal entities: User and Event, both which I've decided to make aggregate roots. Users and Events have a one-to-many relationship wherein Users can create several ...
0
votes
0
answers
302
views
How to handle presentation/UI rules in DDD context?
I'm wondering how a rule tailored for a specific UI is handled in a context of DDD and hexagonal/onion architecture?
For example, if you have a screen for an inventory app where you can create product ...
31
votes
9
answers
8k
views
Is extracting an interface just for testing purposes a code smell?
I will explain with an hypothetical example.
Suppose that my domain is Cars. Everyone around the software, talks about cars. Car is the aggregate root of aggregate roots. For example, CAR table has ...
1
vote
2
answers
295
views
Is it a mistake to distribute shopper data across microservices rather than have its own microservice?
I'm studying DDD and trying to plan how we'll migrate from our monolith to a microservice architecture. At the moment I'm trying to work through two possibilities
The first is where the shopper is an ...
1
vote
1
answer
484
views
DDD access to a composite Aggregate across Boundary Contexts
The behavior of my systems is as follows
user places an order for a product
1a. order management creates a placeholder record for the order
1b. forwards the order to an external vendor.
external ...
50
votes
7
answers
10k
views
Why is inheritance bad in a Person-Student model?
I've just started learning about Inheritance vs Composition and it's kind of tricky for me to get my head around it for some reason.
I have these classes:
Person
class Person
{
public string Name {...
0
votes
0
answers
577
views
Drawing a sequence diagram for a "View posts in a section" use case
As title says, I'm currently working on an alaysis model for a little website similar to Reddit for academic purposes.
I have one use cases written like this (They're not in English so they may not ...
0
votes
2
answers
680
views
Explicit Modeling Aggregate Root to avoid State Pattern
In the book Patterns, Principles, and Practices of Domain-Driven Design, chapter 16, entities, Avoid the State Pattern; Use Explicit Modeling has brought the great idea of domain modeling to my life.
...
0
votes
0
answers
182
views
Splitting nested entities keeping invariant within aggregates
I'm currently developing message imap-based module in crm app and i'm trying to connect dots using ddd principals.
I've started with three main entities, all bound under Account Aggregate:
Account - ...
1
vote
2
answers
763
views
C# WPF - Is it acceptable to have a dependency to PresentationCore.dll in domain layer?
We are working on a .NET desktop application written in C# and WPF, that communicates with a REST API server.
The software has a layered design and consists of multiple projects.
One project for the ...
1
vote
1
answer
327
views
What to improve/change and how to move forward with my Event Storming session?
I'm doing alone session with Event Storming for my application that I plan to build with DDD approach later on. Event Storming session is for learning purposes.
My application domain logic is rather ...
6
votes
1
answer
436
views
Should operations on properties of list objects be encapsulated in a domain class that wraps the list?
I have a list of product price objects, List<ProductPrice>.
@Value
public class ProductPrice {
Long id;
LocalDate startDate;
LocalDate endDate;
BigDecimal value;
}
From ...
3
votes
4
answers
744
views
Do I have LocalDTOs? If yes, what is a good approach to keep encapsulation of the domain model?
LocalDTO term refers to Fowler's article.
Say I have a domain entity Person:
public class Person {
private String id;
private String name;
private int age;
}
This entity has its own ...
4
votes
4
answers
168
views
Approach to keep collection of parent entity sorted when child changes?
Assume a Person has a Phone and a Phone has Contacts. Assume in the real world the Contacts of a Phone are sorted by their first name.
When I phone.add(Contact c), the phone sorts its contacts. Then ...
10
votes
5
answers
3k
views
Pros and cons of representing routes as legs or stops?
What are some pros and cons of representing routes as legs or as stops?
A leg is a departure and arrival location, a departure time and a duration (or an arrival time and a duration).
A stop is an ...
2
votes
3
answers
516
views
domain model logic behavior (ddd)
How domain model capture business logic / domain logic since i cannot access repository?
I see many posts saying that domain model = business objects
But Business objects live in application layer (...
0
votes
1
answer
563
views
How would you define a domain model for an offer/booking system?
I want to design a domain model for the following system:
a customer asks a hotel for rooms availability and prices on a date
the hotel send several offers: room type x, price Y, etc
the customer ...
2
votes
2
answers
2k
views
DDD - How to decouple two often used together aggregate roots
Context
I'm currently developing a notification system with DDD which needs to be able to send the same notification to multiple users. For example, a group of party goers might all be notified about ...
3
votes
2
answers
1k
views
How should I structure my database entities with invites and recipients for e-signing web app?
I am interested in implementing the following requirements for my e-signature web application.
A user can create a new signing contract. That contract can include multiple users to sign. The contract ...
15
votes
4
answers
3k
views
Should entities contain information about their amount?
Can I get some thoughts on the entity design?
Let's say I have an entity called Book. Let's say I create a specific instance of that book. It has a title A and an author B. Since there can be multiple ...
0
votes
3
answers
3k
views
How can I coordinate updating multiple Aggregates as a result of one command, without introducing exploitative possibilities?
I'm trying to figure out how to integrate one command that updates multiple Aggregates in different contexts in a video game. The components/considerations for my particular design are DDD, CQRS, ...
19
votes
3
answers
2k
views
How do you push Design changes in TDD in late development stage
I was recently part of a TDD development team. At certain point I realized that there is a design mistake instead of Object Oriented Design and Structural design the problems were solved via statuses. ...
7
votes
1
answer
455
views
Too many conversion between layers
I'm developing a back-end application and I ran into the problem of too many conversions between layers. For a single type it is like this:
So every time I update the model, I need to update six ...
0
votes
1
answer
565
views
Can we do domain modelling or create domain entities/models in NoSQL like Amazon DynamoDB? If yes then how?
Recently I was going through an article (link at the end) on AWS for DynamoDB NoSQL and got to know that they are suggesting to only have a single table with certain access patterns in your NoSQL ...
2
votes
3
answers
3k
views
Where should "query" business logic be placed in Domain-driven design?
System description
This is a simple eCommerce application containing a Products inventory managed by an Admin. The Products in inventory/repository will show in the User App. Admin has the ability to ...
3
votes
5
answers
2k
views
All the properties of a domain object should support NULL value?
Imagine you have an application with the domain object User:
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; ...