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
50
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
73
Creating your startup without Developer
lucianosousa
0
160
Patterns Falacy v2
lucianosousa
0
120
Project Management like Software Developer
lucianosousa
1
110
The Patterns Falacy - Rails Version
lucianosousa
1
110
Sinatra::Ftw
lucianosousa
0
100
Other Decks in Programming
See All in Programming
ThorVG Viewer In VS Code
nors
0
750
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.7k
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
5
4.2k
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
180
dchart: charts from deck markup
ajstarks
3
970
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
190
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
150
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
350
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
520
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
400
CSC307 Lecture 02
javiergs
PRO
1
770
Featured
See All Featured
Building an army of robots
kneath
306
46k
Being A Developer After 40
akosma
91
590k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
910
Mind Mapping
helmedeiros
PRO
0
55
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
300
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
The Spectacular Lies of Maps
axbom
PRO
1
450
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.3k
AI: The stuff that nobody shows you
jnunemaker
PRO
2
200
Abbi's Birthday
coloredviolet
1
4.5k
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!