Domain-Driven Design: Tackling Complexity in the Heart of Software
Rate it:
Open Preview
13%
Flag icon
Design a portion of the software system to reflect the domain model in a very literal way, so that mapping is obvious. Revisit the model and modify it to be implemented more naturally in software, even as you seek to make it reflect deeper insight into the domain. Demand a single model that serves both purposes well, in addition to supporting a robust UBIQUITOUS LANGUAGE.
13%
Flag icon
The code becomes an expression of the model, so a change to the code may be a change to the model. Its effect must ripple through the rest of the project’s activities accordingly.
13%
Flag icon
To tie the implementation slavishly to a model usually requires software development tools and languages that support a modeling paradigm, such as object-oriented programming.
13%
Flag icon
The single model reduces the chances of error, because the design is now a direct outgrowth of the carefully considered model. The design, and even the code itself, has the communicativeness of a model.
13%
Flag icon
Developing a single model that captures the problem and provides a practical design is easier said than done. You can’t just take any model and turn it into a workable design. The model has to be carefully crafted to make for a practical implementation.
13%
Flag icon
Development becomes an iterative process of refining the model, the design, and the code as a single activity (see
13%
Flag icon
Object-oriented programming is powerful because it is based on a modeling paradigm, and it provides implementations of the model constructs.
13%
Flag icon
code, the real breakthrough of object design comes when the code expresses the concepts of a model.
14%
Flag icon
assertTrue(a0.assignedRules().contains(minWidth4));     assertEquals(minWidth4, a0.getRule(MIN_WIDTH));     assertEquals(minWidth4, a1.getRule(MIN_WIDTH));
Richard Faust
check Condi that must be true
14%
Flag icon
An interactive user interface could present a list of buses, allowing the user to assign rules to each, or it could read from a file of rules for backward compatibility. A façade makes access simple for either interface. Its implementation echoes the test:
Richard Faust
not much has been said about user activity and how to best benefit him
15%
Flag icon
Of course, if there were only one operation (as in the example), the script-based approach might be just as practical. But in reality, there were 20 or more. The MODEL-DRIVEN DESIGN scales easily and can include constraints on combining rules and other enhancements.
15%
Flag icon
The second design also accommodates testing. Its components have well-defined interfaces that can be unit-tested. The only way to test the script is to do an end-to-end file-in/file-out comparison.
15%
Flag icon
Keep in mind that such a design does not emerge in a single step. It would take several iterations of refactoring and knowledge crunching to distill the important concep...
This highlight has been truncated due to consecutive passage length restrictions.
15%
Flag icon
here we have a problem arising from a different pair of models: the user model and the design/implementation model.
15%
Flag icon
Why make the user learn a new model when the programmers felt the old model was good enough?
15%
Flag icon
Alternatively, store the Favorites in a different way, say in a data file, so that they can be subject to their own rules.
15%
Flag icon
Revealing the model gives the user more access to the potential of the software and yields consistent, predictable behavior.
15%
Flag icon
Manufacturing is a popular metaphor for software development. One inference from this metaphor: highly skilled engineers design; less skilled laborers assemble the products.
15%
Flag icon
This metaphor has messed up a lot of projects for one simple reason—software development is all design. All teams have specialized roles for members, but overseparation of responsibility for analysis, modeling, design, and programming interferes with MODEL-DRIVEN DESIGN.
15%
Flag icon
But that model was never put to work, for two reasons.
15%
Flag icon
First, some of the model’s intent was lost in the handoff.
15%
Flag icon
indirectness of feedback from the interaction of the model with the implementation and the technology.
15%
Flag icon
when a modeler is separated from the implementation process, he or she never acquires, or quickly loses, a feel for the constraints of implementation.
15%
Flag icon
The basic constraint of MODEL-DRIVEN DESIGN—that the model supports an effective implementation and abstracts key domain knowledge—is half-gone, and the resulting models will be impractical.
15%
Flag icon
Programmers are modelers, whether anyone likes it or not. So it is better to set up the project so that the programmers do good modeling work.
15%
Flag icon
Any technical person contributing to the model must spend some time touching the code, whatever primary role he or she plays on the project. Anyone responsible for changing code must learn to express a model through the code. Every developer must be involved in some level of discussion about the model and have contact with domain experts. Those who contribute in different ways must consciously engage those who touch the code in a dynamic exchange of model ideas through the UBIQUITOUS LANGUAGE.
15%
Flag icon
A MODEL-DRIVEN DESIGN intimately connects the model and the implementation. The UBIQUITOUS LANGUAGE is the channel for all that information to flow between developers, domain experts, and the software. The result is software that provides rich functionality based on a fundamental understanding of the core domain.
15%
Flag icon
To keep a software implementation crisp and in lockstep with a model, in spite of messy realities, you must apply the best practices of modeling and design.
15%
Flag icon
Domain-driven design shifts the emphasis of certain conventional ideas.
16%
Flag icon
As a project hits bumps, large or small, developers may find themselves in situations that make those principles seem inapplicable. To make the domain-driven design process resilient, developers need to understand how the well-known fundamentals support MODEL-DRIVEN DESIGN, so they can compromise without derailing.
16%
Flag icon
Sharing these standard patterns brings order to the design and makes it easier for team members to understand each other’s work. Using standard patterns also adds to the UBIQUITOUS LANGUAGE, which all team members can use to discuss model and design decisions.
16%
Flag icon
Developing a good domain model is an art. But the practical design and implementation of a model’s individual elements can be relatively systematic.
16%
Flag icon
The part of the software that specifically solves problems from the domain usually constitutes only a small portion of the entire software system, although its importance is disproportionate to its size.
16%
Flag icon
We need to decouple the domain objects from other functions of the system, so we can avoid confusing the domain concepts with other concepts related only to software technology or losing sight of the domain altogether in the mass of the system.
16%
Flag icon
When the domain-related code is diffused through such a large amount of other code, it becomes extremely difficult to see and to reason about.
16%
Flag icon
The essential principle is that any element of a layer depends only on other elements in the same layer or on elements of the layers “beneath” it. Communication upward must pass through some indirect mechanism, which I’ll discuss a little later.
16%
Flag icon
But it is the crucial separation of the domain layer that enables MODEL-DRIVEN DESIGN.
16%
Flag icon
Partition a complex program into layers. Develop a design within each layer that is cohesive and that depends only on the layers below. Follow standard architectural patterns to provide loose coupling to the layers above. Concentrate all the code related to the domain model in one layer and isolate it from the user interface, application, and infrastructure code.
16%
Flag icon
The domain objects, free of the responsibility of displaying themselves, storing themselves, managing application tasks, and so forth, can be focused on expressing the domain model. This allows a model to evolve to be rich enough and clear enough to capture essential business knowledge and put it to work.
16%
Flag icon
Note that the domain layer, not the application layer, is responsible for fundamental business rules—in this case, the rule is “Every credit has a matching debit.”
16%
Flag icon
a clean separation of concerns keeps the design of each layer easy to understand and maintain.
16%
Flag icon
But of course, the layers have to be connected. To do this without losing the benefit of the separation is the motivation behind a number of patterns.
16%
Flag icon
Layers are meant to be loosely coupled, with design dependencies in only one direction.
16%
Flag icon
when an object of a lower level needs to communicate upward (beyond answering a direct query), we need another mechanism, drawing on architectural patterns for relating layers such as callbacks or OBSERVERS (Gamma
17%
Flag icon
When infrastructure is provided in the form of SERVICES called on through interfaces, it is fairly intuitive how the layering works and how to keep the layers loosely coupled. But some technical problems call for more intrusive forms of infrastructure.
17%
Flag icon
(It may seem counterintuitive for a subclass to be in a layer higher than that of the parent class, but keep in mind which class reflects more knowledge of the other.)
17%
Flag icon
given how very complicated many of the current frameworks are to use, this minimalism helps keep the business objects readable and expressive.
17%
Flag icon
Newer frameworks will automate or prefabricate more and more of the technical aspects of an application. If this is done right, application developers will increasingly concentrate their time on modeling the core business problems, greatly improving productivity and quality. But
17%
Flag icon
domain-driven design requires only one particular layer to exist.
17%
Flag icon
software constructs of the domain layer mirror the model concepts.