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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Rodrigo Boniatti
November 30, 2019
Programming
71
0
Share
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
32
The pillars of integration
boniatti
0
91
Designing and building software with Ruby on Rails
boniatti
0
64
Mobile development with React Native
boniatti
1
3.5k
Other Decks in Programming
See All in Programming
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
250
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
180
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
320
How Swift's Type System Guides AI Agents
koher
0
180
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
830
20260320登壇資料
pharct
0
160
Feature Toggle は捨てやすく使おう
gennei
0
440
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
170
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
230
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
130
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
150
AIエージェントで業務改善してみた
taku271
0
500
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Building Adaptive Systems
keathley
44
3k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
200
Leo the Paperboy
mayatellez
7
1.6k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
97
Writing Fast Ruby
sferik
630
63k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Ethics towards AI in product and experience design
skipperchong
2
250
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