I've built some shopping cart systems in the past, but I always designed them such that the final order invoice is just a shopping cart that has been marked as "purchased". All the logic for adding/removing/changing items in a cart is also the logic for the order. All data is stored in the same tables in the database. But it seems this i...
Hi, I am trying to learn Domain Driven Design and recently read that lots of people advocate creating a ViewModels for your views that store all the values you want to display in a given view.
My question is how should I do the form validation? should I create separate validation classes for each view, or group them together? I'm also c...
There are a lot of posts about how cool POCO objects are and how Entity Framework 4 supports them.
I decided to try it out with domain driven development oriented architecture and finished with domain entities that has dependencies from services.
So far so good.
Imagine my Products are POCO objects.
When i query for objects like this:
...
I'm dealing with a database that contains data with inconsistencies such as white leading and trailing white space.
In general I see a lot of developers practice defensive coding by trimming almost all strings that come from the database that may have been entered by a user at some point. In my oppinoin it is better to do such formatin...
I am trying to set up proper domain architecture using Fluent NHibernate and Linq to NHibernate. I have my controllers calling my Repository classes, which do the NHibernate thang under the hood and pass back ICollections of data. This seems to work well because it abstracts the data access and keeps the NHibernate functionality in the...
I'm designing a larger enterprise architecture and I'm in a doubt about how to separate the models and design those.
There are several points I'd like suggestions for:
- models to define
- way to define models
Currently my idea is to define:
Core (domain) model
Repositories to
get data to that domain model from a
database or other sto...
Just need to clarify this one, If I have the below interface
public interface IRepository<T>
{
T Add(T entity);
}
when implementing it, does checking for duplication if entity is already existing before persist it is still a job of the Repository, or it should handle some where else?
...
From a practical point of view, how can you adapt the domain model to the MVC pattern? For example, could I use some wrapper classes?
...
Hello
I want to attach to a running process using 'ddd', what I manually do is:
# ps -ax | grep PROCESS_NAME
Then I get a list and the pid, then I type:
# ddd PROCESS_NAME THE_PID
Is there is a way to type just one command directly?
Remark: When I type ps -ax | grep PROCESS_NAME, grep will match both the process and grep command ...
DDD recommends that the domain objects should be in a valid state at any time. Aggregate roots are responsible for guaranteeing the invariants and Factories for assembling objects with all the required parts so that they are initialized in a valid state.
However this seems to complicate the task of creating simple, isolated unit tests a...
I have an asp.net mvc 2.0 application that contains Areas/Modules like calendar, admin, etc... There may be cases where more than one area needs to access the same Repo, so I am not sure where to put the Data Access Layers and Repositories.
First Option:
Should I create Data Access Layer files (Linq to SQL in my case) with their accomp...
I have an application structured as follows:
dao
domain
main
services
utils
I've made a class that reads the application configuration from an XML file. The question is where should it be placed?
By reflex, I'd have placed it in utilities but utility classes have static methods and are stateless whereas this class uses an instance o...
When applying Domain Driven Design to a project, how do you identify the Aggregate Roots?
For example, in a standard E-Commerce website, you might say that the Order is one, and the User is the other.
But what if your Users belong to a Company? Does that make your Company the aggregate root?
I'm interested in hearing people's approache...
I have a few (hopefully) simple questions about aggregate roots in domain driven design:
Is it okay to have an aggregate root as a property of another aggregate root?
Is it okay to have a given entity inside two or more aggregate roots?
My final question is a bit more involved. I have a website that has a few entities that really bel...
I have the following entity
public class Employee
{
public virtual int Id {get;set;}
public virtual ISet<Hour> XboxBreakHours{get;set}
public virtual ISet<Hour> CoffeeBreakHours {get;set}
}
public class Hour
{
public DateTime Time {get;set;}
}
(What I want to do here is store information that employee A plays Xbox everyda...
Hi, I'm looking for some advice on architecture for a client/server solution with some peculiarities.
The client is a fairly thick one, leaving the server mostly to peristence, concurrency and infrastructure concerns.
The server contains a number of entities which contain both sensitive and public information. Think for example that the...
I must be doing something fundamentally wrong.
I am implmenting my repositories and then testing them with mocked data. All is well.
Now I want to test my domain objects so I point them at mock repositories.
But I'm finding that I have to re-implement logic from the 'real' repositories into the mocks, or, create 'helper classes' that ...
I want to write a rich domain class such as
public class Product
{
public IEnumerable<Photo> Photos {get; private set;}
public void AddPhoto(){...}
public void RemovePhoto(){...}
}
But the entity framework (V4 code first approach) requires an ICollection type for lazy loading! The above code no longer works ...
Hey guys,
I have a question that is more in the realm of design, than implementation.
I'm also happy for anyone to point out resources for the answer and I'll gladly,
research for myself.
Highly simplified Java and SQL:
Say I have a business domain POJO called 'Picture' with three attributes.
class Picture
int idPicture
Str...
Hi, i'm having trouble writing integration tests which use a fake repository,
For example : Suppose I have a classroom entity, which aggregates students...
var classroom = new Classroom();
classroom.Students.Add(new Student("Adam"));
_fakeRepository.Save(classroom);
_fakeRepostiory.GetAll<Student>().Where((student) => student.Name ==...