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
40
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
54
Creating your startup without Developer
lucianosousa
0
150
Patterns Falacy v2
lucianosousa
0
110
Project Management like Software Developer
lucianosousa
1
96
The Patterns Falacy - Rails Version
lucianosousa
1
91
Sinatra::Ftw
lucianosousa
0
81
Other Decks in Programming
See All in Programming
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
120
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
440
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
470
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
160
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
480
Exploring the Implementation of “t.Run”, “t.Parallel”, and “t.Cleanup”
akarin
1
110
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
240
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
200
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
170
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
220
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
100
Featured
See All Featured
Become a Pro
speakerdeck
PRO
13
4.6k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Typedesign – Prime Four
hannesfritz
36
2.1k
What the flash - Photography Introduction
edds
64
11k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
Stop Working from a Prison Cell
hatefulcrawdad
267
19k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
19
6.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Clear Off the Table
cherdarchuk
85
310k
GitHub's CSS Performance
jonrohan
1025
450k
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!