Presentation: Frameworks and DDD: Keeping the Model Clean

| by Abel Avram Follow 7 Followers on Mar 02, 2009. Estimated reading time: 1 minute | NOTICE: The next QCon is in New York Jun 25 - 29, 2018. Join us!

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

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.

Rate this Article

Adoption Stage

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

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you