Thinking in Events
This article explores the core philosophy behind event sourcing — shifting from thinking in terms of current state to thinking in terms of events as the fundamental unit of truth in a system. It explains how modeling business processes as immutable events enables better auditability, temporal queries, and system resilience.
背景メモ
- Event Sourcing(イベントソーシング)は、アプリケーションの状態を「現在の値」ではなく「発生した出来事(イベント)の記録」として保存する設計手法。通常のデータベースが「今の残高は100円」と上書きするのに対し、イベントソーシングでは「口座開設」「50円入金」「30円引き出し」といった履歴を全て残す。
- これにより、過去の任意時点の状態再現、監査証跡の完全性、システム障害時の復旧容易性などの利点があるが、設計思想が従来のCRUD(作成・読取・更新・削除)と根本的に異なるため学習コストが高い。
- EventsourcingDBはこのアプローチに特化したデータベース製品。本記事は「イベント的に考える」という思考様式の解説であり、概念理解を助ける入門的位置づけ。
- 対象読者は、イベントソーシングに興味はあるが「結局どういう思考法なのか」を掴み切れていない開発者やアーキテクト。