Greg Young on Documents and Processes as an Alternative to Events
Not all systems are based on events or facts. In some problem spaces events make complete sense; they are about facts that are happening over periods of time. But a lot of systems are instead focused on information that flow through a process, Greg Young explained in a talk about Document Based Messaging and Analysis at DDD Exchange Day in London last week.
A mortgage inside a bank is an example. Someone comes in with a mortgage application which then flows through the organisation; people in different positions do something to the application, which eventually ends up being securitized.
This is a different style of messaging compared to events, documents that flow through a process and is the focus in Greg’s talk.
Greg’s experience is that in general we have an easy time building structure in a domain model; the hard part is getting behaviour into the model.
Getting business people to talk about behaviour is often the hardest part.
Events go a long way in enforcing business people to think about behaviours, about the facts that occur in a system. Documents give a different perspective, they change focus to the flow of a process, something most organisations already have, or had; a paper process, maybe for disaster recovery. If you start looking at these paper processes you can often get business people involved in a much better way.
Business people can easily comprehend pieces of paper that move through a process.
A method Greg has found to often work very well is to bring business people into a room and tell them to forget about computers, how would they create a form or other document and then create the handling of it in a process flow? Describing a process this way will help in understanding how to do things with computers. As a side effect this modelling exercise also creates a disaster recovery plan.
The reason this works so well is that working with paper is how businesses have been working long before there were computers.
We now have two conceptual models we can work with, one based on events and one on documents. Greg emphasises that they are not mutually exclusive. Events can contain documents and documents can contain events, in a document based process flow an event may sometimes be fired, with the event including the current document.