Domain-Driven Design: Tackling Complexity in the Heart of Software
Rate it:
Open Preview
17%
Flag icon
tongue in cheek,
17%
Flag icon
Therefore, when circumstances warrant: Put all the business logic into the user interface. Chop the application into small functions and implement them as separate user interfaces, embedding the business rules into them. Use a relational database as a shared repository of the data. Use the most automated UI building and visual programming tools available.
17%
Flag icon
fact, it is difficult to apply any of the methods discussed later in this book without that separation, and so this SMART UI can be considered an “anti-pattern” in the context of domain-driven design. Yet it is a legitimate pattern in some other contexts. In truth, there are advantages to the SMART UI, and there are situations where it works best—which partially accounts for why it is so common.
17%
Flag icon
Productivity is high and immediate for simple applications. • Less capable developers can work this way with little training. • Even deficiencies in requirements analysis can be overcome by releasing a prototype to users and then quickly changing the product to fit their requests.
17%
Flag icon
Applications are decoupled from each other, so that delivery schedules of small modules can be planned relatively accurately. Expanding the system with additional, simple behavior can be easy. • Relational databases work well and provide integration at the data level. • 4GL tools work well. • When applications are handed off, maintenance programmers will be able to quickly redo portions they can’t figure out, because the effects of the changes should be localized to each particular UI.
17%
Flag icon
Integration of applications is difficult except through the database. • There is no reuse of behavior and no abstraction of the business problem. Business rules have to be duplicated in each operation to which they apply. • Rapid prototyping and iteration reach a natural limit because the lack of abstraction limits refactoring options. • Complexity buries you quickly, so the growth path is strictly toward additional simple applications. There is no graceful path to richer behavior.
18%
Flag icon
The SMART UI is discussed only to clarify why and when a pattern such as LAYERED ARCHITECTURE is needed in order to isolate a domain layer.
18%
Flag icon
If the architecture isolates the domain-related code in a way that allows a cohesive domain design loosely coupled to the rest of the system, then that architecture can probably support domain-driven design.
18%
Flag icon
If you have a complex application and are committing to MODEL-DRIVEN DESIGN, bite the bullet, get the necessary experts, and avoid the SMART UI.
18%
Flag icon
Connecting model and implementation has to be done at the detail level.
18%
Flag icon
associations.
18%
Flag icon
Does an object represent something with continuity and identity—something that is tracked through different states or even across different implementations? Or is it an attribute that describes the state of something else? This is the basic distinction between an ENTITY and a VALUE OBJECT.
18%
Flag icon
A SERVICE is something that is done for a client on request.
18%
Flag icon
every design decision should be motivated by some insight into the domain.
18%
Flag icon
The ideas of high cohesion and low coupling, often thought of as technical metrics, can be applied to the concepts themselves. In
18%
Flag icon
MODULES are part of the model, and they should reflect conc...
This highlight has been truncated due to consecutive passage length restrictions.
18%
Flag icon
For every traversable association in the model, there is a mechanism in the software with the same properties.
18%
Flag icon
There are at least three ways of making associations more tractable. 1. Imposing a traversal direction 2. Adding a qualifier, effectively reducing multiplicity 3. Eliminating nonessential associations
18%
Flag icon
Understanding the domain may reveal a natural directional bias.
18%
Flag icon
It captures the understanding that one direction of the association is much more meaningful and important than the other.
Richard Faust
focalidade da direcao do relacionamento
18%
Flag icon
This qualifier reduces the multiplicity to one-to-one,
18%
Flag icon
Consistently constraining associations in ways that reflect the bias of the domain not only makes those associations more communicative and simpler to implement, it also gives significance to the remaining bidirectional associations.
18%
Flag icon
the ultimate simplification is to eliminate an association altogether, if it is not essential to the job at hand or the fundamental meaning of the model objects.
19%
Flag icon
but whatever the particular rules, as constraints on associations are discovered they should be included in the model and implementation.
19%
Flag icon
They make the model more precise and the implementation easier to maintain.
19%
Flag icon
Many things are defined by their identity, and not by any attribute.
19%
Flag icon
Am I the same person I was at age five? This kind of metaphysical question is important in the search for effective domain models. Slightly rephrased: Does the user of the application care if I am the same person I was at age five?
19%
Flag icon
A conceptual identity has to be matched between multiple implementations of the objects, its stored forms, and real-world actors such as the phone caller.
19%
Flag icon
the fundamental concept of an ENTITY is an abstract continuity threading through a life cycle and even passing through multiple forms.
19%
Flag icon
An object defined primarily by its identity is called an ENTITY.
19%
Flag icon
not all objects in the model are ENTITIES, with meaningful identities.
19%
Flag icon
Consider transactions in a banking application. Two deposits of the same amount to the same account on the same day are still distinct transactions, so they have identity and are ENTITIES. On the other hand, the amount attributes of those two transactions are probably instances of some money object. These values have no identity, since there is no usefulness in distinguishing them.
20%
Flag icon
The model must define what it means to be the same thing.
20%
Flag icon
Rather than focusing on the attributes or even the behavior, strip the ENTITY object’s definition down to the most intrinsic characteristics, particularly those that identify it or are commonly used to find or match it.
20%
Flag icon
Add only behavior that is essential to the concept and attributes that are required by that behavior.
20%
Flag icon
Beyond identity issues, ENTITIES tend to fulfill their responsibilities by coordinating the operations of objects they own.
Richard Faust
crc
20%
Flag icon
When the ID is automatically generated, the user may never need to see it.
20%
Flag icon
Finally, there are cases in which a generated ID is of interest to the user.
21%
Flag icon
Tracking the identity of ENTITIES is essential, but attaching identity to other objects can hurt system performance, add analytical work, and muddle the model by making all objects look the same.
21%
Flag icon
Software design is a constant battle with complexity. We must make distinctions so that special handling is applied only where necessary.
21%
Flag icon
VALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.
21%
Flag icon
“Address” a VALUE OBJECT? Who’s Asking?
21%
Flag icon
VALUE OBJECTS are often passed as parameters in messages between objects.
21%
Flag icon
They are frequently transient, created for an operation and then discarded. VALUE OBJECTS are used as attributes of ENTITIES (and other VALUES).
21%
Flag icon
When you care only about the attributes of an element of the model, classify it as a VALUE OBJECT. Make it express the meaning of the attributes
21%
Flag icon
In large systems, this kind of effect can be multiplied by thousands, and such an optimization can make the difference between a usable system and one that slows to a crawl, choked on millions of redundant objects. This is just one example of an optimization trick that is not available for ENTITIES.
21%
Flag icon
Many of the distinctions we are making in the model cannot be explicitly declared in the implementation with most current tools and programming languages.
21%
Flag icon
When a VALUE OBJECT is designated immutable in the design, developers are free to make decisions about issues such as copying and sharing on a purely technical basis, secure in the knowledge that the application does not rely on particular instances of the objects.
22%
Flag icon
Avoiding unnecessary constraints in a model leaves developers free to do purely technical performance tuning.
22%
Flag icon
This technique of storing multiple copies of the same data is called denormalization and is often used when access time is more critical than storage space or simplicity of maintenance.