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
51
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
62
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
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.7k
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
1
140
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
290
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
ドメインイベント増えすぎ問題
h0r15h0
2
350
Recoilを剥がしている話
kirik
5
6.8k
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
400
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
830
たのしいparse.y
ydah
3
120
MCP with Cloudflare Workers
yusukebe
2
220
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
66
4.5k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Building an army of robots
kneath
302
44k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Invisible Side of Design
smashingmag
298
50k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Statistics for Hackers
jakevdp
796
220k
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