SlideShare ist ein Scribd-Unternehmen logo
1 von 231
Downloaden Sie, um offline zu lesen
As time goes by…
Episode 2: technical challenges of bi-temporal Event Sourcing
@tpierrain
t
If you want
to win…
Tweet like hell on…
#newCrafts
REQUIREMENTS
—
REQUIREMENTS
—
Understand their former decisions
REQUIREMENTS
—
Understand their former decisions

Fix their perception of the world
retroactively
REQUIREMENTS
—
Understand their former decisions

Fix their perception of the world
retroactively

(Re)produce reports in and from the past
REQUIREMENTS
—
Understand their former decisions

Fix their perception of the world
retroactively

(Re)produce reports in and from the past 

Forecast ”events” in the future

REQUIREMENTS
—
Understand their former decisions

Fix their perception of the world
retroactively

(Re)produce reports in and from the past 

Forecast ”events” in the future

Strong audit trail
They needed a time machine
Event Sourcing baby!
Event Sourcing 101
Remember your banking account?
Event Sourcing
Event Sourcing
Final state of the world
All changes since 

the beginning
All changes since the beginning
=
A list of events
Event [ɪˈvent]

Describes a fact, something that have happened.
Usually expressed in a past-tense form.

(e.g.: TalkStarted)
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Properties / Members
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Evolution functions
Change state
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Constructor
Change state
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Decision functions
Don’t change state
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Decision functions
Don’t change state
Event-Sourced business objects
Event-Sourced business objects
public class Fund : EventSourcedAggregate
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public Fund(IEnumerable<Event> events)
{
foreach(var evt in events)
{
Apply(evt);
}
}
private Apply(FundRenamed event)
{
this.Name = event.FundNewName;
}
public IEnumerable<Event> Rename(string newName)
{
!// business logic and invariants checks HERE
!// Raise event(s)
return new[] { new FundRenamed(this.Id, newName) };
}
}
Decision functions
Don’t change state
Evolution functions
Change state
Projection [prəˈjekSHən]

Deriving a current state from a stream of events
Fund myFund = fundRepository.GetById(fundId, projectedAt);
Event-Sourcing in motion
Guid
timestamp
Fund myFund = fundRepository.GetById(fundId, projectedAt);
Now
b7f3ddfb-2cb5….
Event-Sourcing in motion
t
Fund
id:
Name:
Creation date:
Management Company:
Shares:
Event-Sourcing in motion
t
FundCreated

“super yield ”
Jan 1st

2016
Fund
id: b7f3ddfb -2cb5….
Name: super yield
Creation date: Jan 1st
2016
Management Company:
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
ManagementCompanyAssigned

“BNP”
Jan 30th

2016
Fund
id: b7f3ddfb -2cb5….
Name: super yield
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
Jan 30th

2016
FundRenamed

“Yield 2k22”
Apr 1st

2016
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
Jan 30th

2016
Apr 1st

2016
ShareAdded

“Part D”
Jun 2nd

2016
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Part D
Event-Sourcing in motion
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Part D
End of
Stream
>> <<t
Jan 1st

2016
Jan 30th

2016
Apr 1st

2016
Jun 2nd

2016
Event-Sourcing in motion
Projected at now
Ready to work
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Part D
The beauty of it
Pick the projection date you want ;-)
Project same Fund at Apr 1st 2016
(same stream of events)
Event-Sourcing in motion
t
Fund
id:
Name:
Creation date:
Management Company:
Shares:
Event-Sourcing in motion
t
FundCreated

“super yield ”
Jan 1st

2016
Fund
id: b7f3ddfb -2cb5….
Name: super yield
Creation date: Jan 1st
2016
Management Company:
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
ManagementCompanyAssigned

“BNP”
Jan 30th

2016
Fund
id: b7f3ddfb -2cb5….
Name: super yield
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
Jan 30th

2016
FundRenamed

“Yield 2k22”
Apr 1st

2016
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
Event-Sourcing in motion
t
Jan 1st

2016
Jan 30th

2016
Apr 1st

2016
Fund
id: b7f3ddfb -2cb5….
Name: Yield 2k22
Creation date: Jan 1st
2016
Management Company:
BNP
Shares:
We’re
done here
;-)
>> <<
Event-Sourcing in motion
Command [kəˈmɑːnd]

Triggers an action. Modify the state of the system
e.g.: RenameFund
Commands are used to take decisions and to raise events.
Commands are used to take decisions and to raise events.
Command
(RenameFund)
Aggregate
(Fund X)
Commands are used to take decisions and to raise events.
Command
(RenameFund)
Events
(FundRenamed)
Events are used to restore/change the state of our aggregates.
Aggregate
(Fund X)
so far so good?
😉
Specificities
of bi-temporal
event sourcing
& Challenges
Challenge #1
How to change what can’t be changed?

Challenge #1
- Events are immutable (facts)
- We save them in append-only streams (Event Store)
t
Q: How to retroactively change former mistaken events?

Q: How to insert forgotten events in the past (in the middle of
a stream)?
we don’t change events
we just add
more events
we don’t change events
we just add
more events
“One more thing…”
“One more thing…
All our events have…”
createdAt 


validFrom !-> when it applies
2 timestamps
createdAt 


validFrom !-> when it applies
2 timestamps
( bi-temporal)
Types of events
validFrom
createdAt
Classic event
Types of events
validFrom
createdAt
Classic event
validFrom createdAt
Retroactive event
Thus we can hide former events
Thus we can hide former events
t
Feb 1st

2016
Feb 3rd

2016
Feb 5th

2016
“new naaame”
“initial name”
Thus we can hide former events
t
Feb 1st

2016
Feb 3rd

2016
Feb 5th

2016
“new naaame”
“initial name”
“fixed name ;-)”
Thus we can hide former events
t
Feb 1st

2016
Feb 3rd

2016
Feb 5th

2016
“new naaame”
“initial name”
“fixed name ;-)”
Challenge #2
Forecasting “facts”?!?
Challenge #2
- Event Store stores “Events” ;-)
- Events are things that have already happened (facts)
t
Q: How to store things that have to happen in an Event Store?
Let’s store ”a Command (X) has just been Scheduled” events
validFromcreatedAt
“Command Scheduled” event“Command Scheduled” event
RenameFund
(Cmd)
validFromcreatedAt
CommandScheduled<RenameFund> event
RenameFund
(Cmd)
3 Types of events
3 Types of events
validFrom
createdAt
Classic event
3 Types of events
validFrom
createdAt
Classic event
validFrom createdAt
Retroactive event
3 Types of events
validFrom
createdAt
Classic event
validFrom createdAt
Retroactive event
validFromcreatedAt
“Command Scheduled” event
C
Our model
Challenge #3
How to project unsorted streams of
events?
Challenge #3
- With retroactive events, we have unsorted streams of events
- Some events may hide others
- Past may change at any time. Future too
t
Q: How to implement projections in such environment?
Let’s review some options
1 Forward-only projections with filters
1 Forward-only projections with filters
2 Sort - then - Apply events
1 Forward-only projections with filters
2 Sort - then - Apply events
3 Rebased Timelines with branches
1 Forward-only projections with filters
2 Sort - then - Apply events
3 Rebased Timelines with branches
too complicated
1 Forward-only projections with filters
2 Sort - then - Apply events
3 Rebased Timelines with branches
too complicated
not compliant with bigstreams of events
2 Sort - then - Apply events
3 Rebased Timelines with branches
too complicated
not compliant with bigstreams of events
1 Forward-only projections with filters
Challenge #4
How to provide multiple visions of the
same reality?

(operational - audit-trail)
Challenge #4
- 1 stream of events per aggregate instance
- We need to provide both an operational mode and an audit mode
t
Q: How to provide various points of view in our reality?
Thank you Greg!
2 projection modes
/ As AtAs Of "
/ As AtAs Of
As we should 

have known
"
/ As AtAs Of
As we should 

have known
Patches inside
"
/As Of
As we should 

have known
Patches inside
As At
As we knew
(at the time)
"
/ As At
As we knew
(at the time)
Audit trails
As Of
As we should 

have known
Patches inside
"
/ As At
As we knew
(at the time)
Audit trails
As Of
As we should 

have known
Patches inside
"
Since we have a model,
let’s find some exemples
Our main usages (patches included)
As Of - as we should have known
As Of - as we should have known
Imagine a stream of 3 events for a Fund
1.Let’s see how those events have been
saved over the time
As Of - as we should have known
t
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
As Of - as we should have known
t
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
As Of - as we should have known
t
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
2. Let’s do some As Of projections
event?
👎
Do NOT
Apply
👍
Apply
or
As Of - as we should have known
Name:

???
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

???
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

???
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
???
Name:

Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
👍
Apply
Name:

“First name”
-pending-
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“official name”“First name”
Projection date
Jun 1st 2017
???
Name:

“First name”
-pending-
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
👍
Apply
Name:

“Official name”
-pending-
“official name”“First name”
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“Official name”
-pending-
“official name”“First name”
“patched name”
Projection date
Jun 1st 2017
???
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
👎
Do NOT
Apply
Name:

“Official name”
-pending-
“official name”“First name”
“patched name”
Projection date
Jun 1st 2017
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

“official name”
Projection date
Jun 1st 2017
Same events / another projection date
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

???
Projection date
Apr 1st 2016
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

???
Projection date
Apr 1st 2016
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
Name:

“First name”
-pending-
Projection date
Apr 1st 2016
???
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
👍
Apply
Name:

“First name”
-pending-
Projection date
Apr 1st 2016
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“First name”
-pending-
“official name”“First name”
Projection date
Apr 1st 2016
???
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“First name”
-pending-
“official name”“First name”
👎
Do NOT
Apply
Projection date
Apr 1st 2016
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“patched name”
-pending-
“official name”“First name”
“patched name”
Projection date
Apr 1st 2016
???
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“patched name”
-pending-
“official name”“First name”
“patched name”
👍
Apply
Projection date
Apr 1st 2016
As Of - as we should have known
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

“patched name”
Projection date
Apr 1st 2016
"
As At - as we knew (at the time) "
audit-trail use cases
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

???
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

???
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
Name:

Projection date
Apr 1st 2016
As At - as we knew (at the time) "
???
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
👍
Apply
Name:

“First name”
-pending-
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“First name”
-pending-
“official name”“First name”
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
???
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“First name”
-pending-
“official name”“First name”
👎
Do NOT
Apply
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“official name”“First name”
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
“patched name”
Name:

“First name”
-pending-
???
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“official name”“First name”
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
👎
Do NOT
Apply
“patched name”
Name:

“First name”
-pending-
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

“First name”
Projection date
Apr 1st 2016
As At - as we knew (at the time) "
Same events / another projection date
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

???
Projection date
Jun 1st 2017
As At - as we knew (at the time) "
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Name:

???
As At - as we knew (at the time) "
Projection date
Jun 1st 2017
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
Name:

As At - as we knew (at the time) "
???
Projection date
Jun 1st 2017
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name”
👍
Apply
Name:

“First name”
-pending-
As At - as we knew (at the time) "
Projection date
Jun 1st 2017
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“First name”
-pending-
“official name”“First name”
As At - as we knew (at the time) "
???
Projection date
Jun 1st 2017
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
Name:

“official name”
-pending-
“official name”“First name”
As At - as we knew (at the time) "
Projection date
Jun 1st 2017
👍
Apply
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“official name”“First name”
As At - as we knew (at the time) "
“patched name”
???
Projection date
Jun 1st 2017
Name:

“official name”
-pending-
t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“official name”“First name”
As At - as we knew (at the time) "
👎
Do NOT
Apply
“patched name”
Projection date
Jun 1st 2017
Name:

“official name”
-pending-
As At - as we knew (at the time) "
Projection date
Jun 1st 2017
Name:

“official name”t
Apr 1st

2016
Jan 1st

2016
Jan 1st

2017
Jun 1st

2017
“First name” “official name”
“patched name”
Still with me?
Challenge #5
How to produce a report for March 1st
like if we had made it June 1st?
Challenge #5
- We don’t want to suffer from hindsight bias
- We need to understand how we had perceived the world in the past
- We should not see some events that happened after a viewpoint
t
Q: How to produce a report for March 1st, like if we had
made it June 1st?
Name:

???
t
Q: How to produce a report for March 1st, like if we had
made it June 1st?
???
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
t
“name 1”
“name 2”
“name 5”
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
Q: How to produce a report for March 1st, like if we had
made it June 1st? Name:

???
???
t
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
“name 1”
“name 2”
“name 5”
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
Q: How to produce a report for March 1st, like if we had
made it June 1st? Name:

???
Date of the
report
Report
target date
t
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
“name 1”
“name 2”
“name 5”
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
Q: How to produce a report for March 1st, like if we had
made it June 1st?
Date of the
report
Report
target date
Apply all events created
before June 1st (viewPoint)
Don’t apply events created
after June 1st (viewPoint)
t
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
“name 5”
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
Q: How to produce a report for March 1st, like if we had
made it June 1st?
Date of the
report
Report
target date
Apply all events created
before June 1st (viewPoint)
“name 1”
“name 2”
Don’t apply events created
after June 1st (viewPoint)
t
Feb 2nd

2016
Feb 1st

2016
Feb 28th

2016
March 1st

2016
“name 5”
Feb 3rd

2016
Jul 1st

2016
Jun 1st

2016
Q: How to produce a report for March 1st, like if we had
made it June 1st?
Date of the
report
Report
target date
Apply all events created
before June 1st (viewPoint)
“name 1”
“name 2”
Don’t apply events created
after June 1st (viewPoint)
which bring us
2 new concepts
Viewpoint AsOfUntil

projection mode
Fund myFund = fundRepository.GetAsOUntil(fundId, projectedAt, viewPoint);
AsOf Until
Guid
March 1st

2016
June 1st

2016
In code we trust
?
Name1?
Name2?
Name5?
Challenge #6
Retroactive commands 

vs. Retroactive events?
Challenge #6
- Events are facts
- Commands are used to take decisions and to raise events
- Command may fail
t
Q: What should we do with ’retroactive’?
a) Apply a retroactive command to a aggregate
projected in the past? (may fail)
a) Apply a retroactive command to a aggregate
projected in the past? (may fail)
b) Create an event in the past for an aggregate?
a) Apply a retroactive command to a aggregate
projected in the past? (may fail)
b) Create an event in the past for an aggregate?
c) The answer C
c) There is no silver bullet
But we’ve mostly picked the option


a) Apply a retroactive command to a aggregate
projected in the past? (may fail)


so far
Challenge #7
Is U.T.C. enough?
tChallenge #7
- We store instants in our Event Store (createdAt, validFrom timestamps)
- Some events are applied on an entire “day” (e.g. June 8th)
t
Q: Which timestamps should we pick to describe a “day”?
Challenge #7
- We store instants in our Event Store (createdAt, validFrom timestamps)
- Some events are applied on an entire “day” (e.g. June 8th)
t
Q: Which timestamps should we pick to describe a “day”?
Q: Is UTC enough to store all instants?
Challenge #7
- We store instants in our Event Store (createdAt, validFrom timestamps)
- Some events are applied on an entire “day” (e.g. June 8th)
UTC [Utéçé;-)]

Universal Time Coordinated is the primary time standard by which the world
regulates clocks and time. It does not observe daylight saving time.
Instant [ˈÇaAriiiv]

Describes “when something happened”. Can then be interpreted in a
particular time zone and calendar system.
e.g.: 2018-05-18T16:40:35Z (Z means UTC, i.e. +00h)
Istanbul (+03)
What does June 8th even mean?
What does June 8th even mean?
Paris (+02)
Istanbul (+03)
UTC (+00)
Paris (+02)
Istanbul (+03)
What does June 8th even mean?
UTC (+00)
Jun 8th 2018
00h (+ 03h)
Paris (+02)
Istanbul (+03)
Jun 8th 2018
23h59 (+ 03h)
What does June 8th even mean?
UTC (+00)
Jun 8th 2018
00h (+ 03h)
Jun 7th 2018
21h (+ 00h)
Paris (+02)
Istanbul (+03)
Jun 8th 2018
23h59 (+ 03h)
Jun 8th 2018
21h59 (+ 00h)
What does June 8th even mean?
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 8th 2018
00h (+ 02h)
Jun 8th 2018
23h59 (+ 02h)
Jun 8th 2018
23h59 (+ 03h)
Jun 8th 2018
21h59 (+ 00h)
Jun 8th 2018
00h (+ 03h)
Jun 7th 2018
21h (+ 00h)
What does June 8th even mean?
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 8th 2018
00h (+ 02h)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
23h59 (+ 02h)
Jun 8th 2018
21h59 (+ 02h)
Jun 8th 2018
23h59 (+ 03h)
Jun 8th 2018
21h59 (+ 00h)
Jun 8th 2018
00h (+ 03h)
Jun 7th 2018
21h (+ 00h)
What does June 8th even mean?
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
21h59 (+ 02h)
Jun 8th 2018
21h59 (+ 00h)
Jun 7th 2018
21h (+ 00h)
Event 1 ?
Should event 1 be involved in a June 8th projection?
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
21h59 (+ 02h)
Jun 8th 2018
21h59 (+ 00h)
Jun 7th 2018
21h (+ 00h)
Event 1?
only if it’s June 8th - Paris time
June 8th Paris !!= June 8th Istanbul
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
21h59 (+ 02h)
Jun 8th 2018
21h59 (+ 00h)
Jun 7th 2018
21h (+ 00h)
June 8th Paris time !!= June 8th Istanbul time
UTC Time is mandatory to store & compare events
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
21h59 (+ 02h)
Jun 8th 2018
21h59 (+ 00h)
Jun 7th 2018
21h (+ 00h)
UTC is mandatory but not enough
UTC (+00)
Paris (+02)
Istanbul (+03)
Jun 7th 2018
22h (+ 00h)
Jun 8th 2018
21h59 (+
02h)
Jun 8th 2018
21h59 (+
00h)
Jun 7th 2018
21h (+ 00h)
We need UTC Time + time zone of the event
time zone of the event?
Time zone of the action
that originated the event?
time zone of the event?
Time zone of the action
that originated the event?
Time zone associated with
the topic (i.e. a Fund)?
time zone of the event?
- Wrap up -
Discovering the unknown
Without concrete examples and a
model, you’re dead.
And more than ever…
y.a.g.n.i
you ain’t gonna need it
Would you
d a r e t o
destroy it?
OVER
ENGINEERING
is an embarrassment
to ourselves
Get prepared
to Design
BREAK
THROUGH
Thank you!
(White paper ongoing)

@tpierrain (use case driven)
Thank you!
And the
winner is…
?
7 SPEAKERS, 5 TALKS ORIGINAUX DE 15-20 MIN
EN QUOI NOUS INTÉRESSER AUX PROBLÈMES DU
MÉTIER NOUS A RENDU PLUS EFFICACE
LE MARDI 26 JUIN, CHEZ
DOMAIN FROM THE TRENCHES
Appendix
As At #2
As At #2 - as we knew at the time
As At #2 - as we knew at the time
As At #2 - as we knew at the time
“Patched name” will be <<discarded>> by the
following FundRenamed event
As Of #2
As Of #2 - as we should have known
“Patched name” is not <<discarded>> by the
following FundRenamed event (“official name”)
As Of #2 - as we should have known
But then it is replaced by the new one
( “OfficialName”)
You want to be ahead of what is done in software?
You understand there are bigger issues than just coding
We are looking for people who are daring, curious, sharing,
but who especially like team work
recruits
As time goes by (episode 2)
As time goes by (episode 2)

Weitere ähnliche Inhalte

Was ist angesagt?

Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리YoungHeon (Roy) Kim
 
ChatGPT讓任務型機器人變身
「真」聊天機器人
ChatGPT讓任務型機器人變身
「真」聊天機器人ChatGPT讓任務型機器人變身
「真」聊天機器人
ChatGPT讓任務型機器人變身
「真」聊天機器人佳新 陳
 
Dev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrDev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrJohn Allspaw
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootMikalai Alimenkou
 
Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and EffectsMartin Odersky
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean ArchitectureMattia Battiston
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopSaša Tatar
 
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)Gelis Wu
 
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful  Protocol BuffersJavaOne 2009 - TS-5276 - RESTful  Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol BuffersMatt O'Keefe
 
Izumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala StackIzumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala Stack7mind
 
Infra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and TerraformInfra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and TerraformInho Kang
 
8. Event Storming (P. Rayner).pdf
8. Event Storming (P. Rayner).pdf8. Event Storming (P. Rayner).pdf
8. Event Storming (P. Rayner).pdfMikhail Andronov
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network TroubleshootingOpen Source Consulting
 
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDiscover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDevOps.com
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewDmytro Zaitsev
 

Was ist angesagt? (20)

Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리
 
ChatGPT讓任務型機器人變身
「真」聊天機器人
ChatGPT讓任務型機器人變身
「真」聊天機器人ChatGPT讓任務型機器人變身
「真」聊天機器人
ChatGPT讓任務型機器人變身
「真」聊天機器人
 
Dev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrDev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and Flickr
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring Boot
 
Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and Effects
 
Using the Splunk Java SDK
Using the Splunk Java SDKUsing the Splunk Java SDK
Using the Splunk Java SDK
 
Vert.x
Vert.xVert.x
Vert.x
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
 
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)
 
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful  Protocol BuffersJavaOne 2009 - TS-5276 - RESTful  Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
 
Izumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala StackIzumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala Stack
 
Infra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and TerraformInfra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and Terraform
 
Spring the ripper
Spring the ripperSpring the ripper
Spring the ripper
 
8. Event Storming (P. Rayner).pdf
8. Event Storming (P. Rayner).pdf8. Event Storming (P. Rayner).pdf
8. Event Storming (P. Rayner).pdf
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting[오픈소스컨설팅] Linux Network Troubleshooting
[오픈소스컨설팅] Linux Network Troubleshooting
 
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDiscover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth review
 
Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17
 

Ähnlich wie As time goes by (episode 2)

A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...Databricks
 
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)CQRS & Event Sourcing in the wild (ScotlandPHP 2016)
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)Michiel Rook
 
Data in Motion: Streaming Static Data Efficiently
Data in Motion: Streaming Static Data EfficientlyData in Motion: Streaming Static Data Efficiently
Data in Motion: Streaming Static Data EfficientlyMartin Zapletal
 
Ria services updating data
Ria services updating dataRia services updating data
Ria services updating dataiedotnetug
 
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JSFestUA
 
Introduction to Event Sourcing in PHP
Introduction to Event Sourcing in PHPIntroduction to Event Sourcing in PHP
Introduction to Event Sourcing in PHPEvan McMahon
 
CQRS & event sourcing in the wild
CQRS & event sourcing in the wildCQRS & event sourcing in the wild
CQRS & event sourcing in the wildMichiel Rook
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
Reactивная тяга
Reactивная тягаReactивная тяга
Reactивная тягаVitebsk Miniq
 
A Series of Fortunate Events - Symfony Camp Sweden 2014
A Series of Fortunate Events - Symfony Camp Sweden 2014A Series of Fortunate Events - Symfony Camp Sweden 2014
A Series of Fortunate Events - Symfony Camp Sweden 2014Matthias Noback
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRSNeil Robbins
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinarpatriknw
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptxGood657694
 
Dutch php a short tale about state machine
Dutch php   a short tale about state machineDutch php   a short tale about state machine
Dutch php a short tale about state machineŁukasz Chruściel
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server SideIgnacio Martín
 

Ähnlich wie As time goes by (episode 2) (20)

A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
A Practical Approach to Building a Streaming Processing Pipeline for an Onlin...
 
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)CQRS & Event Sourcing in the wild (ScotlandPHP 2016)
CQRS & Event Sourcing in the wild (ScotlandPHP 2016)
 
Data in Motion: Streaming Static Data Efficiently
Data in Motion: Streaming Static Data EfficientlyData in Motion: Streaming Static Data Efficiently
Data in Motion: Streaming Static Data Efficiently
 
Event Sourcing with php
Event Sourcing with phpEvent Sourcing with php
Event Sourcing with php
 
Ria services updating data
Ria services updating dataRia services updating data
Ria services updating data
 
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
 
Introduction to Event Sourcing in PHP
Introduction to Event Sourcing in PHPIntroduction to Event Sourcing in PHP
Introduction to Event Sourcing in PHP
 
CQRS & event sourcing in the wild
CQRS & event sourcing in the wildCQRS & event sourcing in the wild
CQRS & event sourcing in the wild
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Reactивная тяга
Reactивная тягаReactивная тяга
Reactивная тяга
 
A Series of Fortunate Events - Symfony Camp Sweden 2014
A Series of Fortunate Events - Symfony Camp Sweden 2014A Series of Fortunate Events - Symfony Camp Sweden 2014
A Series of Fortunate Events - Symfony Camp Sweden 2014
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRS
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinar
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
 
Dutch php a short tale about state machine
Dutch php   a short tale about state machineDutch php   a short tale about state machine
Dutch php a short tale about state machine
 
Activities.pptx
Activities.pptxActivities.pptx
Activities.pptx
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server Side
 
Serverless stateful
Serverless statefulServerless stateful
Serverless stateful
 

Mehr von Thomas Pierrain

The scale-up, the autonomy and the nuclear submarine
The scale-up, the autonomy and the nuclear submarineThe scale-up, the autonomy and the nuclear submarine
The scale-up, the autonomy and the nuclear submarineThomas Pierrain
 
La scale-up, l'autonomie et le sous-marin nucléaire
La scale-up, l'autonomie et le sous-marin nucléaireLa scale-up, l'autonomie et le sous-marin nucléaire
La scale-up, l'autonomie et le sous-marin nucléaireThomas Pierrain
 
De l'autre côté du miroir
De l'autre côté du miroirDe l'autre côté du miroir
De l'autre côté du miroirThomas Pierrain
 
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDD
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDDWrite Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDD
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDDThomas Pierrain
 
Beyond Hexagonal architecture
Beyond Hexagonal architectureBeyond Hexagonal architecture
Beyond Hexagonal architectureThomas Pierrain
 
The 9 rules of debugging
The 9 rules of debuggingThe 9 rules of debugging
The 9 rules of debuggingThomas Pierrain
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellThomas Pierrain
 
Une nuit dans l'hexagone
Une nuit dans l'hexagoneUne nuit dans l'hexagone
Une nuit dans l'hexagoneThomas Pierrain
 
Et si on parlait Éthique ?
Et si on parlait Éthique ?Et si on parlait Éthique ?
Et si on parlait Éthique ?Thomas Pierrain
 
Sortir de notre zone de confort
Sortir de notre zone de confortSortir de notre zone de confort
Sortir de notre zone de confortThomas Pierrain
 
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreL'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreThomas Pierrain
 
Legacy club (english version)
Legacy club (english version)Legacy club (english version)
Legacy club (english version)Thomas Pierrain
 
The art of Software Design
The art of Software DesignThe art of Software Design
The art of Software DesignThomas Pierrain
 
CQRS without event sourcing
CQRS without event sourcingCQRS without event sourcing
CQRS without event sourcingThomas Pierrain
 
Decouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueDecouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueThomas Pierrain
 
Decouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingDecouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingThomas Pierrain
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)Thomas Pierrain
 

Mehr von Thomas Pierrain (20)

The scale-up, the autonomy and the nuclear submarine
The scale-up, the autonomy and the nuclear submarineThe scale-up, the autonomy and the nuclear submarine
The scale-up, the autonomy and the nuclear submarine
 
La scale-up, l'autonomie et le sous-marin nucléaire
La scale-up, l'autonomie et le sous-marin nucléaireLa scale-up, l'autonomie et le sous-marin nucléaire
La scale-up, l'autonomie et le sous-marin nucléaire
 
De l'autre côté du miroir
De l'autre côté du miroirDe l'autre côté du miroir
De l'autre côté du miroir
 
eXtreme
eXtremeeXtreme
eXtreme
 
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDD
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDDWrite Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDD
Write Antifragile & Domain-Driven tests with ”Outside-in diamond” ◆ TDD
 
Beyond Hexagonal architecture
Beyond Hexagonal architectureBeyond Hexagonal architecture
Beyond Hexagonal architecture
 
The 9 rules of debugging
The 9 rules of debuggingThe 9 rules of debugging
The 9 rules of debugging
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shell
 
Une nuit dans l'hexagone
Une nuit dans l'hexagoneUne nuit dans l'hexagone
Une nuit dans l'hexagone
 
Equiper sa voie
Equiper sa voieEquiper sa voie
Equiper sa voie
 
Et si on parlait Éthique ?
Et si on parlait Éthique ?Et si on parlait Éthique ?
Et si on parlait Éthique ?
 
Sortir de notre zone de confort
Sortir de notre zone de confortSortir de notre zone de confort
Sortir de notre zone de confort
 
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreL'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
 
Legacy club (english version)
Legacy club (english version)Legacy club (english version)
Legacy club (english version)
 
The art of Software Design
The art of Software DesignThe art of Software Design
The art of Software Design
 
CQRS without event sourcing
CQRS without event sourcingCQRS without event sourcing
CQRS without event sourcing
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 
Decouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueDecouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratique
 
Decouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingDecouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event storming
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)
 

Kürzlich hochgeladen

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptxrouholahahmadi9876
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...jabtakhaidam7
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 

Kürzlich hochgeladen (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 

As time goes by (episode 2)

  • 1. As time goes by… Episode 2: technical challenges of bi-temporal Event Sourcing @tpierrain t
  • 2. If you want to win… Tweet like hell on… #newCrafts
  • 3.
  • 6. REQUIREMENTS — Understand their former decisions Fix their perception of the world retroactively
  • 7. REQUIREMENTS — Understand their former decisions Fix their perception of the world retroactively (Re)produce reports in and from the past
  • 8. REQUIREMENTS — Understand their former decisions Fix their perception of the world retroactively (Re)produce reports in and from the past Forecast ”events” in the future

  • 9. REQUIREMENTS — Understand their former decisions Fix their perception of the world retroactively (Re)produce reports in and from the past Forecast ”events” in the future
 Strong audit trail
  • 10. They needed a time machine
  • 13. Remember your banking account? Event Sourcing
  • 15. Final state of the world All changes since 
 the beginning
  • 16. All changes since the beginning = A list of events
  • 17. Event [ɪˈvent] Describes a fact, something that have happened. Usually expressed in a past-tense form.
 (e.g.: TalkStarted)
  • 18. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Event-Sourced business objects
  • 19. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Properties / Members Event-Sourced business objects
  • 20. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Evolution functions Change state Event-Sourced business objects
  • 21. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Constructor Change state Event-Sourced business objects
  • 22. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Decision functions Don’t change state Event-Sourced business objects
  • 23. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Event-Sourced business objects
  • 24. public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Decision functions Don’t change state Event-Sourced business objects
  • 25. Event-Sourced business objects public class Fund : EventSourcedAggregate { public Guid Id { get; private set; } public string Name { get; private set; } public Fund(IEnumerable<Event> events) { foreach(var evt in events) { Apply(evt); } } private Apply(FundRenamed event) { this.Name = event.FundNewName; } public IEnumerable<Event> Rename(string newName) { !// business logic and invariants checks HERE !// Raise event(s) return new[] { new FundRenamed(this.Id, newName) }; } } Decision functions Don’t change state Evolution functions Change state
  • 26. Projection [prəˈjekSHən] Deriving a current state from a stream of events
  • 27. Fund myFund = fundRepository.GetById(fundId, projectedAt); Event-Sourcing in motion Guid timestamp
  • 28. Fund myFund = fundRepository.GetById(fundId, projectedAt); Now b7f3ddfb-2cb5…. Event-Sourcing in motion
  • 30. t FundCreated
 “super yield ” Jan 1st
 2016 Fund id: b7f3ddfb -2cb5…. Name: super yield Creation date: Jan 1st 2016 Management Company: Shares: Event-Sourcing in motion
  • 31. t Jan 1st
 2016 ManagementCompanyAssigned
 “BNP” Jan 30th
 2016 Fund id: b7f3ddfb -2cb5…. Name: super yield Creation date: Jan 1st 2016 Management Company: BNP Shares: Event-Sourcing in motion
  • 32. t Jan 1st
 2016 Jan 30th
 2016 FundRenamed
 “Yield 2k22” Apr 1st
 2016 Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: Event-Sourcing in motion
  • 33. t Jan 1st
 2016 Jan 30th
 2016 Apr 1st
 2016 ShareAdded
 “Part D” Jun 2nd
 2016 Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: Part D Event-Sourcing in motion
  • 34. Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: Part D End of Stream >> <<t Jan 1st
 2016 Jan 30th
 2016 Apr 1st
 2016 Jun 2nd
 2016 Event-Sourcing in motion
  • 35. Projected at now Ready to work Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: Part D
  • 36. The beauty of it Pick the projection date you want ;-)
  • 37. Project same Fund at Apr 1st 2016 (same stream of events) Event-Sourcing in motion
  • 39. t FundCreated
 “super yield ” Jan 1st
 2016 Fund id: b7f3ddfb -2cb5…. Name: super yield Creation date: Jan 1st 2016 Management Company: Shares: Event-Sourcing in motion
  • 40. t Jan 1st
 2016 ManagementCompanyAssigned
 “BNP” Jan 30th
 2016 Fund id: b7f3ddfb -2cb5…. Name: super yield Creation date: Jan 1st 2016 Management Company: BNP Shares: Event-Sourcing in motion
  • 41. t Jan 1st
 2016 Jan 30th
 2016 FundRenamed
 “Yield 2k22” Apr 1st
 2016 Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: Event-Sourcing in motion
  • 42. t Jan 1st
 2016 Jan 30th
 2016 Apr 1st
 2016 Fund id: b7f3ddfb -2cb5…. Name: Yield 2k22 Creation date: Jan 1st 2016 Management Company: BNP Shares: We’re done here ;-) >> << Event-Sourcing in motion
  • 43. Command [kəˈmɑːnd] Triggers an action. Modify the state of the system e.g.: RenameFund
  • 44. Commands are used to take decisions and to raise events.
  • 45. Commands are used to take decisions and to raise events. Command (RenameFund) Aggregate (Fund X)
  • 46. Commands are used to take decisions and to raise events. Command (RenameFund) Events (FundRenamed) Events are used to restore/change the state of our aggregates. Aggregate (Fund X)
  • 47. so far so good? 😉
  • 49. Challenge #1 How to change what can’t be changed?

  • 50. Challenge #1 - Events are immutable (facts) - We save them in append-only streams (Event Store) t Q: How to retroactively change former mistaken events? Q: How to insert forgotten events in the past (in the middle of a stream)?
  • 51. we don’t change events we just add more events
  • 52. we don’t change events we just add more events
  • 54. “One more thing… All our events have…”
  • 55. createdAt 

 validFrom !-> when it applies 2 timestamps
  • 56. createdAt 

 validFrom !-> when it applies 2 timestamps ( bi-temporal)
  • 58. Types of events validFrom createdAt Classic event validFrom createdAt Retroactive event
  • 59. Thus we can hide former events
  • 60. Thus we can hide former events t Feb 1st
 2016 Feb 3rd
 2016 Feb 5th
 2016 “new naaame” “initial name”
  • 61. Thus we can hide former events t Feb 1st
 2016 Feb 3rd
 2016 Feb 5th
 2016 “new naaame” “initial name” “fixed name ;-)”
  • 62. Thus we can hide former events t Feb 1st
 2016 Feb 3rd
 2016 Feb 5th
 2016 “new naaame” “initial name” “fixed name ;-)”
  • 63.
  • 65. Challenge #2 - Event Store stores “Events” ;-) - Events are things that have already happened (facts) t Q: How to store things that have to happen in an Event Store?
  • 66.
  • 67. Let’s store ”a Command (X) has just been Scheduled” events
  • 68. validFromcreatedAt “Command Scheduled” event“Command Scheduled” event RenameFund (Cmd)
  • 70. 3 Types of events
  • 71. 3 Types of events validFrom createdAt Classic event
  • 72. 3 Types of events validFrom createdAt Classic event validFrom createdAt Retroactive event
  • 73. 3 Types of events validFrom createdAt Classic event validFrom createdAt Retroactive event validFromcreatedAt “Command Scheduled” event C
  • 75.
  • 76. Challenge #3 How to project unsorted streams of events?
  • 77. Challenge #3 - With retroactive events, we have unsorted streams of events - Some events may hide others - Past may change at any time. Future too t Q: How to implement projections in such environment?
  • 79. 1 Forward-only projections with filters
  • 80. 1 Forward-only projections with filters 2 Sort - then - Apply events
  • 81. 1 Forward-only projections with filters 2 Sort - then - Apply events 3 Rebased Timelines with branches
  • 82. 1 Forward-only projections with filters 2 Sort - then - Apply events 3 Rebased Timelines with branches too complicated
  • 83. 1 Forward-only projections with filters 2 Sort - then - Apply events 3 Rebased Timelines with branches too complicated not compliant with bigstreams of events
  • 84. 2 Sort - then - Apply events 3 Rebased Timelines with branches too complicated not compliant with bigstreams of events 1 Forward-only projections with filters
  • 85.
  • 86. Challenge #4 How to provide multiple visions of the same reality?
 (operational - audit-trail)
  • 87. Challenge #4 - 1 stream of events per aggregate instance - We need to provide both an operational mode and an audit mode t Q: How to provide various points of view in our reality?
  • 90. / As AtAs Of "
  • 91. / As AtAs Of As we should 
 have known "
  • 92. / As AtAs Of As we should 
 have known Patches inside "
  • 93. /As Of As we should 
 have known Patches inside As At As we knew (at the time) "
  • 94. / As At As we knew (at the time) Audit trails As Of As we should 
 have known Patches inside "
  • 95. / As At As we knew (at the time) Audit trails As Of As we should 
 have known Patches inside "
  • 96. Since we have a model, let’s find some exemples
  • 97.
  • 98. Our main usages (patches included) As Of - as we should have known
  • 99. As Of - as we should have known Imagine a stream of 3 events for a Fund
  • 100. 1.Let’s see how those events have been saved over the time
  • 101. As Of - as we should have known t Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017
  • 102. As Of - as we should have known t Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name”
  • 103. As Of - as we should have known t Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name”
  • 104. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name”
  • 105. 2. Let’s do some As Of projections
  • 107. As Of - as we should have known Name:
 ??? Projection date Jun 1st 2017
  • 108. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 ??? Projection date Jun 1st 2017
  • 109. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 ??? Projection date Jun 1st 2017
  • 110. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” ??? Name:
 Projection date Jun 1st 2017
  • 111. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” 👍 Apply Name:
 “First name” -pending- Projection date Jun 1st 2017
  • 112. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “official name”“First name” Projection date Jun 1st 2017 ??? Name:
 “First name” -pending-
  • 113. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 👍 Apply Name:
 “Official name” -pending- “official name”“First name” Projection date Jun 1st 2017
  • 114. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “Official name” -pending- “official name”“First name” “patched name” Projection date Jun 1st 2017 ???
  • 115. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 👎 Do NOT Apply Name:
 “Official name” -pending- “official name”“First name” “patched name” Projection date Jun 1st 2017
  • 116. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 “official name” Projection date Jun 1st 2017
  • 117. Same events / another projection date
  • 118. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 ??? Projection date Apr 1st 2016
  • 119. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 ??? Projection date Apr 1st 2016
  • 120. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” Name:
 “First name” -pending- Projection date Apr 1st 2016 ???
  • 121. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” 👍 Apply Name:
 “First name” -pending- Projection date Apr 1st 2016
  • 122. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “First name” -pending- “official name”“First name” Projection date Apr 1st 2016 ???
  • 123. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “First name” -pending- “official name”“First name” 👎 Do NOT Apply Projection date Apr 1st 2016
  • 124. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “patched name” -pending- “official name”“First name” “patched name” Projection date Apr 1st 2016 ???
  • 125. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “patched name” -pending- “official name”“First name” “patched name” 👍 Apply Projection date Apr 1st 2016
  • 126. As Of - as we should have known t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 “patched name” Projection date Apr 1st 2016
  • 127. "
  • 128. As At - as we knew (at the time) " audit-trail use cases
  • 129. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 ??? Projection date Apr 1st 2016 As At - as we knew (at the time) "
  • 130. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 ??? Projection date Apr 1st 2016 As At - as we knew (at the time) "
  • 131. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” Name:
 Projection date Apr 1st 2016 As At - as we knew (at the time) " ???
  • 132. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” 👍 Apply Name:
 “First name” -pending- Projection date Apr 1st 2016 As At - as we knew (at the time) "
  • 133. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “First name” -pending- “official name”“First name” Projection date Apr 1st 2016 As At - as we knew (at the time) " ???
  • 134. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “First name” -pending- “official name”“First name” 👎 Do NOT Apply Projection date Apr 1st 2016 As At - as we knew (at the time) "
  • 135. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “official name”“First name” Projection date Apr 1st 2016 As At - as we knew (at the time) " “patched name” Name:
 “First name” -pending- ???
  • 136. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “official name”“First name” Projection date Apr 1st 2016 As At - as we knew (at the time) " 👎 Do NOT Apply “patched name” Name:
 “First name” -pending-
  • 137. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 “First name” Projection date Apr 1st 2016 As At - as we knew (at the time) "
  • 138. Same events / another projection date
  • 139. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 ??? Projection date Jun 1st 2017 As At - as we knew (at the time) "
  • 140. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name” Name:
 ??? As At - as we knew (at the time) " Projection date Jun 1st 2017
  • 141. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” Name:
 As At - as we knew (at the time) " ??? Projection date Jun 1st 2017
  • 142. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” 👍 Apply Name:
 “First name” -pending- As At - as we knew (at the time) " Projection date Jun 1st 2017
  • 143. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “First name” -pending- “official name”“First name” As At - as we knew (at the time) " ??? Projection date Jun 1st 2017
  • 144. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 Name:
 “official name” -pending- “official name”“First name” As At - as we knew (at the time) " Projection date Jun 1st 2017 👍 Apply
  • 145. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “official name”“First name” As At - as we knew (at the time) " “patched name” ??? Projection date Jun 1st 2017 Name:
 “official name” -pending-
  • 146. t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “official name”“First name” As At - as we knew (at the time) " 👎 Do NOT Apply “patched name” Projection date Jun 1st 2017 Name:
 “official name” -pending-
  • 147. As At - as we knew (at the time) " Projection date Jun 1st 2017 Name:
 “official name”t Apr 1st
 2016 Jan 1st
 2016 Jan 1st
 2017 Jun 1st
 2017 “First name” “official name” “patched name”
  • 149.
  • 150. Challenge #5 How to produce a report for March 1st like if we had made it June 1st?
  • 151. Challenge #5 - We don’t want to suffer from hindsight bias - We need to understand how we had perceived the world in the past - We should not see some events that happened after a viewpoint t
  • 152. Q: How to produce a report for March 1st, like if we had made it June 1st?
  • 153. Name:
 ??? t Q: How to produce a report for March 1st, like if we had made it June 1st? ??? Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016
  • 154. t “name 1” “name 2” “name 5” Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016 Q: How to produce a report for March 1st, like if we had made it June 1st? Name:
 ??? ???
  • 155. t Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 “name 1” “name 2” “name 5” Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016 Q: How to produce a report for March 1st, like if we had made it June 1st? Name:
 ??? Date of the report Report target date
  • 156. t Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 “name 1” “name 2” “name 5” Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016 Q: How to produce a report for March 1st, like if we had made it June 1st? Date of the report Report target date Apply all events created before June 1st (viewPoint) Don’t apply events created after June 1st (viewPoint)
  • 157. t Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 “name 5” Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016 Q: How to produce a report for March 1st, like if we had made it June 1st? Date of the report Report target date Apply all events created before June 1st (viewPoint) “name 1” “name 2” Don’t apply events created after June 1st (viewPoint)
  • 158. t Feb 2nd
 2016 Feb 1st
 2016 Feb 28th
 2016 March 1st
 2016 “name 5” Feb 3rd
 2016 Jul 1st
 2016 Jun 1st
 2016 Q: How to produce a report for March 1st, like if we had made it June 1st? Date of the report Report target date Apply all events created before June 1st (viewPoint) “name 1” “name 2” Don’t apply events created after June 1st (viewPoint)
  • 159. which bring us 2 new concepts
  • 161. Fund myFund = fundRepository.GetAsOUntil(fundId, projectedAt, viewPoint); AsOf Until Guid March 1st 2016 June 1st 2016
  • 162. In code we trust
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 170.
  • 171.
  • 172. Challenge #6 Retroactive commands 
 vs. Retroactive events?
  • 173. Challenge #6 - Events are facts - Commands are used to take decisions and to raise events - Command may fail t Q: What should we do with ’retroactive’?
  • 174.
  • 175. a) Apply a retroactive command to a aggregate projected in the past? (may fail)
  • 176. a) Apply a retroactive command to a aggregate projected in the past? (may fail) b) Create an event in the past for an aggregate?
  • 177. a) Apply a retroactive command to a aggregate projected in the past? (may fail) b) Create an event in the past for an aggregate? c) The answer C
  • 178. c) There is no silver bullet
  • 179. But we’ve mostly picked the option 
 a) Apply a retroactive command to a aggregate projected in the past? (may fail) 
 so far
  • 180.
  • 182. tChallenge #7 - We store instants in our Event Store (createdAt, validFrom timestamps) - Some events are applied on an entire “day” (e.g. June 8th)
  • 183. t Q: Which timestamps should we pick to describe a “day”? Challenge #7 - We store instants in our Event Store (createdAt, validFrom timestamps) - Some events are applied on an entire “day” (e.g. June 8th)
  • 184. t Q: Which timestamps should we pick to describe a “day”? Q: Is UTC enough to store all instants? Challenge #7 - We store instants in our Event Store (createdAt, validFrom timestamps) - Some events are applied on an entire “day” (e.g. June 8th)
  • 185. UTC [Utéçé;-)] Universal Time Coordinated is the primary time standard by which the world regulates clocks and time. It does not observe daylight saving time.
  • 186. Instant [ˈÇaAriiiv] Describes “when something happened”. Can then be interpreted in a particular time zone and calendar system. e.g.: 2018-05-18T16:40:35Z (Z means UTC, i.e. +00h)
  • 187. Istanbul (+03) What does June 8th even mean?
  • 188. What does June 8th even mean? Paris (+02) Istanbul (+03)
  • 189. UTC (+00) Paris (+02) Istanbul (+03) What does June 8th even mean?
  • 190. UTC (+00) Jun 8th 2018 00h (+ 03h) Paris (+02) Istanbul (+03) Jun 8th 2018 23h59 (+ 03h) What does June 8th even mean?
  • 191. UTC (+00) Jun 8th 2018 00h (+ 03h) Jun 7th 2018 21h (+ 00h) Paris (+02) Istanbul (+03) Jun 8th 2018 23h59 (+ 03h) Jun 8th 2018 21h59 (+ 00h) What does June 8th even mean?
  • 192. UTC (+00) Paris (+02) Istanbul (+03) Jun 8th 2018 00h (+ 02h) Jun 8th 2018 23h59 (+ 02h) Jun 8th 2018 23h59 (+ 03h) Jun 8th 2018 21h59 (+ 00h) Jun 8th 2018 00h (+ 03h) Jun 7th 2018 21h (+ 00h) What does June 8th even mean?
  • 193. UTC (+00) Paris (+02) Istanbul (+03) Jun 8th 2018 00h (+ 02h) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 23h59 (+ 02h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 23h59 (+ 03h) Jun 8th 2018 21h59 (+ 00h) Jun 8th 2018 00h (+ 03h) Jun 7th 2018 21h (+ 00h) What does June 8th even mean?
  • 194. UTC (+00) Paris (+02) Istanbul (+03) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 21h59 (+ 00h) Jun 7th 2018 21h (+ 00h) Event 1 ? Should event 1 be involved in a June 8th projection?
  • 195. UTC (+00) Paris (+02) Istanbul (+03) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 21h59 (+ 00h) Jun 7th 2018 21h (+ 00h) Event 1? only if it’s June 8th - Paris time
  • 196. June 8th Paris !!= June 8th Istanbul
  • 197. UTC (+00) Paris (+02) Istanbul (+03) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 21h59 (+ 00h) Jun 7th 2018 21h (+ 00h) June 8th Paris time !!= June 8th Istanbul time
  • 198. UTC Time is mandatory to store & compare events UTC (+00) Paris (+02) Istanbul (+03) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 21h59 (+ 00h) Jun 7th 2018 21h (+ 00h)
  • 199. UTC is mandatory but not enough UTC (+00) Paris (+02) Istanbul (+03) Jun 7th 2018 22h (+ 00h) Jun 8th 2018 21h59 (+ 02h) Jun 8th 2018 21h59 (+ 00h) Jun 7th 2018 21h (+ 00h)
  • 200. We need UTC Time + time zone of the event
  • 201. time zone of the event?
  • 202. Time zone of the action that originated the event? time zone of the event?
  • 203. Time zone of the action that originated the event? Time zone associated with the topic (i.e. a Fund)? time zone of the event?
  • 204.
  • 205. - Wrap up -
  • 207. Without concrete examples and a model, you’re dead.
  • 208. And more than ever…
  • 210.
  • 211. Would you d a r e t o destroy it?
  • 215. (White paper ongoing)
 @tpierrain (use case driven) Thank you!
  • 217. ?
  • 218. 7 SPEAKERS, 5 TALKS ORIGINAUX DE 15-20 MIN EN QUOI NOUS INTÉRESSER AUX PROBLÈMES DU MÉTIER NOUS A RENDU PLUS EFFICACE LE MARDI 26 JUIN, CHEZ DOMAIN FROM THE TRENCHES
  • 221. As At #2 - as we knew at the time
  • 222. As At #2 - as we knew at the time
  • 223. As At #2 - as we knew at the time “Patched name” will be <<discarded>> by the following FundRenamed event
  • 225. As Of #2 - as we should have known “Patched name” is not <<discarded>> by the following FundRenamed event (“official name”)
  • 226. As Of #2 - as we should have known But then it is replaced by the new one ( “OfficialName”)
  • 227.
  • 228.
  • 229. You want to be ahead of what is done in software? You understand there are bigger issues than just coding We are looking for people who are daring, curious, sharing, but who especially like team work recruits