Event Sourcing and Timer Synchronisation
I'm a fan of Pomodoro. Any dedicated app I've used always has the issue is that it isn't on my phone and computer. If it's running on my laptop and I'm not there, no break. If it's on my phone and I've left it somewhere, no break or I need to root it out my pocket.
To fix this slight inconvience, I've been building my own timer app. To keep things "simple" and in sync I decided to use event sourcing as the core architecture.
The idea is simple: instead of storing the current state of a timer directly, I
store a sequence of events — created, started, paused, stopped — and
the current state is set by replaying them. Events from one device are synced
via CoreData. Start a timer on my phone, it gets to the same state on my mac.
Pause the timer on my mac then go make coffee? No blaring alerts on my phone
when I'm mid making coffee.
Why bother for a timer? I've got a few other ideas to use event sourcing for but this is a simple app and solves a problem for me too. I want to use this timer for time tracking too. I can see exactly when a timer was started, how many times it was paused and the total elapsed duration which opens up interesting possibilities for analytics.
As always, I appreciate any feedback or if you want to reach out, I'm
@neuralsandwich on twitter and most other places.