Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Ciao!

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

First Ruby Conference since 2019!!!

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Some things have changed…

Slide 8

Slide 8 text

Ruby 3 has landed!

Slide 9

Slide 9 text

Man City fi nally won the Champions League

Slide 10

Slide 10 text

Messi fi nally won the World Cup

Slide 11

Slide 11 text

Napoli fi nally won Serie A

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Божидар

Slide 15

Slide 15 text

Bozhidar

Slide 16

Slide 16 text

Bozhidar

Slide 17

Slide 17 text

Bug cool

Slide 18

Slide 18 text

@bbatsov

Slide 19

Slide 19 text

Sofia, Bulgaria So fi a, Bulgaria

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

bbatsov

Slide 22

Slide 22 text

Ruby & Rails style guides

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

LSP support is coming!

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

batsov.com

Slide 27

Slide 27 text

metaredux.com

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

–Matz “I think a programming language should have a philosophy of helping our thinking, and so Ruby’s focus is on productivity and the joy of programming. If you feel comfortable with Ruby’s philosophy, that means Ruby is your language.”

Slide 39

Slide 39 text

Ruby’s Creed

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Dictionary Definitions

Slide 42

Slide 42 text

Ruby

Slide 43

Slide 43 text

noun 1. a precious stone consisting of corundum in colour varieties varying from deep crimson or purple to pale rose. 2. a programming language optimised for programmer happiness

Slide 44

Slide 44 text

Creed

Slide 45

Slide 45 text

noun 1. a system of religious belief; a faith.

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Motto

Slide 48

Slide 48 text

noun 1. a short sentence or phrase chosen as encapsulating the beliefs or ideals of an individual, family, or institution.

Slide 49

Slide 49 text

Motto by Example

Slide 50

Slide 50 text

There’s more than one way to do it. — Perl

Slide 51

Slide 51 text

Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. — The Zen of Python

Slide 52

Slide 52 text

A programmer’s best friend. — ruby-lang.org

Slide 53

Slide 53 text

Ruby is optimised for programmer happiness. — Matz

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. — ruby-lang.org

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Culture is the behaviours you reward and punish.

Slide 58

Slide 58 text

Culture is the things you do, not the things you say you’ll do.

Slide 59

Slide 59 text

Creed by Example

Slide 60

Slide 60 text

Clojure has never broken backwards compatibility.

Slide 61

Slide 61 text

Clojure favours a small library and changes/additions are made rarely.

Slide 62

Slide 62 text

2129 commits in 14 years! (Clojure 1.0 was released in 2009)

Slide 63

Slide 63 text

In contrast, between 1.30 and 1.31, six weeks of development, Rust had 1,694 commits.

Slide 64

Slide 64 text

Between Ruby 3.1 and 3.2 5000+ commits were added

Slide 65

Slide 65 text

What is Programmer Happiness?

Slide 66

Slide 66 text

5.times do puts 'Ruby rocks!' end

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Happiness is something very subjective

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

(take 10 (filter even? (iterate inc 1)))

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Happiness is individual

Slide 73

Slide 73 text

There’s more than one way to do it. — Perl

Slide 74

Slide 74 text

There’s more than one way to do it. — Ruby

Slide 75

Slide 75 text

core library method aliases

Slide 76

Slide 76 text

collect => map/filter inject => reduce detect => find select => find_all sprintf => format length => size raise => fail

Slide 77

Slide 77 text

map reduce find filter format length raise

Slide 78

Slide 78 text

Single-quoted & double-quoted string literals

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

Different hash literals • {:one => 1, :two => 2} • {one: 1, two: 2}

Slide 81

Slide 81 text

Plenty of “controversial” features • Flip- fl ops • For loops • Global variables • Magic arguments ($_) • Re fi nements • Optional static typing

Slide 82

Slide 82 text

Things I value • Simple and consistent syntax • Functional style of programming • Useful standard library • Backwards compatibility • Development tooling • Ecosystem (3rd party libraries, frameworks, etc) • Community

Slide 83

Slide 83 text

(Modern) Ruby Features I dislike • Ruby 1.9 hash literals • Re fi nements • %i literals • Rational/Complex literals (2/3r, 2+1i) • Endless ranges (1..) • Safe navigation operator (&.) • Static typing

Slide 84

Slide 84 text

Grading Recent Ruby Releases

Slide 85

Slide 85 text

Scores • 5 - a change that makes me very happy • 4 - a change that makes me happy • 3 - I’m ambivalent towards the change • 2 - a change that makes me unhappy • 1 - a change that makes me very unhappy

Slide 86

Slide 86 text

Ruby 2.7 • Pattern matching is added as an experimental feature (4/5) • Real keyword parameters (3/5) • Nice improvement, that creates a lot of maintenance overhead • Numbered block parameters - e.g. _1, _2 (2/5) • [10, 20, 30].map { _1**2 } • Beginless range - e.g. ..20 (2/5) • users.map(&:age).any?(...18)

Slide 87

Slide 87 text

# traditional Ruby [1, 2, 3].each { |i| puts i } (1..10).map { |i| i * 3 } (1..9).each_slice(3).map { |x, y, z| x + y + z } # Ruby 2.7 [1, 2, 3].each { puts @1 } (1..10).map { @1 * 3 } (1..9).each_slice(3).map { @1 + @2 + @3 }

Slide 88

Slide 88 text

h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" } # vs h = Hash.new { @1[@2] = "Go Fish: #{@2}" }

Slide 89

Slide 89 text

Ruby 3.0 • Full separation of keyword arguments (3/5) • Moar maintenance pain for the sake of long-term gain • Ractors (3/5) • Non-blocking IO with Fibers (3/5) • Pattern matching is no longer experimental (4/5) • Endless methods (2/5) • def foo = bar

Slide 90

Slide 90 text

Ruby 3.1 • Hash literal value omission (2/5) • x, y = 1, 2; h = {x:, y:} • Anonymous block argument (2/5) • def filter(data, &)= data.select(&) • Pattern matching improvements (4/5)

Slide 91

Slide 91 text

Ruby 3.2 • Anonymous method argument (**) forwarding (4/5) • Better inspectable re fi nements (3/5) • Data class (4/5) • Set is now a built-in class (5/5) • Per- fi ber storage (3/5) • More pattern matching improvements (3/5)

Slide 92

Slide 92 text

No new features!

Slide 93

Slide 93 text

Shiny new stuff!

Slide 94

Slide 94 text

Too many new features!

Slide 95

Slide 95 text

I hate new stuff!

Slide 96

Slide 96 text

Ruby is mostly an object- oriented language…

Slide 97

Slide 97 text

That borrows a bit from functional programming

Slide 98

Slide 98 text

It’s dynamically typed

Slide 99

Slide 99 text

But now has optional static typing

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

Rails is an omakase.

Slide 103

Slide 103 text

Ruby is a la carte.

Slide 104

Slide 104 text

Ruby Style Guide & RuboCop

Slide 105

Slide 105 text

So, what is Ruby’s creed?

Slide 106

Slide 106 text

A language fl exible enough that most programmers would be (somewhat )happy with it

Slide 107

Slide 107 text

A language where the BDFL usually listens to the broader community

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

Grazie! twitter: @bbatsov github: @bbatsov https://metaredux.com https://emacsredux.com RubyDay 2023 Verona, Italy 16.06.2023

Slide 110

Slide 110 text

Feedback welcome!