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
84
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Writing testable code
Rodrigo Boniatti
November 30, 2019
More Decks by Rodrigo Boniatti
See All by Rodrigo Boniatti
Challenges of the modern web
boniatti
0
52
The pillars of integration
boniatti
0
100
Designing and building software with Ruby on Rails
boniatti
0
79
Mobile development with React Native
boniatti
1
3.5k
Other Decks in Programming
See All in Programming
3Dシーンの圧縮
fadis
1
680
JavaDoc 再入門
nagise
0
310
Oxcを導入して開発体験が向上した話
yug1224
4
300
ふつうのFeature Flag実践入門
irof
7
3.6k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
160
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
130
AIとRubyの静的型付け
ukin0k0
0
550
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
240
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
120
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
120
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Amusing Abliteration
ianozsvald
1
200
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.4k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
960
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
450
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
180
We Have a Design System, Now What?
morganepeng
55
8.2k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
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