Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Playing with Sorbet
Search
Luciano Sousa
September 12, 2019
Programming
0
45
Playing with Sorbet
A short presentation about how Sorbet could help your project
Luciano Sousa
September 12, 2019
Tweet
Share
More Decks by Luciano Sousa
See All by Luciano Sousa
Knowing mina deploy
lucianosousa
1
61
Creating your startup without Developer
lucianosousa
0
160
Patterns Falacy v2
lucianosousa
0
110
Project Management like Software Developer
lucianosousa
1
100
The Patterns Falacy - Rails Version
lucianosousa
1
98
Sinatra::Ftw
lucianosousa
0
86
Other Decks in Programming
See All in Programming
snacks.nvim内のセットアップ不要なプラグインを紹介 / introduce_snacks_nvim
uhooi
0
310
보일러플레이트 코드가 진짜 나쁜 건가요?
gaeun5744
0
360
いまさら聞けない生成AI入門: 「生成AIを高速キャッチアップ」
soh9834
11
3.3k
ニックトレイン登壇資料
ryotakurokawa
0
130
Devin入門と最近のアップデートから見るDevinの進化 / Introduction to Devin and the Evolution of Devin as Seen in Recent Update
rkaga
7
3.1k
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
190
CTFのWebにおける⾼難易度問題について
hamayanhamayan
1
930
リアクティブシステムの変遷から理解するalien-signals / Learning alien-signals from the evolution of reactive systems
yamanoku
1
270
Scala 3 で GLSL のための c-like-for を実装してみた
exoego
1
170
아직도 SOLID 를 '글'로만 알고 계신가요?
sh1mj1
0
350
Firebase Dynamic Linksの代替手段を自作する / Create your own Firebase Dynamic Links alternative
kubode
0
160
生産性アップのためのAI個人活用
kunoyasu
0
470
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Designing for humans not robots
tammielis
250
25k
GraphQLとの向き合い方2022年版
quramy
45
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Practical Orchestrator
shlominoach
186
10k
Unsuck your backbone
ammeep
669
57k
Making the Leap to Tech Lead
cromwellryan
133
9.2k
Into the Great Unknown - MozCon
thekraken
35
1.7k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
320
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Facilitating Awesome Meetings
lara
53
6.3k
Transcript
Playing with Sorbet
What
Sorbet is a fast, powerful type checker designed for Ruby.
Why
Once upon a time
We expose a public API
Expecting params = { user: { first_name: "Luciano", last_name: "Sousa"
} }
We got a
params = { user: "a" }
TypeError (no implicit conversion of Symbol into Integer)
None
NoMethodError (undefined method `where' for nil:NilClass)
Let’s talk about Java
None
Let’s talk about dynamic vs static typed languages
• •
• • •
String javaString = new String(“I am a Java string”) ruby_string
= “I am a Ruby string”
Dynamic languages
Ruby
Examples
begin do_something rescue StandardErro do_something_else end
Tests
Let's talk about Shopify
~1500 devs
~40 deploys/day
~5 million req/min
~83k req/sec ~170k req/sec peak
Sorbet at Shopify
~36 issues fixed
~17 dead code never hit
~16 name error
~3 wrong args
Maybe some millions
Examples
“I hate type annotations.”
class UserHelper def name_length(name) name.length end end
# typed: true class UserHelper def name_length(name) name.length end end
# typed: true class UserHelper extend T::Sig def name_length(name) name.length
end end
# typed: true class UserHelper extend T::Sig sig { params(name:
String).returns(Integer) } def name_length(name) name.length end end
How it works
Disclaimer
None
# typed: true
None
extend T::Sig
sig { params(name: String).returns(Integer) }
sig { params(name: String).returns(Integer) }
Resources •
Resources •
Resources •
Resources •
Thanks!