Events are not just for notifications Greg Young Qcon London Agenda - - PowerPoint PPT Presentation

events are not just for notifications
SMART_READER_LITE
LIVE PREVIEW

Events are not just for notifications Greg Young Qcon London Agenda - - PowerPoint PPT Presentation

Events are not just for notifications Greg Young Qcon London Agenda Event Storage Testing With Events Versioning Performance Traveling Through Space and Time Let Everyone Run to Airport to Catch Flights Line Items (n) Purchase Order


slide-1
SLIDE 1

Events are not just for notifications

Greg Young Qcon London

slide-2
SLIDE 2

Agenda

Event Storage Testing With Events Versioning Performance Traveling Through Space and Time Let Everyone Run to Airport to Catch Flights

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6

Purchase Order Line Items (n) Shipping Information

slide-7
SLIDE 7

Cart Created Line Item Added Address Added Line Item Added Line Item Added

slide-8
SLIDE 8

Cart Created Line Item Added Address Added Line Item Added Line Item Added Cart Object

slide-9
SLIDE 9
slide-10
SLIDE 10

Cart Created Line Item Added Address Added Line Item Added Line Item Added Line Item Removed Address Added

slide-11
SLIDE 11

Cart Created Line Item Added Address Added Line Item Added Line Item Added New Cart Object (Looks totally different)

slide-12
SLIDE 12

6 5 4 3 2 1 7

slide-13
SLIDE 13

5 snap 4 3 2 1 6

slide-14
SLIDE 14

Base { public IEnumerable<Event> GetUncommittedChanges() { return _changes; } public void MarkChangesAsCommitted() { _changes.Clear(); } public void LoadsFromHistory(IEnumerable<Event> history) { foreach (var e in history) ApplyChange(e, false); } }

slide-15
SLIDE 15

Base { protected void ApplyChange(Event @event) { ApplyChange(@event, true); } private void ApplyChange(Event @event, bool isNew) { this.AsDynamic().Apply(@event); if(isNew) _changes.Add(@event); } }

slide-16
SLIDE 16

private void Apply(InventoryItemDeactivated e) { _activated = false; } public void Deactivate() { if(!_activated) throw new InvalidOperationException("already deactivated"); ApplyChange(new InventoryItemDeactivated(_id)); }

slide-17
SLIDE 17

Derived { protected void ApplyChange(Event @event) { ApplyChange(@event, true); } private void ApplyChange(Event @event, bool isNew) { this.AsDynamic().Apply(@event); if(isNew) _changes.Add(@event); } }

slide-18
SLIDE 18
slide-19
SLIDE 19

Overdraw attempts are rejected Given An account with $100 When A debit is requested for $101 Then An InsufficientBalanceException is thrown

slide-20
SLIDE 20

Overdraw attempts are rejected Given An account was created. An initial deposit was made for $100 When A debit is requested for $101 Then An InsufficientBalanceException is thrown

slide-21
SLIDE 21

Overdraw attempts are rejected Given A series of events When A command Then A series of events

slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24

Not allowed to take money out of an overdrawn account Given An account was created. An initial deposit was made for $100 $100 was withdrawn When A debit is requested for $20 Then An InsufficientBalanceException is thrown

slide-25
SLIDE 25

Traveling Through Time.

slide-26
SLIDE 26