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
55
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
66
Designing and building software with Ruby on Rails
boniatti
0
47
Mobile development with React Native
boniatti
1
3.5k
Other Decks in Programming
See All in Programming
Go言語はstack overflowの夢を見るか?
logica0419
0
520
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.5k
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
6.7k
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.7k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
610
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
110
品質ワークショップをやってみた
nealle
0
620
理論と実務のギャップを超える
eycjur
0
180
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
3
710
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
490
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
1
120
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
150
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
44
7.8k
The World Runs on Bad Software
bkeepers
PRO
72
11k
Speed Design
sergeychernyshev
32
1.2k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Designing Experiences People Love
moore
142
24k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
KATA
mclloyd
PRO
32
15k
Build your cross-platform service in a week with App Engine
jlugia
233
18k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Statistics for Hackers
jakevdp
799
220k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
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