BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Presentation: Frameworks and DDD: Keeping the Model Clean

by Abel Avram on Mar 02, 2009 | NOTICE: The next QCon is in San Francisco Nov 3-7, Join us!

In this presentation recorded during QCon SF 2008, Tim McCarthy talks about preserving the purity of the domain model while using frameworks. Frameworks can be very useful when developing applications, but they can present some pitfalls, mudding the domain, if they are not used properly. The presentation is targeted at developers.

Watch: Frameworks and DDD: Keeping the Model Clean (1h)

McCarthy makes a demo of a real application using SharePoint to show how improper usage of a framework can bind the domain to SharePoint, making it difficult to change and maintain. He also exemplifies how the code should look like to have a good separation between the application and its framework.

One important concept used when modeling a domain is repositories. McCarthy’s rules for repositories are:

  • All Repositories must implement some type of Repository interface, i.e. ICustodianRepository
  • All Repositories are created via a Factory which uses Configuration and Reflection
  • Domain Model classes can use Repositories, but they can only be coupled to their interface, NOT their implementation!

Another concept addressed by McCarthy is Unit of Work. His guidelines for using them are:

  • The Unit of Work does not actually talk to the data source!
  • Repositories and Unit Of Work instances talk via interfaces and double-dispatch
  • Repositories can work with or without a Unit of Work, and vice-versa

Most of McCarthy session is a code demo targeted at developers interested in using both frameworks and DDD. On InfoQ there is more information on Domain-Driven Design.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Open Source Examples by Aaron Weiker

Anyone know where these examples are at?

Re: Open Source Examples by Erick Pimienta

Yeah!!, where are those sample that were presented at the demo. It will be helpfull to share them.

Re: Open Source Examples by Abel Avram

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT