In-Depth

Book excerpt: On model-driven design

This article is excerpted from Chapter 3 of Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans, ISBN 0-321-12521-5, $49.99. This chapter is printed with permission from the author and Addison-Wesley Professional.

The first thing I saw as I walked through the door was a complete class diagram printed on large sheets of paper that covered a large wall. It was my first day on a project in which smart people had spent months carefully researching and developing a detailed model of the domain. The typical object in the model had intricate associations with three or four other objects, and this web of associations had few natural borders. In this respect, the analysts had been true to the nature of the domain.

As overwhelming as the wall-size diagram was, the model did capture some knowledge. After a moderate amount of study, I learned quite a bit (though that learning was hard to direct -- much like randomly browsing the Web). I was more troubled to find that my study gave no insight into the application’s code and design.

When the developers had begun implementing the application, they had quickly discovered that the tangle of associations, although navigable by a human analyst, didn’t translate into storable, retrievable units that could be manipulated with transactional integrity. Mind you, this project was using an object database, so the developers didn’t even have to face the challenges of mapping objects into relational tables. At a fundamental level, the model did not provide a guide to implementation.

Because the model was “correct,” the result of extensive collaboration between technical analysts and business experts, the developers reached the conclusion that conceptually based objects could not be the foundation of their design. So they proceeded to develop an ad hoc design. Their design did use a few of the same class names and attributes for data storage, but it was not based on the existing, or any, model.

Models come in many varieties and serve many roles, even those restricted to the context of a software development project. Domain-driven design calls for a model that doesn’t just aid early analysis but is the very foundation of the design. This approach has some important implications for the code. What is less obvious is that domain-driven design requires a different approach to modeling.

For more information on Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans, please go to The Domain-Driven Design page on Amazon.com

About the Author

Eric Evans is the founder of Domain Language, a consulting group focused on helping companies build evolving software deeply connected to their businesses.