domain-driven-design

Blog Architecture Design, using MVC and DDD

I'm designing a blog architecture on asp.net mvc. Lets say i only have 2 entities: post and comment. do i need a controller and a repository for each one? how goes the mechanism for displaying a post with it's comments? do the post controller looks in the posts repository for the post, then asks the comment controller to retrieve all the...

Repository Pattern: how to Lazy Load? or, Should I split this Aggregate?

I have a domain model that has the concept of an Editor and a Project. An Editor owns a number of Projects, and a Project has not only an Editor owner, but also a number of Editor members. Therefore, an Editor also has a number of "joined" Projects. I am taking a DDD approach to modelling this and using the Repository pattern for pers...

Is It Incorrect to Make Domain Objects Aware of The Data Access Layer?

I am currently working on rewriting an application to use Data Mappers that completely abstract the database from the Domain layer. However, I am now wondering which is the better approach to handling relationships between Domain objects: Call the necessary find() method from the related data mapper directly within the domain object Wr...

Many-to-many mapping with extra columns in join table

Here is the domain that I wish to have: public class Person { public int Id { get; set; } public IList<AcquiredCertificate> AcquiredCertificates { get; set; } } public class AcquiredCertificate { public Person Acquirer { get; set; } public Certificate Certificate { get; set; } public DateTime DateAcquired; } public class Certific...

fast/right way to create Domain-Objects out of database

i have in the database typical tables like user, usergroup, and they have relations. in my domain-model i want that if you request users, you will get the users and each user has the property belongsto, which means these are the groups he belongs to. in the property i want to have the list of groups (typesafe as groups) the same should...

Merging two domain objects

In the project I'm working on, we have an aggregate domain object. The factory object handles the creation of the unique id for the object. But there is a separate import process which creates the same object initially without the id. To add the imported object to the system, we are now forced to do a field by field copy to a new objec...

Identifying DDD Bounded Contexts and Structuring Project

Hi, I'm trying to get my head around Domain Driven Design and the examples I've seen seem to make sense but I am still unsure of how to apply them to my specific situation. I am designing a CMS where a user can post/edit an article. These can then be viewed by other users who can also make comments, add tags etc. The question I have is...

MVC and Observer pattern

Hi, I am having problems with implementing Observer pattern in my project. The project has to be made as MVC in C#, like a Windows application. In my domain model I have for example Country class and Country repository. I have a Country controller and views for seeing all countries(a list on a form), adding new country, and editing exis...

DDD vs TDD

Which one offers more advantages for a large software, say like Photoshop? Also by TDD I don't mean just unit tests, because you can use unit tests in DDD too, just not the same way TDD does. DDD: Design-Driven Development TDD: Test-Driven Development ...

What is your threshold to use factory instead of a constructor to create an object?

What is your threshold to use factory instead of a constructor to create an object? You always use factory. You use factories only if you have invariant checks other than checking for nulls. You always use constructors You rarely use factories... what are those cases?? pros and cons Update: I am applying factory pattern from Domain ...

Struggling with DDD, Repository Pattern, and Associated Domain Models...

I'm really struggling to wrap my head around some of this stuff. Let me give an example of where I'm struggling. I'm using Linq-2-Sql as the DAL for my app and the IRepository pattern used in the MVC Storefront sample app from Rob Conery. In my domain I have a Customer Model which has a collection of Address Models. In my UI there is a...

DDD - Value Objects Vs. Entity Objects

I'm new to DDD and trying hard to understand some of the concepts. How do you determine in your domain what objects are Entity objects and which ones are Value objects, and how exactly are they treated differently? ...

Best resources on the web for learning Domain-Driven-Design (DDD) in-depth

I'm looking for resources on the web with a lot of detailed explanation of Domain-Driven-Design (DDD) and the patterns that are used. I'm aware of the books available, but I'm looking for resources on the web. thanks! ...

Domain Model - Identifier Relationships vs. Hierarchal Objects

While fleshing out a hypothetical domain model, I have found myself wondering whether the better approach in relating domain objects would be to have a parent domain object contain a pointer (the identifier of the child) or if it would be a better approach to use the child objects to build a composite within the parent object. I can see...

Is Antlr a DSL generator and an alternative to Intentional Programming?

I am struck by the ambition and creativity of Charles Simonyi's efforts to establish the field of Intentional Programming, first at Microsoft and then with his own company. http://stackoverflow.com/questions/201386/what-exactly-is-intentional-programming http://en.wikipedia.org/wiki/Intentional_programming In this approach to softw...

Encapsulating common logic (domain driven design, best practices)

Updated: 09/02/2009 - Revised question, provided better examples, added bounty. Hi, I'm building a PHP application using the data mapper pattern between the database and the entities (domain objects). My question is: What is the best way to encapsulate a commonly performed task? For example, one common task is retrieving one or mor...

Domain Design - Referencing an Entity in a Sub Class

Lets say I have an entity Foo, and it contains a list of another entity Bar. Should Bar have a direct reference to Foo? i.e... public class Foo { public int Id {get; set;} public IList<Bar> Bars {get; set;} } public class Bar { public int Id {get; set;} public Foo parentFoo {get; set; //this will be set to an the Foo ent...

Validation in a Domain Driven Design

How do you deal with validation on complex aggregates in a domain driven design? Do you consolidate your business rules/validation logic? I understand argument validation. And I understand property validation which can be attached to the models themselves and do things like check that an email address or zipcode is valid or that a first...

Domain Driven Design, SOC, and entity identification

I've been trying to wrap my mind around DDD and how it can relate to MVC, but I'm having trouble with regards to entity identification. In particular, I'm trying to maintain strict separation between my presentation, domain, and data models. My hangup here is in how I preserve entity identification across these boundaries. To clarify, I...

Entity Framework as Repository and UnitOfWork?

I'm starting a new project and have decided to try to incorporate DDD patterns and also include Linq to Entities. When I look at the EF's ObjectContext it seems to be performing the functions of both Repository and Unit of Work patterns: Repository in the sense that the underlying data level interface is abstracted from the entity repr...