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
43
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
58
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
97
Sinatra::Ftw
lucianosousa
0
85
Other Decks in Programming
See All in Programming
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
190
asdf-ecspresso作って 友達が増えた話 / Fujiwara Tech Conference 2025
koluku
0
1.4k
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.4k
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
880
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
600
情報漏洩させないための設計
kubotak
5
1.3k
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
7
1.4k
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
460
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.2k
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
310
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
960
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
550
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Become a Pro
speakerdeck
PRO
26
5.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Automating Front-end Workflow
addyosmani
1366
200k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Navigating Team Friction
lara
183
15k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
240
Designing on Purpose - Digital PM Summit 2013
jponch
116
7.1k
RailsConf 2023
tenderlove
29
970
Faster Mobile Websites
deanohume
305
30k
Code Review Best Practice
trishagee
65
17k
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!