Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Composing side effects in Clojure

kapil
August 31, 2019

Composing side effects in Clojure

We always end up in a situation where we need to do a bunch of side effects on a user action. This is simple as long as the side effects don’t depend on each other. Errors and unhappy paths make it even harder. The talk presents an approach that tries to solve these problems.

kapil

August 31, 2019
Tweet

More Decks by kapil

Other Decks in Programming

Transcript

  1. Scale • 165000 Requests per Second • @50 ms Response

    time • ~400GB data transfer every hour • 1000+ VMs deployed at peak
  2. {}

  3. Problems with thrush for side effects • Overlapping keys •

    Shape of data gets complex • Handling complex error scenarios
  4. Problems with thrush for side effects • Overlapping keys •

    Shape of data gets complex • Can’t handle complex failure scenarios
  5. Problems with thrush for side effects • Overlapping keys •

    Shape of data gets complex • Can’t handle complex failure scenarios
  6. Problems with thrush for side effects • Overlapping keys •

    Shape of data gets complex • Can’t handle complex failure scenarios
  7. Conclusions • Writing complex side effects code can be tricky

    • Thrush is not a good abstraction for side effects • Graphs are a great way to represent multiple side effects / computations • Defining APIs is simple in Clojure • Libraries like Shinri and Prismatic Plumbing can help
  8. Fin