background preloader

DDD

Facebook Twitter

Querying is a business concern. A lot of people moving from hand-built / code-gened DAL to NHibernate seem to encounter the issue of anemic data layer.

Querying is a business concern

NHibernate subsume all the responsabilities, leaving the developer with just managing the session and maybe adding a couple of Get/Save methods. It tends to bother some people, who are used to data layers that does quite a bit more. A more important concern is that you end up putting query logic inside your business objects, and that breaks the way things should happen according to the Ancient Wisdom. As far as I can see it, NHibernate is dealing with the mechanics of querying the database, leaving you to work with the model. When I put it this way, does it make more sense? You are telling NHibernate, in the terms of the model, what you want to get back, and it does it.

If I want to display to the user its next actions, I need to ask: "give me all the users's actions whose state is not completed, ordered by date and then importance". Event Sourcing. Capture all changes to an application state as a sequence of events.

Event Sourcing

We can query an application's state to find out the current state of the world, and this answers many questions. However there are times when we don't just want to see where we are, we also want to know how we got there. Object Role Stereotypes. Patterns in Practice Object Role Stereotypes Jeremy Miller Object-oriented systems are composed of many objects, each one fulfilling some set of responsibilities.

Object Role Stereotypes

Objects often need to collaborate with other objects in order to fulfill these responsibilities. You can better understand the responsibilities of objects and the collaborations between them by applying a concept known as object role stereotypes. What's the Problem? Neolithic programmers lived in a state of simplicity. Public static class Program { public static void Main(string[] args) { Console.WriteLine("Look at me World! The single method style of program construction is the easiest form of programming to learn, but it breaks down quickly as the program becomes larger.

Ideally, the system becomes much easier to understand but there's plenty of potential for getting things wrong as you split up the system between developers, teams, or even different systems. Employing the Domain Model Pattern. Domain Models Employing the Domain Model Pattern Udi Dahan In this article, we’ll go through the reasons to (and not to) employ the domain model pattern, the benefits it brings, as well as provide some practical tips on keeping the overall solution as simple as possible.

Employing the Domain Model Pattern

If you had come to me a few years ago and asked me if I ever used the domain model pattern, I would have responded with an absolute "yes. " Eager Read Derivation. Domain driven design · application architecture tags: One of the interesting talks I attended at QCon San Francisco, was one given by Greg Young about a particular architecture he'd used on a recent system.

Eager Read Derivation

Domain Driven Design with AOP and DI.

DSL

DDDD 1 [When to Message] Just as a bit of a preamble, today is the first of what will hopefully be many days of me knocking out my blog backlog by actually taking an hour lunch and bringing my laptop to write.

DDDD 1 [When to Message]

Unfortunately I currently have a backlog of over 40 posts … Hopefully in a few weeks that number will come down a bit. Domain Event-Driven Architecture. Testing The Domain. Colin, In reference to the first choice you layed out, I have a definite preference.

Testing The Domain

> 1) Use real instances of the domain classes. > 2) Use mock/dummy objects. I prefer real instances. Consider the things that often stop people from using this approach and push them toward mock/dummy objects. Repository Pattern vs. Transparent Persistence. I've recently read the book Domain Driven Design, which apparently is now the new bible for some folks who totally think in objects.

Repository Pattern vs. Transparent Persistence

I even mentioned it in HiA and JPwH - unfortunately I didn't read it before. I now think that quite a few of the patterns promoted by this book are actually a step backwards. I also miss a list of Pros and Cons of each pattern (like in the GoF book). So readers have to guess why and when a pattern might be applicable and when not. Domain Driven on Naked CLR? How to create fully encapsulated Domain Models. Bryan Wheeler, Director Platform Development at msnbc.com “Udi Dahan is the real deal.

How to create fully encapsulated Domain Models

We brought him on site to give our development staff the 5-day “Advanced Distributed System Design” training. The course profoundly changed our understanding and approach to SOA and distributed systems. Consider some of the evidence: 1. Months later, developers still make allusions to concepts learned in the course nearly every day 2. One of our developers went home and made her husband (a developer at another company) sign up for the course at a subsequent date/venue 3.

Domain-Driven Design Resources. July 2011 Update: Domain-Driven Design: Links, News, Resources (1) I have my links collection on Domain-Driven Design, and I want to post it to this blog.

Domain-Driven Design Resources

This list is only a disorganized collection but I think that can be useful: Eric Evans’ My link collection on. From CRUD to Domain-Driven Fluency. Bryan Wheeler, Director Platform Development at msnbc.com “Udi Dahan is the real deal. We brought him on site to give our development staff the 5-day “Advanced Distributed System Design” training. The course profoundly changed our understanding and approach to SOA and distributed systems.

Consider some of the evidence: 1. Months later, developers still make allusions to concepts learned in the course nearly every day 2. One of our developers went home and made her husband (a developer at another company) sign up for the course at a subsequent date/venue 3. Infrastructure Ignorance. Recently there have been a long discussion in the ALT.Net mailing list about Auto Mocking Containers. We covered a lot of ground there and it is interesting to boot. What I wanted to talk about comes from this discussion. A while ago there was a big stick about Persistence Ignorance. I won't reiterate the arguments, but I want to expand the idea to other concepts as well. It is not just persistence that your code should be ignorant of, it is all the infrastructure concerns in general.

I don't care how good your infrastructure code is, it is still nasty pitfall of technicalities. The IoC container that you use shouldn't appear anywhere in your code, nor should the persistence concerns mix themselves with the actual code.