Chapter 1
-
D: Both A and C are correct. Only core subdomains provide competitive advantage.
-
B: All companies in a given industry can use the same solutions for generic subdomains.
-
A: Core subdomains are functionalities in which the company aims to excel, compared to its competitors. It requires iterative design to find the best solution. Moreover, as the competitors are catching up, core subdomains change and evolve to stay ahead of the competition.
-
C: Domain experts have a deep understanding of the specific business domain, its processes, rules, and needs.
Chapter 2
-
B: The primary purpose of ubiquitous language is to bridge the gap between various stakeholders, including technical and business teams, to foster a shared understanding of the business functionality among all stakeholders.
-
D: All of the project’s stakeholders need to communicate in a ubiquitous language. As a result, all need to be able to contribute their knowledge to make it more efficient.
-
D: A ubiquitous language should be used in a project’s documentation-related communication. That includes in-person conversations, documentation, code, tests, and others.
-
A: Ubiquitous language should be adapted and refined as the team’s understanding of the business domain deepens.
Chapter 3
- B: Subdomains are identified during the analysis of the business domain. Bounded contexts, on the other hand, are designed according to different factors.
D: A bounded context defines the context in which a model is valid, all of its contents share the same lifecycle, and only one team should be in charge of it (ownership).
-
D: Bounded contexts are design decisions that should be decided according to the project’s context.
-
D: A bounded context can be owned by one team only, but the same team can be in charge of multiple bounded contexts.
Chapter 4
-
D: Duplicating the functionality of a core subdomain in multiple bounded contexts will thwart the possibility of evolving it in the future, as all of the (frequent) changes will have to be coordinated across the two bounded contexts.
-
A: The goal of the anticorruption layer pattern is to protect the downstream model. It is especially relevant if the downstream is a core subdomain.
-
A: The goal of the open-host service pattern is to protect consumers from changes in the upstream bounded context. It is especially relevant if the upstream is a core subdomain, because they are highly volatile.
-
B: The shared kernel pattern allows multiple teams to co-evolve a part of a model belonging to one bounded context. Since this pattern is the exception from the rule rather than the rule itself, it should be used sparingly and its use must be justified.
Chapter 5
-
C: The transaction script and active record patterns are suitable for implementing simple business logic. In a core subdomain the business logic is more complicated than these patterns can accommodate.
-
D: Both the transaction script and active record patterns are suitable for implementing simple business logic.
-
D: All of the above issues are possible:
-
If the execution fails after line 6, the caller retries the operation, and the same agent is chosen by the FindLeastBusyAgent method, the agent’s ActiveTickets counter will be increased by more than 1.
-
If the execution fails after line 6 but the caller doesn’t retry the operation, the counter will be increased, while the ticket itself won’t be created.
-
If the execution fails after line 12, the ticket is created and assigned, but the notification on line 14 won’t be sent.
-
-
B: For example, if the execution fails after line 12 and the caller retries the operation and it succeeds, the same ticket will be persisted and assigned twice.
Chapter 6
-
C: Value objects are immutable, and can contain both data and behavior.
-
B: Aggregates should be designed to be as small as possible, as long as the business domain’s data consistency requirements are intact.
-
B: Limiting changes to an aggregate instance to a single database transaction is another way to ensure that all the information that’s required to be strongly consistent is included in the aggregate’s boundary.
-
A & C: Value objects describe entities’ properties and an aggregate contains one or more entities.
-
B: Both active records and aggregate can contain behavior. However, the aggregate pattern enforces that all the related behavior resides in its boundary.
Chapter 7
-
A: Domain events use value objects to describe what has happened in the business domain.
-
C: Multiple state representations can be projected and you can always add additional projections in the future.
-
B & C: Both types of aggregates can emit domain events, but only event-sourced aggregates ensure that a domain event is emitted for all state transitions.
-
A: The ticket lifecycle algorithm is a good candidate to be implemented as an event-sourced domain model. Generating domain events for all state transitions can make it more convenient to project additional state representations optimized for the fraud detection algorithm and the support autopilot functionality.
Chapter 8
-
A & C: Although the layered architecture supports the active record pattern, there are cases when the CQRS pattern can be beneficial as well.
-
B & C: Both the ports and adapters and CQRS patterns abstract infrastructural concerns away from the business logic.
-
C: Infrastructural components should reside in the infrastructure layer.
-
A & D: Asynchronous projections are easier to scale than the synchronous ones, and a command can return strongly consistent information to the caller.
-
B: Working with multiple models projected by the CQRS pattern doesn’t contradict the bounded context’s requirement of being a model boundary, since only one of the models is defined as the source of truth and is used for making changes in the aggregates’ states.
Chapter 9
-
B & C: The anticorruption layer transforms the model exposed by the upstream, into a model that is better suited to the downstream bounded context’s needs. The open-host service, on the other hand, transforms the model used internally by the upstream bounded context into a model tailored for integration with consumers.
-
B: The outbox pattern should be used when you need to reliably publish messages.
-
A: The outbox pattern can be used to implement asynchronous execution of external components. For example, it can be used for sending email messages.
-
A & D: A process manager requires explicit instantiation, while a saga is executed when a relevant domain event is published. The process manager pattern is suitable for complex business workflows, while the saga pattern lends itself towards simpler processes.
Chapter 10
-
D: Since this is a core subdomain that requires deep analytics, the event-sourced domain model is the optimal way to model its business logic. CQRS pattern is needed to generate additional models and allow flexible querying of the data, and unit tests suit best for testing behavior of the aggregates.
-
A: The shifts can be modeled as active records, working in the layered architectural pattern. The testing strategy should primarily focus on integration tests.
-
D: The business logic can be implemented as a transaction script, organized in a layered architecture. From a testing perspective, it’s worth concentrating on end-to-end tests, verifying the full integration flow.
Chapter 11
-
A: Partnership to customer–supplier (conformist, anticorruption layer, or open-host service). As an organization grows, it can become more challenging for teams to integrate their bounded contexts in an ad hoc fashion. As a result, they switch to a more formal integration pattern.
-
A & B: The development teams struggle to cooperate because bounded contexts go separate ways when the cost of duplication is lower than the overhead of collaboration. Additionally, the separate ways pattern can be used for supporting and generic subdomains.
-
B & C: A supporting subdomain turning into a core subdomain, will make it harder to implement the new requirements—which will come at a much higher rate than when it was a supporting one.
-
A & C: Either a supporting or a generic subdomain turning into a core subdomain implies increased competitive advantage, and thus, a new business opportunity.
-
B: WolfDesk’s new data centers around the world would require considerable efforts to rollout, and would provide competitive advantage over other players in the field.
Chapter 12
-
D: All stakeholders having knowledge of the business domain that you want to explore.
-
All of the answers are correct: All the answers are sound reasons to facilitate an EventStorming session.
-
All of the answers are correct: All the answers are possible outcomes of an EventStorming session. The outcome you should expect to get depends on your initial purpose for facilitating the session.
Chapter 13
-
B: Analyzing the business domain and identifying the relevant subdomains and their types will allow you to make better design decisions when refactoring the codebase.
-
A & B: Sharing a database across multiple bounded contexts, as well duplicating the functionality of a core subdomain both contradict the principles of domain-driven design. However, since the strangler pattern implies that this is a temporary design needed to retire the legacy bounded context, it’s a viable migration process.
-
Selecting both answers is correct: It’s safe to introduce big changes gradually. In this case, refactoring to a state-based aggregate first allows you to focus on the correct transactional boundaries and then apply event sourcing next.
Chapter 14
-
A: All microservices are bounded contexts, but not all bounded contexts are microservices.
-
D: A design should manage the complexity of a system. Properly encapsulating knowledge of the business domain in the relevant services’ boundaries allows you to manage both the local and global complexities.
-
C: The range between the widest possible bounded contexts and microservices is the safe zone allowing the avoidance of conflicting models and accidental global complexity.
-
D: Depending on the interactions between the aggregates, it can be beneficial or not to expose aggregates as microservices.
Chapter 15
-
A & B: EDA describes the events flowing across the components of a system, while event sourcing describes events used for modeling a business domain (within a bounded context).
-
B: Event-carried state transfer messages are, in a sense, an event-based state replication mechanism.
-
A: The open-host service pattern requires the upstream bounded context to define an integration-specific model that will be exposed to the consumers. Such a model should also differentiate between public events that are exposed to the consumers, and private events that are used internally within the bounded context.
-
B: Asking the consumers to issue a synchronous call to get data can make it possible to ensure that S2 will read the last written data.
Chapter 16
-
A & C: OLAP models have to be optimized for reading data, while OLTP—for writing.
-
C: The open-host service pattern requires the upstream bounded context to define one or more integration specific models. Such models can share analytical data used in the data mesh architecture.
-
C: CQRS allows representing data in multiple persistent models, making it convenient to generate and share analytical models.
-
A: Domain-driven design’s bounded contexts are the closest to data mesh’s domain.