3 ms·
If you're interested in examples of useful monoids and similar structures, you may want to have a look at the Algebird[0] project or the recent work on CRDTs[1]
by bkirwi 12y ago
If you're interested in examples of useful monoids and similar structures, you may want to have a look at the Algebird[0] project or the recent work on CRDTs[1]. The code savings in these projects comes from being able to write the complex distributed aggregation / conflict resolution / etc. code just once, and reuse it with a menagerie of useful implementations.
Personally, I like structuring things using these tools when I can get away with it. They're simple and broadly applicable abstractions, and mean I can reuse both my intuitions and my code in wildly diverse situations.
[0] https://github.com/twitter/algebird https://github.com/twitter/algebird
[1] http://highscalability.com/blog/2010/12/23/paper-crdts-consistency-without-concurrency-control.html http://highscalability.com/blog/2010/12/23/paper-crdts-consi...
- seanmcdirmid 12y agoWhat we want is a comparison: what was the OO code, and what did the functional code turn out to be? That way, we can judge for ourselves. Typically, these examples take low-end crappy OO code and convert it to high-end elegant FP code. But this doesn't really convince anyone.
- samstokes 12y agoI don't know the OP's examples, but I think he is saying something subtly different: that he took (his own) low-end crappy OO code and converted it to high-end elegant OO code, using the insight gained from how he would have written it as FP.
- deleted 12y ago[deleted]
- seanmcdirmid 12y agoI didn't get that from the article, but they aren't explicit about it.
- jacquesm 12y agoI got that too, and that's exactly why I would like to see the code before and after. That's far more interesting than the rest of the article in my opinion.