DDD Flashcards

1
Q

What is the key to controlling complexity in software development?

A

A good domain model that goes beyond surface vision and introduce an underlying structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why should concepts not be separated from their implementation in domain modelling?

A

The greatest value a domain model provides a ubiquitous language that ties domain experts and technologists together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is domain driven design in large strokes?

A

Its both a way of thinking and a set of priorities, aimed at accelerating software projects that have to deal with complicated domains.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does extreme programming view design?

A

It is important. But it resists upfront design. It rather puts effort into a project’s ability to change course rapidly. When we can change course rapidly we can settle with the simplest thing that could work, and then continuously refactor the solution. This is an antidote to analysis paralysis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a model?

A

A model is a selectively simplified and consciously structured form of knowledge. An appropriate model makes sense of information and focuses it on a problem.

A domain model is a rigorously organized and selective abstraction of the knowledge inside a domain experts head. Domain modelling is not a matter of making as realistic as possible, rather a loosely representation to a particular purpose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the heart of software?

A

Its ability to solve domain-related problems for its users. All other features support this basic purpose. Complexity at the heart of software has to be tackled head-on. To do otherwise is to risk irrelevance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the ingredients of effective modeling?

A
  1. Binding the model and the implementation - crude prototype users can see and comment on.
  2. Cultivating a language based on the model.
  3. Developing a knowledge-rich model. The model was not just a data schema; it was integral to solving a complex problem. It captures knowledge of various kinds.
  4. Distilling the model. Concepts are dropped from the model when they are not important or useful. A new model can be made to concepts that do not belong.
  5. Brainstorming and experimenting.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What role do prototypes and early versions play when modelling the domain?

A

Feed experience back into the team, change interpretations and validate hypothesis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the disadvantages of simply receiving a feature list from experts and just build them?

A

Developers only learn what the application should do and not the fundamental principles behind it. The application will never arrive at a point where powerful features unfold as corollaries to older features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why can even what looks like a simple domain turn out complex?

A

Domain experts are usually not aware of how complex their mental processes are. They navigate a lot of rules, reconcile contradictions and fill in the gaps with common sense.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What advantages are there to using an explicit model and design to model business rules?

A
  1. In order to bring the design to this stage, the programmers and everyone else involved will have to come to understand the nature of the business rules as a distinct and important business rule, not just and obscure calculation.
  2. Programmers can show business experts technical artifacts, even code, that should be intelligible to domain experts. Thereby, closing the feedback loop.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the dangers of translation between domain experts and developers?

A

Translation muddles model concepts, which may lead to destructive refactoring of code. The indirectness of translations makes it hard to develop clear modules that need to fit together since developers and domain experts may interpret translation in their own way.

A project faces serious problems when its language is fractured (developers and domain experts do not understand each other).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the vocabulary of a ubiquitous language ?

A

It includes that names of classes and prominent operations. The language includes terms to discuss rules that have been made explicit in the model.

With a ubiquitous language, the model is not just a design artifact. It becomes integral to everything the developers and domain experts do together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is a ubiquitous language formed?

A

Cultivated in the intersection of jargons between developers and domain experts. Conversations between developers, discussions among domain experts and expressions in code are all based on the same language, derived from a shared domain model. That is updated and evolve over time as developers process information from domain experts and domain experts accept/protest interpretations of their information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the limits of code as a “design document/documentation”?

A

It can overwhelm the reader with detail. The behavior is not always obvious and the meaning/intention/reason for a behavior can be hard to convey.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the problem with only using an analysis model (analyzing the problem domain to gain understanding)?

A

Some knowledge crunching happens during such analysis, but most of it is lost when coding begins, when developers are forced to come up with new abstractions for the design.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the danger of viewing domain analysis and development as separate processes?

A

If we think of analysis and development as separate processes then the connection between the two will loosen and its impossible to maintain the relationship as the design changes. Additionally, developers might not have adequate access to domain experts.

Insights gained in the two do not feed into the other.

18
Q

What is the specification pattern?

A

The specification pattern is about encapsulating a piece of domain knowledge into a single unit (called specification) which we can then reuse during:
1. data retrieval
2. in-memory validation (controversial because of “always-valid model guideline”) but can be used to work on-top of valid objects to perform validations before performing certain domain operations.
3. creation of new objects
4. bulk updates, combined with a command that uses the preconditions from the specification.

19
Q

What is the command pattern?

A

The command pattern encapsulates the knowledge of how to update domain model data. But the term is overloaded a means different things in different contexts:
CQRS (command-query-responsibility-segregation): a command is a class that represents an operation.
CQS (command-query-separation): any method that creates a side effect.
GoF (Gang of Four): a command is a class that encapsulates all information needed to perform an action.

20
Q

What is the always-valid domain model guideline?

A

Says that domain model class should guard themselves from ever becoming invalid. This means validating input before instantiating objects.

21
Q

Why is it a bad idea to separate workers into modellers and programmers when working with a model-driven design?

A

If developers do not feel responsible for the model and do not realize how their refactoring changes the model, then the model could become weaker. Modellers loose understanding of the constraints on implementations their model results in.

22
Q

Why is it necessary to isolate the domain?

A

The part of the software that actually deals with problems from the domain is usually only a small portion. We need to decouple this central part of the system to avoid confusing the domain concepts with other concepts related only to software technology.

23
Q

What are some ways architectural frameworks can get in the way of development?

A

By making too many assumptions that constrain domain design choices or by making the implementation so heavyweight that development slows down.

A lot of the downsides of frameworks can be avoided by applying them selectively to solve difficult problems without looking for a one-size-fits-all solution. Elaborate frameworks can straitjacket application developers.

24
Q

What is the main criteria for an architecture in order to support domain-driven design?

A

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.

25
Q

What are the three patterns of model elements that express the model?

A

Entities, value objects and services.

26
Q

How do we distinguish between entities and value objects?

A

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.

27
Q

When should aspects of a model be a service?

A

There are aspects of the domain that are more clearly expressed as actions or operations, rather than as objects. These are best expressed as services.

A service is something that is done for a client on request.

28
Q

What is an entity?

A

An object that is defined primarily by its identity. They have life cycles that can change their form and content, but a thread of continuity must be maintained.

29
Q

What is the most basic responsibility of an entity?

A

To establish continuity so that behavior can be clear and predictable. Strip entities down to the most intrinsic characteristics, in particular those that identify it or are commonly used to find or match it. Add only behavior that is essential and attributes to support the behaviors

Look to remove behavior and attributes into other objects associated with the core entity.

30
Q

Why are all objects in the domain model not simply entities?

A

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.

Software design is a constant battle with complexity. We must make distinctions so that special handling is applied only where necessary.

31
Q

What are value objects?

A

An object that represents a descriptive aspect of the domain with no conceptual identity.

When we only care about the attributes of an element of the model, we classify it as a value object. Treat the value object as immutable. Do not give it an identity and avoid the design complexities necessary to maintain entities.

Colors are an example of value objects.

32
Q

How do we isolate the domain from external areas?

A

With a layered architecture. When domain-related code is mixed with the other layers, it becomes extremely difficult to see and think about.

Concentrate all the code related to the domain model in one layer and isolate it from the user interface, application and infrastructure code.

A common architectural solution for domain-driven designs contain four conceptual layers:
- User interface
- Applicaiton layer: thin layer which coordinates the application activity. Does not contain bussiness logic or hold state of business objects. But it can hold state about an application task.
- Domain layer: Contains information about the domain
- Infrastructure layer: Supporting layer for all the other layers. It provides communication between layers and implements persistence for business objects.

33
Q

How do we express the domain model?

A
  1. Services: Does not have an internal state, and its purpose is to provide functionality for the domain. A service usually becomes a point of connection for many objects. This is one of the reasons why service behavior should not be included into the domain objects.
  2. Entities: Objects that have an identity which spans the life of a system and beyond.
  3. Value objects: Objects that are used to describe certain aspects of a domain, and does not have an identity.
34
Q

What is the golden rule concerning value objects?

A

If value objects are shareable, they should be immutable. Value objects should be kept thin and simple.

35
Q

Why is a high degree of coupling between objects are sign of poor design?

A

Difficult to read, understand and change.

36
Q

Should we create services for each operation in the domain model?

A

No. A service should not replace the operation which normally belongs on domain objects. We should only create a service when an operations stands out as an important concept in the domain.

37
Q

What are the three characteristics of a service?

A
  1. The operation performed by the service refers to a domain concept which does not naturally belong to an Entity or Value object.
  2. The operation performed refers to other objects in the domain.
  3. The operation is stateless.
38
Q

What are the two types of cohesion?

A
  1. Communication cohesion: achieved when parts of the module operate on the same data.
  2. Functional cohesion: achieved when all parts of the module work together to perform a well-defined task.
39
Q

What patterns do we use to manage the life cycle of a domain object?

A

Aggrefates: used to define object ownership and boundaries.
Factories and repositories: user to deal with object creation and storage.

40
Q

What are aggregates?

A

It is a behavioural boundary in the domain model. The central piece of an Aggregate is the Aggregate Root. It is the high-level API that provides access to the functionality within the Aggregate (other entities).

41
Q

What is a repository?

A

Class that encapsulate all the logic needed to obtain object references.