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
47
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
71
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
89
Other Decks in Programming
See All in Programming
CSC509 Lecture 08
javiergs
PRO
0
250
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
190
One Enishi After Another
snoozer05
PRO
0
160
Migration to Signals, Resource API, and NgRx Signal Store
manfredsteyer
PRO
0
120
React Nativeならぬ"Vue Native"が実現するかも?_新世代マルチプラットフォーム開発フレームワークのLynxとLynxのVue.js対応を追ってみよう_Vue Lynx
yut0naga1_fa
2
950
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
840
Writing Better Go: Lessons from 10 Code Reviews
konradreiche
3
6.7k
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
110
CSC305 Lecture 09
javiergs
PRO
0
310
ALL CODE BASE ARE BELONG TO STUDY
uzulla
28
6.7k
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.9k
CSC509 Lecture 07
javiergs
PRO
0
240
Featured
See All Featured
Building an army of robots
kneath
305
46k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
A Tale of Four Properties
chriscoyier
161
23k
Writing Fast Ruby
sferik
630
62k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Music & Morning Musume
bryan
46
6.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
The Cult of Friendly URLs
andyhume
79
6.6k
Six Lessons from altMBA
skipperchong
29
4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
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!