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
48
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
51
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
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
180
2 週間で Twitter Bot を作ってみた
contour_gara
0
180
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
530
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
280
新宿ダンジョンを可視化してみた
satoshi7190
2
240
try! Swift Tokyo 初参加報告LT
hinakko2
0
220
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.1k
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
コードレビューで学ぶ!Kotlinオブジェクト指向デザインパターン
akkie76
2
200
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
270
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.6k
Being A Developer After 40
akosma
57
580k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
Code Reviewing Like a Champion
maltzj
514
39k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
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