$30 off During Our Annual Pro Sale. View Details »

[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

Jan Stępień

March 15, 2014
Tweet

More Decks by Jan Stępień

Other Decks in Programming

Transcript

  1. Migrating to Clojure
    So much fn
    @janstepien

    View Slide

  2. I work at

    View Slide

  3. I work at

    View Slide

  4. View Slide

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

    View Slide

  6. (something
    new)

    View Slide

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

    View Slide

  8. View Slide

  9. feature freeze!
    no

    View Slide


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

    ╭──────╮
    │ db │
    ╰──────╯

    View Slide


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

    View Slide


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

    View Slide

  13. /colour-red
    /50-100-euro
    /jeans/esprit

    View Slide


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

    View Slide


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

    View Slide

  16. +

    View Slide

  17. a slide intentionally left blank

    View Slide

  18. immutability
    Object#freeze all the things

    View Slide

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

    View Slide

  20. widgets
    the cornerstone

    View Slide

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

    View Slide

  22. (map render widgets)

    (pmap render widgets)

    View Slide

  23. templating
    worst nightmare

    View Slide

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

    View Slide


  25. text

    {:tag :div
    :attr {:id ”main”}
    :content [”text”]}

    View Slide

  26. repl
    everywhere

    View Slide

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

    View Slide

  28. nrepl://
    repl as a service

    View Slide

  29. tools
    to the rescue

    View Slide

  30. community
    I wish I were that mature

    View Slide

  31. languages
    on jvm all feel like home

    View Slide

  32. mistakes
    we made a lot

    View Slide

  33. hiring
    not as bad as it seems

    View Slide

  34. future
    a lot to be done

    View Slide

  35. summing it up
    it was a good idea

    View Slide

  36. Migrating to Clojure
    So much fn
    [email protected]
    [email protected]
    @janstepien

    View Slide