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

The Future of Rails

The Future of Rails

A talk about the future of Rails and the future of Rails developers, written for junior developers studying at RMIT.

Ryan Bigg

April 30, 2018
Tweet

More Decks by Ryan Bigg

Other Decks in Programming

Transcript

  1. Mentor / Author / Developer

    View Slide

  2. View Slide

  3. PART
    ONE

    View Slide

  4. View Slide

  5. View Slide

  6. ISN’T RAILS
    THE FUTURE OF RAILS
    AS YOU KNOW IT TODAY

    View Slide

  7. View Slide

  8. View Slide

  9. A browser
    Database
    Backend
    App
    Models
    Rails App
    In the past…

    View Slide

  10. View Slide

  11. A browser
    JS App
    Database
    Frontend
    App
    Backend
    App
    Models
    Rails App
    Now…

    View Slide

  12. COMMUNICATION
    A browser
    JS App
    Models
    Database
    Rails App
    ???

    View Slide

  13. A browser
    JS App
    Models
    Database
    Rails App
    REST + JSON API
    /api/posts
    /api/comments

    Currently…
    JSON APIs

    View Slide

  14. GET /api/posts/1
    {
    "id": 1,
    "title": "Hello World",
    "body": "This is my blog's first post."
    "author": "Ryan Bigg"
    }
    JSON APIs

    View Slide

  15. GET /api/posts/1/comments
    [
    {
    text: "Great first post!",
    by: "Totally not Ryan"
    },
    ...
    ]
    JSON APIs

    View Slide

  16. A browser
    JS App
    Models
    Database
    Rails App
    REST + JSON API
    /api/posts
    /api/comments

    Currently…
    JSON APIs
    Need to build lots of these…

    View Slide

  17. EVERYONE
    DOES THIS

    View Slide

  18. EVEN
    FACEBOOK

    View Slide

  19. Well…
    they did

    View Slide

  20. A browser
    JS App
    Models
    Database
    Rails App
    /graphql
    Now…
    GRAPHQL
    Only one endpoint
    (born 2012)

    View Slide

  21. POST /graphql
    query postQuery {
    post(id: 1) {
    id
    title
    body
    author
    comments {
    text
    by
    }
    }
    }
    {
    "data": {
    "post": {
    "id": 1,
    "title": "Hello World",
    "body": "First post!”,
    "author": "Ryan Bigg",
    "comments": [
    {
    text: "Great first post!",
    by: "Totally not Ryan"
    },
    ...
    ]
    }
    }
    }
    Query Response
    GRAPHQL

    View Slide

  22. POST /graphql
    query postQuery {
    post(id: 1) {
    id
    title
    body
    author
    comments {
    text
    by
    }
    }
    }
    {
    "data": {
    "post": {
    "id": 1,
    "title": "Hello World",
    "author": "Ryan Bigg",
    "comments": [
    {
    text: "Great first post!",
    by: "Totally not Ryan"
    },
    ...
    ]
    }
    }
    }
    Query Response
    GRAPHQL

    View Slide

  23. POST /graphql
    query commentQuery {
    comment(id: 1) {
    text
    user
    }
    }
    {
    "data": {
    “comment”: {
    text: "Great first post!",
    user: "Totally not Ryan”
    }
    }
    }
    Query Response
    GRAPHQL

    View Slide

  24. GRAPHQL
    IS THE FUTURE

    View Slide

  25. GRAPHQL
    IS THE FUTURE
    (or at least, it seems like it)

    View Slide

  26. THE FUTURE OF RAILS
    Frontend + Backend apps
    talking over
    GraphQL

    View Slide

  27. View Slide

  28. END
    PART
    ONE

    View Slide

  29. PART
    TWO

    View Slide

  30. View Slide

  31. RAILS
    IS ALWAYS CHANGING

    View Slide

  32. Then… Now…

    View Slide

  33. THE NEW
    SHINY
    IS ALWAYS CHANGING

    View Slide

  34. JSON GRAPHQL
    APIs APIs

    View Slide

  35. RAILS
    IS JUST A TOOL

    View Slide

  36. APIs
    ARE A CONCEPT

    View Slide

  37. THERE ARE
    INFINITY
    THINGS TO LEARN

    View Slide

  38. FOCUS ON
    CONCEPTS

    NOT
    TOOLS

    View Slide

  39. { name: “Ryan”, age: 30 }
    %{ name: “Ryan”, age: 30 }
    Ruby
    Elixir

    View Slide

  40. h = { name: “Ryan” }
    if h.has_key?(:name)
    puts “Name: #{h[:name]}”
    else
    puts “name is not present”
    end
    Ruby
    Elixir
    fn
    %{name: name} -> IO.puts(“name: #{name}”)
    _ -> IO.puts(“name is not present”)
    end

    View Slide

  41. CONCEPTS

    SPAN
    TOOLS

    View Slide

  42. What is a funcFon?

    View Slide

  43. How do
    pages load?

    View Slide

  44. /graphql is
    returning an HTTP
    500 status code
    Why?

    View Slide

  45. The app
    stopped
    responding.

    View Slide

  46. CPU usage is high.
    Can you find out why?

    View Slide

  47. What is
    “clean code”?

    View Slide

  48. Is this
    “clean code”?

    View Slide

  49. What do other
    developers consider
    “best pracFce”?

    View Slide

  50. Follow the code.

    View Slide

  51. ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    ………………………………………………………………………………………………………………
    Test the code.

    View Slide

  52. END
    PART
    TWO

    View Slide

  53. ✉: [email protected]
    Thanks!
    : @ryanbigg
    ▶: h?p:/
    /bit.ly/radar-for

    View Slide

  54. h?ps:/
    /developer.github.com/v3/
    API Examples
    REST + JSON
    h?ps:/
    /developer.github.com/v4/
    GRAPHQL

    View Slide

  55. h?ps:/
    /www.howtographql.com/
    Learn these:
    GraphQL
    h?ps:/
    /reactjs.org/tutorial/tutorial.html
    React

    View Slide

  56. h?ps:/
    /www.sandimetz.com/99bo?les/
    Read these:
    99 BOTTLES
    h?ps:/
    /www.poodr.com
    PRACTICAL OBJECT-ORIENTED DESIGN IN RUBY

    View Slide

  57. h?ps:/
    /joyofelixir.com
    Learn Elixir from scratch!

    View Slide

  58. h?ps:/
    /speakerdeck.com/radar/exploding-rails
    h?ps:/
    /leanpub.com/exploding-rails
    Exploding Rails

    h?ps:/
    /github.com/radar/twist-v2
    MY EXAMPLE APPLICATION

    View Slide