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
52
0
Share
Playing with Sorbet
A short presentation about how Sorbet could help your project
Luciano Sousa
September 12, 2019
More Decks by Luciano Sousa
See All by Luciano Sousa
Knowing mina deploy
lucianosousa
1
77
Creating your startup without Developer
lucianosousa
0
170
Patterns Falacy v2
lucianosousa
0
120
Project Management like Software Developer
lucianosousa
1
110
The Patterns Falacy - Rails Version
lucianosousa
1
120
Sinatra::Ftw
lucianosousa
0
110
Other Decks in Programming
See All in Programming
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
240
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
SkillがSkillを生む:QA観点出しを自動化した
sontixyou
6
3.1k
3分でわかるatama plusのQA/about atama plus QA
atamaplus
0
110
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.3k
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
140
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
220
「速くなった気がする」をデータで疑う
senleaf24
0
150
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
210
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
410
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
8
4.9k
事業会社でのセキュリティ長期インターンについて
masachikaura
0
230
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
480
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Statistics for Hackers
jakevdp
799
230k
Skip the Path - Find Your Career Trail
mkilby
1
100
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
200
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Code Review Best Practice
trishagee
74
20k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
250
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
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!