What is a Domain Event?
In Event Storming, a collaborative domain modeling technique, the concept of a Domain Event plays a central role. It represents something significant that happens in the business domain, often marking a state change that is important to the business or system. Here’s a more detailed breakdown of Domain Events within the context of Event Storming:
1. What is a Domain Event?
- A Domain Event is a notable occurrence in the business domain that is meaningful to business experts and stakeholders.
- It captures something that has happened in the past, typically denoted in the past tense (e.g., Order Placed, Payment Received).
- Domain Events are at the core of how a system reacts and responds to changes over time.
2. Representation in Event Storming
- Domain Events are visually represented as orange sticky notes during an Event Storming session.
- They are placed on a timeline, where the flow of time runs from left to right, helping participants map out the sequence of events that happen within the domain.
- They provide an intuitive way to describe the behavior of the system and how it evolves through various interactions.
3. Role in Understanding the Domain
- Domain Events serve as the foundation for understanding the business processes.
- By focusing on these key events, you can map how the system interacts with users, other systems, or internal processes.
- Events help stakeholders and developers align their understanding of how the business operates.
4. Triggering Commands and Reactions
- Often, Domain Events are triggered by commands (explicit actions taken by users or systems, e.g., Place Order, Ship Product).
- A Domain Event might lead to further reactions or trigger subsequent commands, which can lead to more events. This chain of events helps define the flow of business processes.
5. Key Characteristics
- Immutable: Once a Domain Event occurs, it cannot be changed (because it has already happened).
- Observable: It represents something that has observable importance to the domain or business stakeholders.
- Past Tense: Described in terms of what has happened rather than what is happening.
- Business-focused: It is expressed in the language of the business, not in technical terms.
6. Examples of Domain Events
- In an e-commerce system:
- Order Placed: Represents a customer placing an order.
- Payment Processed: Indicates that the payment was successfully processed.
- Order Shipped: Signifies that the order was dispatched.
- In a banking system:
- Funds Deposited: Indicates that money was added to an account.
- Account Opened: Reflects the creation of a new account.
7. Benefits of Using Domain Events in Event Storming
- Common Language: Helps both technical and non-technical stakeholders communicate using a shared vocabulary.
- Focus on Behavior: Rather than concentrating on technical solutions, it brings the focus on the behavior of the system and how it reacts to key events.
- Evolutionary: Captures the changes and progression of the business processes over time, which can then be translated into technical implementations, such as event-driven architectures.
8. From Domain Event to System Design
- Domain Events often guide system design, especially in event-driven architectures where systems react to state changes by publishing and consuming events.
- These events can become a key part of system documentation and an integral component of software design, reflecting the business's actual processes.
In Event Storming, understanding and capturing Domain Events is crucial for mapping out a business process and identifying how the system interacts with various actors and other systems. It is a key concept for bridging the gap between business understanding and software design.