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
Mehdi Lahmam B.
June 19, 2017
Technology
150
1
Share
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
47
Possible to measure developer productivity?
mehlah
0
56
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
91
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
680
Technical Debt
mehlah
1
300
Data informed growth
mehlah
0
260
Serverless Ruby and AWS Lambda
mehlah
0
190
Middleware all the things
mehlah
2
880
Other Decks in Technology
See All in Technology
AI時代に新卒採用、はじめました/junior-engineer-never-die
dmnlk
0
230
申請待ちゼロへ!AWS × Entra IDで実現した「権限付与」のセルフサービス化
mhrtech
1
270
主催・運営として"場をつくる”というアウトプットのススメ
_mossann_t
0
130
新規サービス開発におけるReact Nativeのリアル〜技術選定の裏側と実践的OSS活用〜
grandbig
2
170
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
410
【Findy FDE登壇_2026_04_14】— 現場課題を本気で解いてたら、FDEになってた話
miyatakoji
0
840
新メンバーのために、シニアエンジニアが環境を作る時代
puku0x
0
500
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
360
Webアクセシビリティは“もしも”に備える設計
tomokusaba
0
180
GitHub Copilotを極める会 - 開発者のための活用術
findy_eventslides
6
3.8k
チームで育てるAI自走環境_20260409
fuktig
0
990
ストライクウィッチーズ2期6話のエイラの行動が許せないのでPjMの観点から何をすべきだったのかを考える
ichimichi
1
310
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
310
WCS-LA-2024
lcolladotor
0
520
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
GitHub's CSS Performance
jonrohan
1032
470k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Bash Introduction
62gerente
615
210k
How to train your dragon (web standard)
notwaldorf
97
6.6k
How to build a perfect <img>
jonoalderson
1
5.4k
エンジニアに許された特別な時間の終わり
watany
106
240k
We Are The Robots
honzajavorek
0
210
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
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