BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Presentation: Frameworks and DDD: Keeping the Model Clean

Presentation: Frameworks and DDD: Keeping the Model Clean

Bookmarks

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
Style

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.

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

Community comments

  • Open Source Examples

    by Aaron Weiker,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Anyone know where these examples are at?

  • Re: Open Source Examples

    by Erick Pimienta,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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,

    Your message is awaiting moderation. Thank you for participating in the discussion.

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

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

BT