マイクロサービスのためのEvent Storming
Event Stormingを協働手法として活用し、ドメインイベントを発見して、SaaSの複雑なビジネスプロセスをモデル化します。
「マイクロサービスのためのEvent Storming」はCoddyKit上の無料SaaS Architecture & Startup Engineeringレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSaaS Architecture & Startup Engineering学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 SaaS Architecture & Startup Engineeringコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
What is Event Storming?
Event Storming is a fun, collaborative workshop technique to understand complex business domains. It helps teams visualize how things happen in a system.
Imagine a room full of sticky notes! Teams map out a business process by focusing on the "events" that occur, making it easier to see the big picture.
Why Event Storm for Microservices?
For SaaS, especially with microservices, understanding domain boundaries is key. Event Storming helps:
- Break down monoliths: Clearly identifies areas to split.
- Define service boundaries: Groups related events and actions into potential services.
- Improve communication: Gets everyone on the same page, from business to tech.
The Event Storming Canvas
Event Storming uses different colored sticky notes to represent various elements of your domain:
- Orange: Domain Events (what happened?)
- Blue: Commands (what triggers an event?)
- Yellow: Aggregates (who performs a command?)
- Green: Read Models (how users view data?)
- Purple: Policies (rules reacting to events)
Step 1: Discovering Domain Events
This is the starting point! Think about "what happened?" in your business process. Events are facts from the past, always written in past tense.
Examples:
OrderPlacedPaymentReceivedUserRegisteredSubscriptionCancelled
These are the core truths of your system.
Coding a Simple Event
While Event Storming is visual, the events we discover often translate into code. Here's how a simple OrderPlaced event might look in a Java application:
Try running this example to see how an event could be represented and "published" (here, just printed).
public class OrderPlacedEvent {
private String orderId;
private double amount;
private String customerId;
public OrderPlacedEvent(String orderId, double amount, String customerId) {
this.orderId = orderId;
this.amount = amount;
this.customerId = customerId;
}
public String toString() {
return "OrderPlacedEvent {id='" + orderId + "', amount=" + amount + ", customerId='" + customerId + "'}";
}
public static void main(String[] args) {
OrderPlacedEvent event = new OrderPlacedEvent("ORD123", 99.99, "CUST456");
System.out.println("New event generated: " + event.toString());
}
}Step 2: Identifying Commands
After events, we look for commands. A command is an explicit request to do something, which usually leads to an event (or multiple events).
Ask: "What action caused this event to happen?" Commands are usually imperative verbs.
PlaceOrder(leads toOrderPlaced)ProcessPayment(leads toPaymentReceived)RegisterUser(leads toUserRegistered)
Step 3: Pinpointing Aggregates
Aggregates are the "who" or "what" that receives a command and produces an event. They are transactional consistency boundaries – meaning everything within an aggregate changes together.
Think of them as the "model" or "entity" in your code that holds state and enforces business rules.
Orderaggregate handlesPlaceOrder.PaymentProcessorhandlesProcessPayment.
Step 4: Read Models & Policies
Read Models (Green): These are how users or other systems query information. They are optimized for reading, often denormalized views built from events.
Policies (Purple): These are business rules that react to events. For example, "when an OrderPlaced event occurs, then send a confirmation email."
From Storm to Bounded Contexts
As you map out your domain, you'll see natural clusters of events, commands, and aggregates. These clusters often define your Bounded Contexts.
A Bounded Context is a logical boundary within which a specific domain model is defined and applicable. This is crucial for designing independent microservices!
Benefits Beyond Design
Event Storming doesn't just help with technical design; it fosters a shared understanding across the entire team.
- Shared Language: Everyone uses the same terms.
- Knowledge Transfer: New team members quickly grasp complex flows.
- Problem Identification: Uncovers hidden assumptions and issues early.
Quick Check
Event Storming uses different colored sticky notes to represent various domain elements. Match the sticky note color to its correct description.
Recap: Event Storming Toolkit
You've learned that Event Storming is a powerful, visual technique to understand complex domains. By focusing on Domain Events, you can identify Commands, Aggregates, Read Models, and Policies.
This collaborative approach helps in defining clear Bounded Contexts, making it an invaluable tool for designing robust and scalable microservices in your SaaS architecture.
よくある質問
「マイクロサービスのためのEvent Storming」レッスンは無料ですか?
はい。「マイクロサービスのためのEvent Storming」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、SaaS Architecture & Startup Engineeringコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 SaaS Architecture & Startup Engineeringコースには全4レッスンが含まれています。
「マイクロサービスのためのEvent Storming」で何を学びますか?
Event Stormingを協働手法として活用し、ドメインイベントを発見して、SaaSの複雑なビジネスプロセスをモデル化します。 ブラウザで直接実行するハンズオンコードでSaaS Architecture & Startup Engineeringを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
SaaS Architecture & Startup Engineeringを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのSaaS Architecture & Startup Engineeringは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「マイクロサービスのためのEvent Storming」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このSaaS Architecture & Startup Engineeringレッスンでコードを書いて実行できますか?
はい。すべてのSaaS Architecture & Startup Engineeringレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Bounded ContextとAggregate
- マイクロサービスのためのEvent Storming
- 戦略的設計とコンテキストマッピング
- ユビキタス言語とドメインモデル