–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.
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
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