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
Writing testable code
Search
Rodrigo Boniatti
November 30, 2019
Programming
0
49
Writing testable code
Rodrigo Boniatti
November 30, 2019
Tweet
Share
More Decks by Rodrigo Boniatti
See All by Rodrigo Boniatti
The pillars of integration
boniatti
0
61
Designing and building software with Ruby on Rails
boniatti
0
44
Mobile development with React Native
boniatti
1
3.5k
Other Decks in Programming
See All in Programming
なぜ宣言的 UI は壊れにくいのか / Why declarative UI is less fragile
uenitty
29
13k
リハビリmruby
kishima
1
160
Trial
cairolibrary720
1
130
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
1
450
AWSでゲームサーバーを運用! Amazon GameLiftのお話
iriikeita
0
200
【Go言語】golangci-lintの使い方
tomo1227
0
280
わかりやすい正解を捨てて、コトに向き合う - スクラムフェス金沢2024 スポンサーセッション
yusukekokubo
0
170
ぼっちを避けて楽しむためのアノテコノテ / Various Tips and Tricks to Avoid Loneliness and Have Fun
nrslib
3
1.7k
Play Billing Library 7.0.0 変更点まとめ@potatotips#88
kako351
0
160
Clean Architecture by TypeScript & NestJS
ryounasso
0
150
最近追加した型の紹介とその振り返り
aki19035vc
0
180
12年前の『型システム入門』翻訳の思い出話
mame
11
1.2k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
23
1.9k
The Power of CSS Pseudo Elements
geoffreycrofte
64
5.2k
Testing 201, or: Great Expectations
jmmastey
33
6.9k
Atom: Resistance is Futile
akmur
261
25k
The Invisible Customer
myddelton
117
13k
Building Effective Engineering Teams - LeadDev
addyosmani
47
2.2k
GitHub's CSS Performance
jonrohan
1026
450k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
2.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
248
12k
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
Unsuck your backbone
ammeep
666
57k
How to name files
jennybc
67
96k
Transcript
Writing testable code
Rodrigo Boniatti Developer at Codeminer 42 @boniattirodrigo rodrigoboniatti.com
Conditionals
None
Smell
None
None
Refactored
None
None
Conditionals • Smell: • High cyclomatic complexity score; • How
to solve? • Replace Conditional with Polymorphism;
Global state
Smell
None
Refactored
None
Global state • Smell: • Coupling; • How to solve?
• Dependency injection;
Life cycle events
Smell
None
Refactored
None
Life cycle events • Smell: • Hide code behavior; •
No execution order; • How to solve? • Single flow;
Principles of testing
Principles of testing • Test in isolation; • A lot
of setup == smell; • Hard to test == smell;
Questions?
Thank you Code examples: https://github.com/boniattirodrigo/writing-testable-code