Skip to main content
InterviewHubPRO
Section Overview
Q20

Question 20 of 50

Part 2: Behavioral Patterns & Communication (11 - 24)

40%
Design Patterns (GoF) (50 Qs)•Part 2: Behavioral Patterns & Communication (11 - 24)

What is the Event Sourcing Pattern?

junior LevelBehavioral

In Simple Words: Instead of storing only the current state of an entity, Event Sourcing stores the entire append-only sequence of immutable domain events that led to that state:

  • Bank Account Balance is not stored as $500.
  • Instead, the database stores:
    1. AccountCreated (+$0)
    2. MoneyDeposited (+$1000)
    3. MoneyWithdrawn (-$500)
  • Benefits: Perfect 100% audit log, time-travel debugging (replay events to inspect state at any second in history), zero update locks.