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
61
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
Re:proS_案内資料
rect
0
260
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
370
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
100
ActiveRecordの力でDBのメタデータを迅速に解析する
lnit
5
2.2k
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
120
Going Staff - Keynote edition
pragtob
0
430
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
350
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
1.7k
Identifying User Idenity
moro
4
6.1k
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.3k
Prompt Engineering for Developers @ AWS Community Day Adria 2024
slobodan
0
120
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
4
150
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Scaling GitHub
holman
458
140k
We Have a Design System, Now What?
morganepeng
50
7.2k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
280
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
The Cult of Friendly URLs
andyhume
78
6k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Happy Clients
brianwarren
97
6.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
The Language of Interfaces
destraynor
154
24k
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