InfoQ

Interview

Greg Young Discusses State Transitions in Domain-Driven Design and DDD Best Practices

Interview with Greg Young by Srini Penchikala on Jan 30, 2009

Community
Architecture
Topics
Design Pattern ,
Design
Tags
QCon ,
Dependency Injection ,
Aspect Oriented Programming ,
Domain Driven Design ,
QCon San Francisco 2008
Summary
In this interview, Greg Young talks about managing state transitions in a Domain-Driven Design project using two separate models, one for reading data from datastore and the other for write-only command operations. He also discussed Command Query Separation to keep the design cleaner and easier to test and maintain and the best practices that developers can use when working on DDD projects.

Bio
Greg Young is co-founder and CTO of IMIS, a stock market analytics firm in Vancouver BC. With over 10 years of varied experience in computer science from embedded operating systems to business systems and everything in between, he brings a pragmatic and often times unusual viewpoint to discussions.
My name is Srini Penchikala. I am with Greg Young. Greg, can you tell us a little bit about what you are currently working on?
Can you tell us a bit about how you are using Domain-Driven Design and use cases of DDD?
You have blogged about making the state changes explicit within the domain. Can you elaborate on that topic?
Can you also talk about some of the best practices and gotchas that the developers and architects should keep in mind when they are working on Domain-Driven Design projects?
You have also mentioned about Command-Query Separation and how it helps in the DDD. Can you discuss that concept?
What do you think about the influence of design concepts, such as Dependency Injection (DI) and Aspect-Oriented Programming (AOP) have on domain driven design?
You said before that starting DDD is a tough decision and there are a lot of types of projects that don't necessarily fit well with DDD. You would best do DDD with very large projects, right? Are there elements of DDD you could use for smaller projects, when thinking about the building blocks for example, Aggregate roots for streamlining, data access or thinking more about your data access logic. What would you recommend there?
Another thing I wanted to ask you about was the immutability thing of domain object you mentioned. When domain objects can only be in a valid state, they have no getters actually, how would you implement the mapping to DTOs with the Data Transfer Objects?
It sounds like Eclipse has some support for it.
Are you suggesting that you only convert to the internal domain model when you write stuff?
I read somewhere that you're actually currently writing on a book about distributed domain driven design. Is this correct?
There are these frameworks in the Java world called Naked Objects and JMatter that claim to make domain driven design implementation easier. Are there any such frameworks in .NET world and if so, what do you think about the role they can play in the domain driven design space?
How do you introduce these junior programmers that you mentioned to domain driven design? There are things you could introduce by osmosis, by peering up, by formal training. What is your strategy in your company.
Can you talk about managing the state transitions in the domain driven design world?
Speaking of processing event streams, it sounds like ESP, Event Stream Processing is a good fit for handling those. Are you thinking of implementing something like that in the near future?
show all  show all
Greg Young on DDD by Ryan Riley Posted Jan 30, 2009 2:03 PM
Re: Greg Young on DDD by Robin Howlett Posted Feb 2, 2009 4:21 PM
Greg Young on DDD by Jean-Christophe Grégoire Posted Feb 6, 2009 11:46 AM
Holy heck by Raoul Duke Posted Feb 6, 2009 4:34 PM
What about in memory edits? by Ian Jones Posted Sep 25, 2009 6:41 AM
What about in memory edits? by Ian Jones Posted Oct 5, 2009 5:52 AM
Re: What about in memory edits? by Sunny Peng Posted Dec 24, 2009 12:20 AM
  1. Back to top

    Greg Young on DDD

    Jan 30, 2009 2:03 PM by Ryan Riley

    Great interview! A lot of what Greg said really resonates with a lot of things I've been trying to do, and his statements certainly cleared up some thoughts I was having on a) immutability, b) AOP, and c) the use of DTOs.

    Thanks!

  2. Back to top

    Re: Greg Young on DDD

    Feb 2, 2009 4:21 PM by Robin Howlett

    This is a superb video; I have to admit viewing this interview I had very limited knowledge about DDD, but Greg succinctly and clearly outlined his understanding and expertise. The concepts outlined are of immense value - great job.

  3. Back to top

    Greg Young on DDD

    Feb 6, 2009 11:46 AM by Jean-Christophe Grégoire

    Great interview !!

  4. Back to top

    Holy heck

    Feb 6, 2009 4:34 PM by Raoul Duke

    What a wonderful interview. It is so rare to come across people who can clearly state what is obviously (in retrospect) true and useful. I kinda hate all things financial, but judging by this interview I'd happily go to work for them. We surely need more of this kind of intelligence.

  5. Back to top

    What about in memory edits?

    Sep 25, 2009 6:41 AM by Ian Jones

    When using CQS in domain driven design how would you query changes made to the domain object when the domain object changes are not persisted to the database and are only in memory? i.e. I want to make a change to a customer address, I issue a command to the customer domain object, I save the customer domain object to session. I then want to update the screen with the changes. Only later when the user is happy with the total of the changes do they commit the data to the database.
    A couple of possible solutions I can think of is to have a session repository, or a way of getting a query object from the domain object.
    Or does CQS not apply to this type of scenario?

  6. Back to top

    What about in memory edits?

    Oct 5, 2009 5:52 AM by Ian Jones

  7. Back to top

    Re: What about in memory edits?

    Dec 24, 2009 12:20 AM by Sunny Peng

    JdonFramework is a DDD framework , it supports model in memory, and CQRS domain events + Asynchronous, more details jdon.dev.java.net/

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.