Domain-Driven Design: Tackling Complexity in the Heart of Software
Rate it:
Open Preview
10%
Flag icon
But do you hear phrases that could even remotely be described in terms of relationships and interactions in your current domain model?
10%
Flag icon
“A Routing Service finds an Itinerary that satisfies a Route Specification.”
10%
Flag icon
our brains seem to be somewhat specialized for dealing with complexity in spoken language
10%
Flag icon
pidgin
10%
Flag icon
When people are talking, they naturally discover differences in interpretation and the meaning of their words, and they naturally resolve those differences. They find rough spots in the language and smooth them out.
11%
Flag icon
Play with the model as you talk about the system. Describe scenarios out loud using the elements and interactions of the model, combining concepts in ways allowed by the model. Find easier ways to say what you need to say, and then take those new ideas back down to the diagrams and code.
11%
Flag icon
Technical people often feel the need to “shield” the business experts from the domain model. They say: “Too abstract for them.” “They don’t understand objects.” “We have to collect requirements in their terminology.” These are just a few of the reasons I’ve heard for having two languages on the team. Forget them.
11%
Flag icon
If sophisticated domain experts don’t understand the model, there is something wrong with the model.
11%
Flag icon
As the new language evolves, the domain experts must make the extra effort to adopt it, and to retrofit any old documents that are still important.
11%
Flag icon
The domain experts can use the language of the model in writing use cases, and can work even more directly with the model by specifying acceptance tests.
11%
Flag icon
The meanings of words are slippery things. The domain model will typically derive from the domain experts’ own jargon but will have been “cleaned up,” to have sharper, narrower definitions.
11%
Flag icon
Multiplicity of languages is often necessary, but the linguistic division should never be between the domain experts and the developers.
11%
Flag icon
UBIQUITOUS LANGUAGE is cultivated in the intersection of jargons.
11%
Flag icon
Simple, informal UML diagrams can anchor a discussion.
11%
Flag icon
The trouble comes when people feel compelled to convey the whole model or design through UML. A lot of object model diagrams are too complete and, simultaneously, leave too much out. They are too complete because people feel they have to put all the objects that they are going to code into a modeling tool. With all that detail, no one can see the forest for the trees.
11%
Flag icon
Object interaction diagrams can illustrate some tricky hotspots in the design, but the bulk of the interactions can’t be shown that way. It is just too much work, both to create the diagrams and to read them. And an interaction diagram can still only imply the purpose behind the model.
11%
Flag icon
This needn’t trouble us, though, because careful use of English (or Spanish, or whatever) can fill this role pretty well.
11%
Flag icon
Diagrams are a means of communication and explanation, and they facilitate brainstorming. They serve these ends best if they are minimal.
11%
Flag icon
It leads us toward simplified diagrams of conceptually important parts of the object model that are essential to understanding the design. The diagrams in this book are typical of those I use on projects. They simplify, they explain, and they even incorporate a bit of nonstandard notation when it clarifies their point.
11%
Flag icon
The vital detail about the design is captured in the code. A well-written implementation should be transparent, revealing the model underlying it.
11%
Flag icon
Supplemental diagrams and documents can guide people’s attention to the central points.
11%
Flag icon
Rather than a diagram annotated with text, I write a text document illustrated with selective and simplified diagrams.
11%
Flag icon
Once a document takes on a persistent form, it often loses its connection with the flow of the project. It is left behind by the evolution of the code, or by the evolution of the language of the project.
12%
Flag icon
But code as a design document does have its limits. It can overwhelm the reader with detail.
12%
Flag icon
A document shouldn’t try to do what the code already does well. The code already supplies the detail. It is an exact specification of program behavior.
12%
Flag icon
A document must be involved in project activities. The easiest way to judge this is to observe the document’s interaction with the UBIQUITOUS LANGUAGE. Is the document written in the language people speak on the project (now)? Is it written in the language embedded in the code?
12%
Flag icon
If it is having no impact on the UBIQUITOUS LANGUAGE, something is wrong.
12%
Flag icon
The UBIQUITOUS LANGUAGE allows other documents, such as requirements specifications, to be more concise and less ambiguous. As the domain model comes to reflect the most relevant knowledge of the business, application requirements become scenarios within that model, and the UBIQUITOUS LANGUAGE can be used to describe such a scenario in terms that directly connect to the MODEL-DRIVEN DESIGN (see Chapter 3). As a result, specifications can be written more simply, because they do not have to convey the business knowledge that lies behind the model.
12%
Flag icon
By keeping documents minimal and focusing them on complementing code and conversation, documents can stay connected to the project. Let
12%
Flag icon
behavior
Richard Faust
and it won't express the user activity supported or elicited by it
12%
Flag icon
It takes fastidiousness to write code that doesn’t just do the right thing but also says the right thing.
12%
Flag icon
Still, while even code can mislead, it is closer to the ground than other documents. Aligning the behavior, intent, and message of code using current standard technology requires discipline and a certain way of thinking about design
12%
Flag icon
Models can also be valuable as education aids to teach about the domain.
12%
Flag icon
An explanatory model can include aspects of the domain that provide context that clarifies the more narrowly scoped model.
13%
Flag icon
The project had a domain model, but what good is a model on paper unless it directly aids the development of running software?
13%
Flag icon
you couldn’t gain much insight about the purpose of the system by reading the code. Neither process took any advantage of the object paradigm available in their development environment, except as fancy data structures.
13%
Flag icon
What is less obvious is that domain-driven design requires a different approach to modeling. . . .
13%
Flag icon
The astrolabe was a mechanical implementation of an object-oriented model of the sky.
13%
Flag icon
Projects that have no domain model at all, but just write code to fulfill one function after another, gain few of the advantages of knowledge crunching and communication discussed in the previous two chapters. A complex domain will swamp them.
13%
Flag icon
On the other hand, many complex projects do attempt some sort of domain model, but they don’t maintain a tight connection between the model and the code. The model they develop, possibly useful as an exploratory tool at the outset, becomes increasingly irrelevant and even misleading. All the care lavished on the model provides little reassurance that the design is correct, because the two are different.
13%
Flag icon
This connection can break down in many ways, but the detachment is often a conscious choice. Many design methodologies advocate an analysis model, quite distinct from the design and usually developed by different people. It is called an analysis model because it is the product of analyzing the business domain to organize its concepts without any consideration of the part it will play in a software system. An analysis model is meant as a tool for understanding only; mixing in implementation con...
This highlight has been truncated due to consecutive passage length restrictions.
13%
Flag icon
Some knowledge crunching happens during such an analysis, but most of it is lost when coding begins, when the developers are forced to come up with new abstractions for the design.
13%
Flag icon
crucial discoveries always emerge during the design/implementation effort.
13%
Flag icon
Very specific, unanticipated problems always arise.
13%
Flag icon
An up-front model will go into depth about some irrelevant subjects, while it overlook...
This highlight has been truncated due to consecutive passage length restrictions.
13%
Flag icon
Whatever the cause, software that lacks a concept at the foundation of its design is, at best, a mechanism that does useful things without explaining its actions.
13%
Flag icon
A deadly divide opens between analysis and design so that insight gained in each of those activities does not feed into the other.
13%
Flag icon
MODEL-DRIVEN DESIGN discards the dichotomy of analysis model and design to search out a single model that serves both purposes. Setting
13%
Flag icon
This approach demands a model that works well as both analysis and design. When a model doesn’t seem to be practical for implementation, we must search for a new one. When a model doesn’t faithfully express the key concepts of the domain, we must search for a new one. The modeling and design process then becomes a single iterative loop.
13%
Flag icon
It calls for hard thinking and usually takes multiple iterations and a lot of refactoring, but it makes the model relevant.