Hacker News new | ask | show | jobs
by boothead 4695 days ago
I would almost certainly build the back end from the ground up based on the concept of a stream of events. Current state is then expressed as left fold over a base empty state and all of the event types you're interested in.

Benefits that I can see:

* Purity. You can test the hell out of this with no side effects.

* Transaction log built in.

* The ability to look back in time, by only applying the events up until the point you're interested in and disregarding the rest.

* Very flexible and scalable.

* You can retrospectively answer questions that you might not have known how to ask, by creating new operations over your states.

* Plays well with monitoring, and analysis. E.g. just stream all of your events into logstash and elastic search.

2 comments

So basically, passion, right? Or is it what you already know and do all the time?

It's an interesting take nonetheless, I've been toying with the concept of data/documents as the integration of event streams (commits, status updates etc) for a few years but never really thought to use the concept "from the ground up". The idea to me never really had any technical justification, mostly end user ones. Collaborative editing (Google Wave), action replays and time machine visualization (Starcraft, Gource), status update and event analytics dashboards (google analytics or the twitter firehose)...

It's a bit outside of the scope of my webapp for the time being but I'm glad there are people who think there is value in that approach!

Well it's basically Event Sourcing [1]. It's probably also worth mentioning CQRS as well. All this stuff really appeals to my functional programming side :-)

I haven't quite figured out to what extent OT is the same as event sourcing. I guess OT is event sourcing with the additional concept of translating events over the top of other events (i.e rebase).

[1] http://martinfowler.com/eaaDev/EventSourcing.html

I'm not familiar with either CQRS and OT. Google fails me completely on the latter, but does CQRS mean "Command Query Responsibility Segregation"?
CQRS: Yes that's it.

OT is operational transform; the set of algorithms behind google wave/docs. A modern take is http://sharejs.org/

FRP?