QCon San Francisco 2008 – Unleash Your Domain
The talk “Unshackle Your Domain” given by Greg Young was the highlight of QCon for me. An architectural approach that is relatively easy to understand, incredibly scalable, and supports a rich domain model.
At his presentation, Greg quickly pointed out some of the problems with traditional enterprise application architecture, such as JEE. This architecture usually consists of an “object-oriented” domain model encapsulated inside a procedural service layer, persisted in a relational database, flattened out on a data entry screen by the UI layer, and crunched daily into management reports by some reporting tool. With so many masters, it’s no wonder that the domain model becomes anemic and the application is hard to scale.
Greg needed something better. Something that is able to sustain 10,000 transactions per second, supports bullet-proof auditing, and has a rich domain model to implement complicated financial business logic.
His key insight is that the application should explicitly model state transition commands as classes and strictly split these commands from queries on the application interface level. So any kind of client UI or report will use the query interface of the application to get its needed data using a thin DTO layer while updates uses the command interface. These command objects also support the audit requirements and drive the domain model.
Now the domain model only supports a single concern: validating and executing commands. No longer does the domain model need to support querying, so your objects no longer need lots of getters and setters: Tell, don’t ask! In addition to this, the domain model can now be stored using a data store optimized for updates, such as Hypertable or CouchDB.
For the query interface a read-optimized database can be used, updated by events from the domain model. You can easily denormalize this database without reducing the efficiency of writes on your domain model. Furthermore, it is now possible to easily replicate this read-only store for extremely high scalability.
In the next few weeks I’ll investigate the practical implications of this approach, the needed infrastructure to get this working, and the possible applications that could benefit.
Look at our consultancy services, training offers and careers below or contact us at firstname.lastname@example.org