DDD: Making implicit concepts explicit
One of my favourite parts of the Domain Driven Design book is where Eric Evans talks about making implicit concepts in our domain model explicit.
The book describes this process like so:
Many transformations of domain models and the corresponding code happen when developers recognize a concept that has been hinted at in discussion or present implicitly in the design, and they then represent it explicitly in the model with one or more objects or relationships.
Lu and I were working on a small application to parse the WCF message log file on our project into more readable chunks whereby each request in the file would be outputted into another file so that it would be possible to read them individually.
We decided to create a little domain model for this since the code seemed to be getting a bit tricky to handle when it was all being written inline inside a main method.
To start with we just had a collection of requests which was an accurate representation of the way that the data was being stored in the log file.
We collected all these requests and then created individual files for each of them. We also grouped these request files under directories by the session that the request was from.
The input/output of our application looked a bit like this:

The next idea suggested for this little application was that it would be cool if we could put the characters 'FAIL' into the file name of any requests which failed and also into the folder name of any sessions which had failing requests inside them.
We tried to do this with our original model but everything we did resulted in adding more and more code to the Request object which didn't seem to belong to it. The tipping point for me was when we ended up with Request.SessionFolderName as a property.
Eventually we realised that what had been implicit would now need to be made explicit and the Session came to be an object in our domain model.
What I found most interesting about this process was that we were always talking about the Session but it didn't actually exist in our model!
The model in our code now pretty much represents the format in which we out outputting the data and with Session as an explicit concept it makes it much easier to make changes in the future.
Good post, Mark!
I think you nailed down the question with such a clear example of a concept that is so relevant in the design conversations, but this only becomes obvious after we decide to make it explicit in the software.
This post also nicely complements your thinking expressed in "Coding: Applying levels of abstraction".
Thanks for your (almost) daily offer of good thinking about our profession.
Rafael
Rafael Peixoto de Azevedo
24 Apr 09 at 3:10 am
DDD: Making implicit concepts explicit – Mark Needham…
Thank you for submitting this cool story – Trackback from DotNetShoutout…
DotNetShoutout
24 Apr 09 at 8:33 am
[...] é um período, e este conceito está implícito nesta classe. Em uma boa modelagem de objetos, nós temos que tornar os conceitos explícitos. Para isso podemos refatorar a classe curso e criar a classe período. Podemos também refatorar o [...]
Saga do programador » Nosso modelo de objetos não deve ser uma cópia do nosso modelo de dados
21 Jul 09 at 12:22 pm
[...] It seems like a really simple conclusion now, but took us a while to arrive at because our heads were stuck in the rest of the system where pretty much everything (legacy dataset-driven code) queries back to the live Roster tables. Instead we should have been focusing on domain driven design's goal of eliminating confusion like this by making implicit concepts explicit: [...]
Richard Dingwall » Domain model refactoring: replace query with composition
26 Oct 09 at 12:09 pm