Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Confident refactors
Search
Mehdi Lahmam B.
June 19, 2017
Technology
170
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
81
Possible to measure developer productivity?
mehlah
0
84
PG FDW FTW
mehlah
0
210
Product culture
mehlah
0
120
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
720
Technical Debt
mehlah
1
340
Data informed growth
mehlah
0
300
Serverless Ruby and AWS Lambda
mehlah
0
200
Middleware all the things
mehlah
2
910
Other Decks in Technology
See All in Technology
Don't write the architecture only in the prompt.
neohsu
0
250
増え続けるプロダクトの品質をどう担保するか。ProductSpecとTypeScriptによる取り組み
joere
1
160
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
180
日本AIベンチャーレポート2026
kentarofujii
0
260
Vibe-to-Spec開発_実践ガイド
happysamurai294
0
120
Autonomous AI Lakehouse - Live AI Hubから始めるセキュアなAIデータ活用 -
oracle4engineer
PRO
2
170
AWS Continuum for Penetration Testing に Deep Dive してみる
asanoharuki
2
1.4k
ポケモン対戦を自動で記録して振り返ろう
fufufukakaka
0
420
構造で守らせる データ・法務・セキュリティ・開発チームとつくる AI時代のデータガバナンスとデータ基盤のリアル
legalontechnologies
PRO
2
670
AWS DevOps Agentはどこまで任せられるか 〜機能の現在地と、機能拡張の実践〜
nyankotaro
0
300
クラウドエージェントの先駆け Devin。今も最先端を走る、他との違い
kinopeee
1
510
新卒エンジニア、 介護士になる
ryu1013
1
430
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
96
6.9k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
900
Claude Code のすすめ
schroneko
67
230k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
590
Deep Space Network (abreviated)
tonyrice
0
390
Ruling the World: When Life Gets Gamed
codingconduct
0
420
We Have a Design System, Now What?
morganepeng
55
8.4k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Faster Mobile Websites
deanohume
310
32k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
440
Building Adaptive Systems
keathley
44
3.3k
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