[wroc_love.rb] Migrating to Clojure. So much fn.

[wroc_love.rb] Migrating to Clojure. So much fn.

Slides from a talk I delivered on 15.03.2014 at wroc_love.rb in Wrocław, Poland.

Migrating a technology stack to a new language is rarely a simple task. It's getting even more challenging when what is changed is not only the language but the whole paradigm. This talk covers a story of stylefruits, where we've been gradually replacing a Ruby-based technology stack serving five million monthly visitors with Clojure. What are the costs and benefits of such a transition? How to make the migration gradual and painless? How to make Ruby and Clojure work with each other on the way? How easy is it to switch from a dynamic, object-oriented language to a functional one based on immutability and laziness? These are just some takeaways from this straight-from-the-trenches report.

Video: https://www.youtube.com/watch?v=Hv4slaRydRM

Ae7a42fb716793697b1d222f3cc753b8?s=128

Jan Stępień

March 15, 2014
Tweet

Transcript

  1. Migrating to Clojure So much fn @janstepien

  2. I work at

  3. I work at

  4. None
  5. © Seph Swain 2008 flickr.com/photos/seph_swain/2735367665

  6. (something new)

  7. © Seph Swain 2008 flickr.com/photos/seph_swain/2741483308

  8. None
  9. feature freeze! no

  10. ↓ ╭────────────╮ │ http proxy │ ╰────────────╯ ↓ ↓ ╭───────────────╮

    ╭─────────────╮ │ ruby on rails │ ← │ widgets! │ ╰───────────────╯ ╰─────────────╯ ↓ ╭──────╮ │ db │ ╰──────╯
  11. ↓ ╭────────────╮ │ http proxy │ ╰────────────╯ ↓ ↓ ╭───────────────╮

    ╭─────────────╮ │ ruby on rails │ │ widgets! │ ╰───────────────╯ ╰─────────────╯ ↓ ↓ ╭──────╮ ╭─────────────╮ │ db │ ← │ data acc. │ ╰──────╯ ╰─────────────╯
  12. ↓ ╭───────────────────────╮ │ │ │ ╭───────╯ │ ruby on rails

    │ ↓ │ │ ╭─────────────╮ │ │ │ widgets! │ ╰───────────────╯ ╰─────────────╯ ↓ ↓ ╭──────╮ ╭─────────────╮ │ db │ ← │ data acc. │ ╰──────╯ ╰─────────────╯
  13. /colour-red /50-100-euro /jeans/esprit

  14. ↓ ╭───────────────────────╮ │ │ │ ╭───────╯ │ ruby on rails

    │ ↓ │ │ ╭─────────────╮ │ │ │ widgets! │ ╰───────────────╯ ╰─────────────╯ ↓ ↓ ╭──────╮ ╭─────────────╮ │ db │ ← │ data acc. │ ╰──────╯ ╰─────────────╯
  15. ↓ ╭───────────────────────╮ │ │ │ ╭───────╯ │ ruby on rails

    │ ↓ │ │ ╭─────────────╮ │ │ │ clojure │ ╰───────────────╯ ╰─────────────╯ ↓ ↓ ╭──────╮ ╭─────────────╮ │ db │ ← │ data acc. │ ╰──────╯ ╰─────────────╯
  16. +

  17. a slide intentionally left blank

  18. immutability Object#freeze all the things

  19. => (def vector [1 2 3]) => vector [1 2

    3] => (conj vector 4) [1 2 3 4] => vector [1 2 3]
  20. widgets the cornerstone

  21. {:fetch (fn [env] (get-data-for env)) :view (fn [fetched-data] (render fetched-data))}

  22. (map render widgets) ↓ (pmap render widgets)

  23. templating worst nightmare

  24. © omefrans 2010 flickr.com/photos/omefrans/4238610113

  25. <div id=”main”> text </div> {:tag :div :attr {:id ”main”} :content

    [”text”]}
  26. repl everywhere

  27. => (def vector [1 2 3]) => vector [1 2

    3] => (conj vector 4) [1 2 3 4] => vector [1 2 3]
  28. nrepl:// repl as a service

  29. tools to the rescue

  30. community I wish I were that mature

  31. languages on jvm all feel like home

  32. mistakes we made a lot

  33. hiring not as bad as it seems

  34. future a lot to be done

  35. summing it up it was a good idea

  36. Migrating to Clojure So much fn jan.stepien@stylefruits.de jan@stepien.cc @janstepien