Event Sourcing stores the state of a business entity as a sequence of state-changing events. Whenever the state of a business entity changes, a new event is appended to the list of events. The current state is reconstructed by replaying the events.
A Bank Account. Instead of storing 'Balance: 100', we store [Deposited 50, Withdrew 10, Deposited 60]. The balance is calculated on the fly.
# Code Concept for Event Sourcing\n# This pattern is architectural.\n\nclass Service:\n def execute(self):\n # Implementation logic\n pass