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
Оптимизируем производительность блока Казначейство
lamodatech
0
960
Androidアプリの One Experience リリース
nein37
0
1.2k
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
Beyond ORM
77web
11
1.6k
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
390
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
7
1.4k
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
180
Package Traits
ikesyo
1
210
Azure AI Foundryのご紹介
qt_luigi
1
210
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
710
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
950
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
Fireside Chat
paigeccino
34
3.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
KATA
mclloyd
29
14k
Building Applications with DynamoDB
mza
93
6.2k
What's in a price? How to price your products and services
michaelherold
244
12k
A designer walks into a library…
pauljervisheath
205
24k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Being A Developer After 40
akosma
89
590k
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!