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

Where do Rubyists go?

Where do Rubyists go?

Many Rubyists branch out and take a look at other languages. What are similarities between those languages and ruby? What are differences? How does Ruby influence these languages?

Tobias Pfeiffer

January 26, 2018
Tweet

More Decks by Tobias Pfeiffer

Other Decks in Programming

Transcript

  1. Look at all these toys!

    View full-size slide

  2. Help – it’s Ruby!

    View full-size slide

  3. Is Ruby dying?

    View full-size slide

  4. Where do Rubyists go?

    View full-size slide

  5. Where do Rubyists go?
    Tobias Pfeiffer
    @PragTob
    pragtob.info

    View full-size slide

  6. 673 Responses

    View full-size slide

  7. First Rails Release

    View full-size slide

  8. “I had written half of Rails in
    PHP. Then Rails was announced
    and it was like a cheat code to
    a working framework.”
    Why did you learn Ruby?

    View full-size slide

  9. First Rails Girls Workshop

    View full-size slide

  10. First Rails Girls Berlin Workshop

    View full-size slide

  11. Surveys and Bias

    View full-size slide

  12. Like some bias?

    View full-size slide

  13. Like to do Ruby in 5 years?

    View full-size slide

  14. Meet & Greet

    View full-size slide

  15. 1990 1995 2000 2005 2010 2015

    View full-size slide

  16. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Ruby
    All of them
    Metaprogramming, dynamic,
    Scripting, web
    A dynamic, open source
    programming language with a
    focus on simplicity and
    productivity.

    View full-size slide

  17. 1
    2
    Fizz
    4
    Buzz
    Fizz

    View full-size slide

  18. 1
    2
    Fizz
    4
    Buzz
    Fizz
    7
    8
    Fizz
    Buzz
    11
    Fizz
    13
    14

    View full-size slide

  19. 1
    2
    Fizz
    4
    Buzz
    Fizz
    7
    8
    Fizz
    Buzz
    11
    Fizz
    13
    14
    FizzBuzz

    View full-size slide

  20. 1
    2
    Fizz
    4
    Buzz
    Fizz
    7
    8
    Fizz
    Buzz
    11
    Fizz
    13
    14
    FizzBuzz
    16

    View full-size slide

  21. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  22. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  23. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  24. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  25. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  26. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  27. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  28. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Crystal
    Erik Berlin, Piotr Szotkowski,
    Fabio Akita
    Ruby-like, Performance, Type
    Inference
    Fast as C, slick as Ruby

    View full-size slide

  29. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}

    View full-size slide

  30. def fizzbuzz(n)
    if (n % 15).zero?
    "FizzBuzz"
    elsif (n % 5).zero?
    "Buzz"
    elsif (n % 3).zero?
    "Fizz"
    else
    n
    end
    end
    (1..100).each {|n| puts fizzbuzz(n)}
    cp fizzbuzz.rb fizzbuzz.cr

    View full-size slide

  31. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Elixir
    José Valim, Dave Thomas,
    Xavier Noria
    Erlang VM, Actors, Functional,
    Phoenix
    dynamic, functional language
    designed for building scalable
    and maintainable applications.

    View full-size slide

  32. defmodule FizzBuzz do
    def fizzbuzz(n) when rem(n, 15) == 0, do: "FizzBuzz"
    def fizzbuzz(n) when rem(n, 5) == 0, do: "Buzz"
    def fizzbuzz(n) when rem(n, 3) == 0, do: "Fizz"
    def fizzbuzz(n), do: n
    end
    Enum.each(1..100, fn i -> IO.puts(FizzBuzz.fizzbuzz(i)) end)

    View full-size slide

  33. defmodule FizzBuzz do
    def fizzbuzz(n) when rem(n, 15) == 0, do: "FizzBuzz"
    def fizzbuzz(n) when rem(n, 5) == 0, do: "Buzz"
    def fizzbuzz(n) when rem(n, 3) == 0, do: "Fizz"
    def fizzbuzz(n), do: n
    end
    Enum.each(1..100, fn i -> IO.puts(FizzBuzz.fizzbuzz(i)) end)

    View full-size slide

  34. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Haskell
    Chad Fowler
    Type System, Monads, Pure
    An advanced, purely functional
    programming language.

    View full-size slide

  35. main = mapM_ (putStrLn . fizzbuzz) [1..100]
    fizzbuzz x
    | x `mod` 15 == 0 = "FizzBuzz"
    | x `mod` 3 == 0 = "Fizz"
    | x `mod` 5 == 0 = "Buzz"
    | otherwise = show x

    View full-size slide

  36. main = mapM_ (putStrLn . fizzbuzz) [1..100]
    fizzbuzz x
    | x `mod` 15 == 0 = "FizzBuzz"
    | x `mod` 3 == 0 = "Fizz"
    | x `mod` 5 == 0 = "Buzz"
    | otherwise = show x

    View full-size slide

  37. main = mapM_ (putStrLn . fizzbuzz) [1..100]
    fizzbuzz x
    | x `mod` 15 == 0 = "FizzBuzz"
    | x `mod` 3 == 0 = "Fizz"
    | x `mod` 5 == 0 = "Buzz"
    | otherwise = show x

    View full-size slide

  38. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Go
    Katrina Owen, Evan Phoenix
    Goroutines, Simple, No
    Exceptions, No Generics
    open source programming
    language that makes it easy to
    build simple, reliable, and
    efficient software.

    View full-size slide

  39. package main
    import "fmt"
    import "strconv"
    func FizzBuzz(i int) string {
    switch {
    case i%15 == 0:
    return "FizzBuzz"
    case i%3 == 0:
    return "Fizz"
    case i%5 == 0:
    return "Buzz"
    default:
    return strconv.Itoa(i)
    }
    }
    func main() {
    for i := 1; i <= 100; i++ {
    fmt.Println(FizzBuzz(i))
    }
    }

    View full-size slide

  40. package main
    import "fmt"
    import "strconv"
    func FizzBuzz(i int) string {
    switch {
    case i%15 == 0:
    return "FizzBuzz"
    case i%3 == 0:
    return "Fizz"
    case i%5 == 0:
    return "Buzz"
    default:
    return strconv.Itoa(i)
    }
    }
    func main() {
    for i := 1; i <= 100; i++ {
    fmt.Println(FizzBuzz(i))
    }
    }

    View full-size slide

  41. package main
    import "fmt"
    import "strconv"
    func FizzBuzz(i int) string {
    switch {
    case i%15 == 0:
    return "FizzBuzz"
    case i%3 == 0:
    return "Fizz"
    case i%5 == 0:
    return "Buzz"
    default:
    return strconv.Itoa(i)
    }
    }
    func main() {
    for i := 1; i <= 100; i++ {
    fmt.Println(FizzBuzz(i))
    }
    }

    View full-size slide

  42. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Rust
    Steve Klabnik,
    Yehuda Katz, Sean Griffin
    Memory Management,
    Compiler, Firefox Quantum
    a systems programming
    language that runs blazingly
    fast, prevents segfaults, and
    guarantees thread safety.

    View full-size slide

  43. fn main() {
    (1..101).for_each(|n| println!("{}", fizzbuzz(n)))
    }
    fn fizzbuzz(n: i32) -> String {
    match (n % 3, n % 5) {
    (0, 0) => "FizzBuzz".to_string(),
    (0, _) => "Fizz".to_string(),
    (_, 0) => "Buzz".to_string(),
    _ => n.to_string(),
    }
    }

    View full-size slide

  44. fn main() {
    (1..101).for_each(|n| println!("{}", fizzbuzz(n)))
    }
    fn fizzbuzz(n: i32) -> String {
    match (n % 3, n % 5) {
    (0, 0) => "FizzBuzz".to_string(),
    (0, _) => "Fizz".to_string(),
    (_, 0) => "Buzz".to_string(),
    _ => n.to_string(),
    }
    }

    View full-size slide

  45. fn main() {
    (1..101).for_each(|n| println!("{}", fizzbuzz(n)))
    }
    fn fizzbuzz(n: i32) -> String {
    match (n % 3, n % 5) {
    (0, 0) => "FizzBuzz".to_string(),
    (0, _) => "Fizz".to_string(),
    (_, 0) => "Buzz".to_string(),
    _ => n.to_string(),
    }
    }

    View full-size slide

  46. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    JavaScript
    Yehuda Katz, Jeremy Ashkenas
    Quirks, Async, Compile to
    a lightweight interpreted or JIT-
    compiled programming
    language with first-class
    functions.

    View full-size slide

  47. const fizzBuzz = n => {
    if (n % 15 === 0) {
    return "FizzBuzz";
    } else if (n % 3 === 0) {
    return "Fizz";
    } else if (n % 5 === 0) {
    return "Buzz";
    } else {
    return n;
    }
    };
    for (let n = 1; n <= 100; n += 1) {
    console.log(fizzBuzz(n));
    }

    View full-size slide

  48. const fizzBuzz = n => {
    if (n % 15 === 0) {
    return "FizzBuzz";
    } else if (n % 3 === 0) {
    return "Fizz";
    } else if (n % 5 === 0) {
    return "Buzz";
    } else {
    return n;
    }
    };
    for (let n = 1; n <= 100; n += 1) {
    console.log(fizzBuzz(n));
    }

    View full-size slide

  49. const fizzBuzz = n => {
    if (n % 15 === 0) {
    return "FizzBuzz";
    } else if (n % 3 === 0) {
    return "Fizz";
    } else if (n % 5 === 0) {
    return "Buzz";
    } else {
    return n;
    }
    };
    for (let n = 1; n <= 100; n += 1) {
    console.log(fizzBuzz(n));
    }

    View full-size slide

  50. Name:
    Popular Rubyists:
    Known for:
    Self-assessment:
    Clojure
    Russ Olsen, Bozhidar
    Batsov, Arne Brasseur
    Rich Hickey, Lisp, JVM, ()
    a robust, practical, and fast
    programming language with a
    set of useful features that
    together form a simple,
    coherent, and powerful tool.

    View full-size slide

  51. (defn fizzbuzz [n]
    (cond
    (zero? (mod n 15)) "FizzBuzz"
    (zero? (mod n 3)) "Fizz"
    (zero? (mod n 5)) "Buzz"
    :else n))
    (run! println (map fizzbuzz (range 1 101)))

    View full-size slide

  52. (defn fizzbuzz [n]
    (cond
    (zero? (mod n 15)) "FizzBuzz"
    (zero? (mod n 3)) "Fizz"
    (zero? (mod n 5)) "Buzz"
    :else n))
    (run! println (map fizzbuzz (range 1 101)))

    View full-size slide

  53. (defn fizzbuzz [n]
    (cond
    (zero? (mod n 15)) "FizzBuzz"
    (zero? (mod n 3)) "Fizz"
    (zero? (mod n 5)) "Buzz"
    :else n))
    (run! println (map fizzbuzz (range 1 101)))

    View full-size slide

  54. What you got?

    View full-size slide

  55. Procedural Procedural
    Functional
    Functional
    Procedural
    Functional
    Object Object Functional Functional

    View full-size slide

  56. Parallelism vs Concurrency

    View full-size slide

  57. Yes
    Goroutines +
    channels
    Yes
    Agnostic
    Yes/No
    Webworkers+
    Yes
    STM, pmap,
    Transducers
    Concurrent Concurrent Yes
    Actors
    Yes
    Mvar, par,
    STM

    View full-size slide

  58. Performance!

    View full-size slide

  59. Static
    Inferred
    Static
    Inferred
    Dynamic
    Optional
    Inferred++
    Dynamic
    Optional
    Inferred++
    Dynamic Static
    Inferred++
    Dynamic
    Optional
    Inferred++
    Static
    Inferred++

    View full-size slide

  60. Compiled
    vs
    Interpreted

    View full-size slide

  61. Compiled Compiled Interpreted Compiled
    Interpreted Compiled Compiled Compiled

    View full-size slide

  62. Show me your code

    View full-size slide

  63. Yes Yes No No
    No Yes Yes Yes

    View full-size slide

  64. Garbage-
    Collection

    View full-size slide

  65. Yes No Yes Yes
    Yes Yes Yes Yes

    View full-size slide

  66. Single File
    Distribution

    View full-size slide

  67. Yes Yes No No
    No Yes Yes Yes

    View full-size slide

  68. Ruby-like
    Syntax

    View full-size slide

  69. No No No No
    Yes Yes Yes No

    View full-size slide

  70. Parallel
    Typing

    View full-size slide

  71. Parallel
    Typing
    Fast

    View full-size slide

  72. Expand Your Mind

    View full-size slide

  73. “Ruby's OO model was
    brain-expanding, and I was
    seeking more brain-expanding
    paradigms that would let me
    think entirely new thoughts.”
    Why did you learn a new language?

    View full-size slide

  74. Where does
    Ruby go?

    View full-size slide

  75. “Rails is strangling Ruby. In the
    same way that you don't quit
    because of a bad company, you
    quit because of a bad boss.”

    View full-size slide

  76. Where does
    Ruby go?

    View full-size slide

  77. Parallel
    Typing
    Fast

    View full-size slide

  78. “Ruby is the best language I
    have used over my 30 years
    programming. I hope Ruby 3
    puts an end to the Ruby is
    slow meme once and for all.”

    View full-size slide

  79. “I really like Ruby for what it is,
    and don't think 'adding a type
    system' or something is the best
    way to keep Ruby relevant. Don't
    morph Ruby in to something
    it's not.”

    View full-size slide

  80. We’re all great!

    View full-size slide

  81. Explore some new lands!

    View full-size slide

  82. Enjoy Coding & Learning in whatever
    language...
    Tobias Pfeiffer
    @PragTob
    pragtob.info

    View full-size slide