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
Confident refactors
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mehdi Lahmam B.
June 19, 2017
Technology
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Confident refactors
Mehdi Lahmam B.
June 19, 2017
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
Beyond code: Becoming a Product Engineer
mehlah
0
67
Possible to measure developer productivity?
mehlah
0
75
PG FDW FTW
mehlah
0
200
Product culture
mehlah
0
100
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
710
Technical Debt
mehlah
1
330
Data informed growth
mehlah
0
280
Serverless Ruby and AWS Lambda
mehlah
0
200
Middleware all the things
mehlah
2
900
Other Decks in Technology
See All in Technology
[しろおび夏祭り2026] チャットするAIから、作業するAIへ - 使われ方の変化と、その裏側で起きていること
kk0n
0
1.6k
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
1
1.6k
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
980
ボトムアップ文化が強い組織で セキュリティをどう根付かせていくかの現在進行形の話 / Making Security Stick in a Bottom-Up Organization
yamaguchitk333
0
200
ブラウザ研修 2026
recruitengineers
PRO
4
740
ガバメントクラウドでのランサムウェア対策
techniczna
2
940
Digitization部 紹介資料
sansan33
PRO
2
7.7k
個人OSSが、机の上から世界に広がるまでの話
shinyasaita
1
360
SmartHR Engineering Team Deck
smarthr
0
260
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
390
SnowflakeCoCoでデータエンジニアリング!
foursue
0
180
新しい SLO が良い感じにハマっている話
z63d
5
2.1k
Featured
See All Featured
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
360
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Ethics towards AI in product and experience design
skipperchong
2
340
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Site-Speed That Sticks
csswizardry
13
1.4k
The Spectacular Lies of Maps
axbom
PRO
1
890
Transcript
Confident Refactors
Mehdi Lahmam @mehlah
25kV Rails app, started in Feb 2009 Never rewritten 23k+
commits from 52 contributors
Ruby is a massively successful language!
Early success Making it easy to make new things
Later success Making it easy to maintain old things
Today, let’s refactor some legacy code
Today, let’s refactor some legacy code
Refactor - verb To change the design of code without
changing its observable behavior.
Refactor - verb To change in advance of a new
feature or bug fix, making the job easier.
Today, let’s refactor some legacy code
Legacy - noun Old code.
Legacy - noun Code without tests.
Legacy - noun Code that we don’t like.
Legacy - noun Code we don’t understand well enough to
change confidently.
Today, let’s refactor some legacy code
Refactoring is hard
Refactoring legacy code is very hard
Easy to accidentally break functionality
Legacy refactors feels unsafe
Legacy refactors are hard to sell
Business priority Cost / risks
Business priority Cost / risks New features
Business priority Cost / risks New features Bugs fixes
Business priority Cost / risks New features Bugs fixes Testing
Business priority Cost / risks New features Bug fixes Testing
Refactoring
Business priority Cost / risks New features Bug fixes Testing
Refactoring no selling needed easy to sell can often sell very hard to sell
Selling refactoring is hard ⏲ ⛔
Business priority Cost / risks Refactoring
Too much pressure ⏳ ⚒
Refactors are scary
What techniques we have? PDD - Pray Driven Development Fowler’s
refactoring book Characterization testing A/B testing, experiments
Refactors as surgeries
Refactors as surgeries Requires careful planning Follow a clear process
Multiple observations Flexible tools Things can get bloody
1. Plan 2. Cut 3. Record 4. Validate 5. Refactor
6. Verify 7. Compare 8. Fallback 9. Delete Clear process
None
None
None
Cut
Record
Validate ✅
Refactor <Insert magic here />
Verify
Compare ⚖
Fallback
Delete ✂
We dit it
We dit it Time to celebrate hard