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

learn more… | top users | synonyms

4
votes
1answer
39 views

Strategy to define domain data used in Integration Tests

In my job we work in a data driven web application and performance is a important business feature. So, queries in the model tier are frequently large and contain much of the business logic. As a ...
2
votes
2answers
66 views

Authenticate in the Services? Or in an Endpoint that exposes the Services?

When I'm in charge, I typically model services separate from endpoints. For example: Company.Project.Domain.dll has all of the logic required to complete the services for that domain. In order to ...
0
votes
0answers
42 views

JavaFX Synchronize DataModel with Business Domain

I am currently working on a javaFX (first time) frontend for one of our applications. For this i'm using a simple MVC pattern where my model classes use properties so that i can directly bind them to ...
0
votes
0answers
25 views

Dealing with stale data / currency issues when lazy loading related entities

Imagine I have two associated domain entities with a one-to-many relationship. Here is an example with Customer and Order classes: public class Customer { public int ID { get; internal set; } ...
3
votes
2answers
150 views

Domain object model: query by id vs object

Let assume I have two simple model classes: Product and Brand It is obvious I have a query method in Product class like this Product product = Product.findById(123); What if, I want to query ...
2
votes
5answers
158 views

Should I use inheritance to differentiate objects even if they have the same fields?

Consider this simple class that models a real world mobile device: /// <summary> /// Model that represents a device. /// </summary> public class Device { public DateTime ...
4
votes
3answers
99 views

How do I model this relationship so that it is valid by construction?

Imagine a device class that represents a physical real world mobile device, with fields like Enabled, Platform, Model IMEI, etc. Then, an operation class, which is something that needs to be done to a ...
0
votes
2answers
116 views

Handling Business Logic/Validation Race Conditions

I'm working on a Training Enrollment web application with the following (simplified) features: Maintenance (Add, Edit, Deactivation) of Trainings Student sign-up Student enrollment to Active ...
1
vote
2answers
105 views

DDD using an ORM and a Active Directory Server for Persistence

With Domain Driven Design one would model out the domain. One would then use an ORM of some sort to take care of the persistence. Say you have a Product entity which has a Name, SKU and an Owner. This ...
0
votes
2answers
99 views

How can I create a data model to efficiently answer the question of - where to place my db-interaction code I am about to write?

I am seeking the right model for storing and retrieving data, when working with any specific class, while keeping in mind the bigger picture. Details: I have some SQL code in (one) of my classes and ...
2
votes
3answers
114 views

Design ideas - validation based on conditions outside of the domain

I am facing a very interesting problem here, and I'd like to see some design ideas from domain driven design perspective. To make it easier to express what I need I have following hypothetical ...
1
vote
2answers
182 views

Implementing an anti-corruption layer with domain logic

I'm building an application that compiles a single PDF document from multiple source PDF documents as follows: it takes the first page of each source document, stamps certain information on top of ...
2
votes
2answers
59 views

Domain Modeling - Offerings vs. Usages

I have a question about an issue I always seem to run into when building a domain model. The issue comes up whenever a domain object is used in what I am calling an "offering" scenario and in a ...
0
votes
2answers
134 views

How to use DDD to solve a common address situation?

This is a simple example to show a situation that I find hard to solve with DDD. Consider this: - A property (e.g. a house) has an Address. - An address can be complete or partial (country only; ...
2
votes
2answers
104 views

Should ids be mapped to the implementation type

This is a question of model design, and hopefully some architecture nerds have strong opinions on this. I've been developing one that I will post in an answer. Typically, in every codebase I've ever ...
0
votes
1answer
139 views

Class Table Inheritance: do child tables need a primary key?

I'm using the Class Table Inheritance architecture with my application and have read Fowler. When mapping my database tables to classes in code, I've realized I have no need for an "ID" property on ...
0
votes
1answer
387 views

Clean architecture: should users go in the use case layer or the domain layer?

I recently read this article about Clean Architecture, as I'm trying to get out of some usual OO habits (interface design everywhere, but what does it do???), and program something that describes what ...
3
votes
1answer
52 views

Dealing with Users and User-Owned Data in an API

I have a question about the way I am architecting an API. Structure My API structure so far is like so (there is about 10 classes total, but many are similar, so I've reduced to these classes, and ...
1
vote
1answer
186 views

Help Improve DB model/strategy, for use in refactoring SQL-ridden legacy code

Question: Which design pattern do I use to help me refactor legacy SQL code into separate classes? Goal Bring in concepts of data separation and database separation and also latest modern ...
1
vote
1answer
45 views

Domain models with properties not always set

I don't know if to have domain models with properties that not always are set, it's a some kind of code smell or design error. I put an example: I have an app that lets read internet magazines using ...
2
votes
2answers
108 views

Domain/Model objects attributes good practices

Simple question: Should model/domain objects only include attributes that are meant to be persisted in a database or serialized to any other specific format? My understanding of a domain/model object ...
2
votes
1answer
101 views

DDD and edit of Aggregate's descendants

In a DDD approach, suppose I have an Order (this is my aggregate root) and a Line (a descendant of an Order). In both objects I have private setter for properties and a builder that handle creations ...
5
votes
3answers
323 views

Model relationships with DDD (or with sense)?

Here is a simplified requirement: User creates a Question with multiple Answers. Question must have at least one Answer. Clarification: think Question and Answer as in a test: there is one ...
6
votes
3answers
387 views

In domain driven design, how do I convert a database table with a primary key into a Value Object?

Lets suppose there's a database schema defined like this: Person.mail_address_key ----- Address.address_key Person.billing_address_key ----- Address.address_key A Person has a mailing address and a ...
0
votes
1answer
124 views

DB modeling for staffing demand and supply

TL;DR - I'm looking for guidance with my database design. I am concerned that my existing design is inefficient and won't be able to handle large numbers of employees. This is going to be long, so ...
0
votes
2answers
211 views

Entity design for a blackjack game - should I make Card an entity?

I am creating a simple blackjack game backed by database In my Card is public class Card{ private Face face; private Suit suit; //setters.. getters } where face and suit are enums I have an ...
1
vote
4answers
193 views

Domain model associations that do not required the behaviour of the associated object. How to model?

I've been struggling with this question for a while. I'm specifically thinking within the object orientated domain model. Let's say I have two entities. A supplier and a customer. There is a ...
0
votes
1answer
74 views

Allow entities owned by one user to be referenced by other users' entities

I am working on an Asp.NET MVC web application. I have the following (simplified) entities: public class Course { public int Id { get; set; } public string Name { get; set; } public ...
0
votes
1answer
229 views

How do I keep my classes in MVC from becoming bloated?

I'm not sure how I should have worded the question. If I have a Student and Classes database, and I have queries that involve both. Where do I put my queries? In one case, someone wants student ...
1
vote
1answer
325 views

Domain model for a notification system

I'm trying to build a modular notification service in a ASP.NET MVC web application. The application generates notifications and the service is responsible for delivering the notifications to the ...
1
vote
1answer
123 views

Domain-specific Interfaces

Are there any real benefits of using interfaces over abstract classes in a domain model? Does anyone have any experience using interfaces in a domain model in a real project? From a technical ...
3
votes
2answers
270 views

Should a domain object wrap/contain a DTO interface?

Using .NET - I have an interface IPerson. This interface is implemented by classes in multiple, separate repositories, e.g. EF6 (EfPerson), custom SQL (SqlPerson), or even custom assembly connecting ...
1
vote
3answers
336 views

“Cross-cutting” domain in DDD

I've recently started studying Domain Driven Design and so far it looks like it will help tremendously with my team's current project. I'm running into a bit of a problem though actually determining ...
0
votes
2answers
695 views

DTO - service layer - statelessness best practices interfering with each other

I am designing a REST API coupled with a service layer that takes DTOs as input and produces them as output. This works fine for most service calls where the DTO is used to access an underlying ...
0
votes
1answer
187 views

Technical example of modeling a domain with OOD?

Considering favoring composition over inheritance and looking at various design patterns there are multiple approaches to modeling a domain. Say you have some Entities which are very similar in some ...
1
vote
1answer
397 views

How do you handle domain logic that spans multiple model objects in an ORM?

So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects. E.g. let's say we have a Customer model which ...
2
votes
1answer
212 views

How to present domain model exceptions thrown through validation

In domain model of my web application I've an entity Foo which can be created only by a pojo FooBean: Foo.newInstance(FooBean fooBean) (Might have been better a Builder-pattern.) In the factory ...
2
votes
3answers
207 views

Should data models know where / how they're stored?

I have some classes that represent, for the most part, data that's deserialized from XML. They also have some behavior in them, because I don't want to suffer from an anemic domain model. These domain ...
2
votes
3answers
282 views

Should POCO domain classes contain collections?

The question title is not good, but I couldn't think of a way to word it better. I am used to develop using POCO classes in my projects, that is, domain objects contain absolutely no logic, only ...
1
vote
0answers
36 views

Domain security involving domain logic

Together with my application's domain logic I am trying to outline the security model. I am stuck with a requirement that prevents me from considering security just a cross-cutting concern over my ...
1
vote
1answer
264 views

Cascading deletes from an aggregate root through out the entire aggregate doesn't make sense

Based on the same example for this question. Within the Pro ASP.Net MVC 4 by Adam Freeman, there is a discussion on aggregates and aggregate roots with a simple auction system. There are members who ...
1
vote
1answer
324 views

DDD - Business rule that depends on a service

I got confused about if a domain is required to access an external service in some state of it's life cycle. The business rule is this : If an Employee is accepting a JobSeeker's JobApplication, ...
2
votes
2answers
183 views

Rich domain model and container services

I have a long experience in programming Java EE projects, but as I noticed most of the job I have done was with Transaction Script (anti)pattern. So I want to learn using a rich domain model, but ...
2
votes
2answers
638 views

ID properties on Domain objects in DDD

In my domain I have an Account object. e.g. class Account { public string Number; public string SortCode; } Within the context of DDD, should this account object have an ID property? The ...
2
votes
0answers
125 views

Rails: get data about a model collection, with new model or method?

I have a model Product with attributes sales and views. I need to get sales/views count of all the products. Is more correct to implement this as a method and have a call like Product.all.sales or ...
1
vote
4answers
327 views

In MV* pattern where does non-business model goes?

I am passing Menu items to View from ViewModel. My menu definition is a model with properties title, image, hasChildren and isEnabled. But this model is meant for UI unlike business domain models like ...
3
votes
1answer
429 views

modelling a restaurant availability search

I am looking into finding an efficient way which can scale up to thousands of restaurants, for doing a reservation search. Ideally, it would be efficient to answer queries like find a restaurant ...
0
votes
2answers
305 views

How do I make a domain model that doesn't violate OOP?

My game reads a number of JSON files, deserializes them, and hands the resulting objects off to the classes that need them. These deserialized objects, which can be thought of as the domain model, are ...
4
votes
1answer
1k views

DDD: Domain Model Factory Design

I am trying to understand how and where to implement domain model factories. I have included my Company aggregate as a demo of how I have done it. I have included my design decisions at the end - I ...
2
votes
2answers
162 views

Handling “unspecified” values in software

So I'm working on a software product where we have a number of fields that the customer can leave blank, some of which are numeric. To persist these in the database we use nullable columns. Easy ...