domain-driven-design

[MVC] What's the preferred URL to add an entity that is not an aggregate root?

Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity. 1: http://example.com/orders/add-orderline?order-id=42&...

When to separate certain entities into different repositories?

I generally try and keep all related entities in the same repository. The following are entities that have a relationship between the two (marked with indentation): User UserPreference So they make sense to go into a user repository. However users are often linked to many different entities, what would you do in the following examp...

Entities and calculated properties

What is the best practice to implement the following: we have a classes Order and OrderItem as parent-child. Class OrderItem provides property Cost On the OrdersList form we have to see MaxCost column = max(cost) from Items collection I found only one usefull solution here which won't break the DDD concpts: to add a usual prop...

(N)Hibernate: core/master mappings with relationships

I am starting a job with a mid size company working mostly on writing custom apps that interact with their ERP system. This is my first time doing this sort of work, so the ERP concept is new to me and I am learning it piece meal. I have only written two apps so far and have learned the database model as I went and only as much as I n...

Ubiquity of language... lost in translation

I found two collapsing problems : You should use the same language between domain experts and development teams (DDD) You should use English for naming in your code (.Net Design guidelines) What if the domain experts don't speak English ? ...

Scaling a rich domain model

Domain Driven Design encourages you to use a rich domain model. This means all the domain logic is located in the domain model, and that the domain model is supreme. Persistence becomes an external concern, as the domain model itself ideally knows nothing of persistence (e.g. the database). I've been using this in practice on a medium-s...

Which one do you prefer for Searching/Reporting DataTable or DTO or Domain Class?

The project currently I am working of requires a lot of searhing/filtering pages. For example I have a comlex search page to get Issues by data,category,unit,... Issue Domain Class is complex and contains lots of value object and child object. .I am wondering how people dealing with Searching/Filtering/Reporting for UI. As I know I hav...

What is the best practice for domain model re-use in composite applications?

We have a composite application built using the Composite UI Application Block (CAB)/Smart Client Software Factory (SCSF). To date, each module in our composite app has used its own set of DTO's, and business logic has been duplicated throughout the module, both in the UI layer and the Service layer. I would like to pursue more Domain-...

How do you negotiate a domain model with your domain experts?

Suppose you're working with a customer's domain experts. You realize (or at least have a reasonable belief) that your model of their problem is clearer than theirs. How do you convince them that they should go your way. In my case, it is fairly clear what the main thrust of the requirements are (e.g. a trading system for a product). Bas...

TDD, What are your techniques for finding good tests?

I am writing a simple web app using Linq to Sql as my datalayer as I like Linq2Sql very much. I have been reading a bit about DDD and TDD lately and wanted to give it a shot. First and foremost it strikes me that Linq2Sql and DDD don't go along too great. My other problem is finding tests, I actually find it very hard to define good te...

Using Factories in Presenters in a Model View Presenter and Domain Driven Design Project

In domain driven design, it appears to be a good practice to use Factories to create your domain objects in your domain layer (as opposed to using a direct constructor or IoC). But what about using the domain object factories in a presenter layer. For instance, say that I was creating a domain object from user input obtained from the p...

How do you use Intefaces with the Factory Pattern in Domain-Driven Design?

Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them? public IUserFactory { User CreateNewUser(); } public UserFactory : IUserFactory { public User CreateNewUser() { return new User(); } } ...

What goes in your domain model objects and what goes in your services?

In a domain driven design where you're going for a non-anemic domain model how do you decide what to implement in your domain objects vs. service oriented methods? EDIT: I asked this a different way with an example and got much better answers here ...

Domain Driven Design question

Hi, I would like to ask for a reccomended solution for this: We have a list of Competitions. Each competition has defined fee that a participatior has to pay We have Participators I have to know has a Participator that is on a Competition paid the fee or not. I am thinking about 2 solutions and the thing is it has to be the most a...

Domain Objects and Services

In this question someone replies "You never let the domain object implementations call services by themselves!". Is this statement a hard fast rule of DDD or does it depend on your own application and architecture? Contrived example: As an example lets suppose we have a UserImage object in our model that gets populated from an uploaded...

Decorator Chaining of Repositories and Specialized Repositories with Dependancy Injection

Right now I'm trying to figure out a way to do things smarter, and in the course of doing so all i've managed to do is use a full bottle of excedrin in a single day. Assume i have an interface called IRepository like so. public interface IRepository<T> { T Get(int id); void Add(T value); void Update(T value); void Del...

ASP.NET MVC - Complex Objects and Forms

So let's say we have a domain object such as the following public class Person { public string Name { get; set; } public IList<PhoneNumber> PhoneNumbers {get; set; } public IList<Address> Addresses { get; set; } } The Person is not valid until a name, phone numbers, and addresses have been entered. How do you guys handle this...

Should business logic be placed in the domain or the services?

Let's say you have a domain entity User and you want to support the ability for a User to add an item to their shopping cart. Now, we want to make sure that the items in the shopping cart are unique, so we create the following function inside the User class: function AddItemToCart(Item item) { // Add business logic to make sure ite...

Does this Entity Repository Service example fit into Domain-Driven Design?

I would like to know if you find the following pattern meaningful in domain driven design. The domain layer consists of model and repository. The application layer consists of services that handles queries from the user interface, or from controllers in the Model-View-Controller pattern. Details of the structure: // Assembly Model: p...

How do I represent Domain Aggregates in MVC pattern?

SHould I create a separate class for each object in an aggregate or should the objects be nested classes of a single aggregate class? ...