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
1
120
Confident refactors
Mehdi Lahmam B.
June 19, 2017
Tweet
Share
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
Beyond code: Becoming a Product Engineer
mehlah
0
15
Possible to measure developer productivity?
mehlah
0
43
PG FDW FTW
mehlah
0
160
Product culture
mehlah
0
67
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
660
Technical Debt
mehlah
1
290
Data informed growth
mehlah
0
230
Serverless Ruby and AWS Lambda
mehlah
0
170
Middleware all the things
mehlah
2
850
Other Decks in Technology
See All in Technology
Optuna DashboardにおけるPLaMo2連携機能の紹介 / PFN LLM セミナー
pfn
PRO
1
880
職種別ミートアップで社内から盛り上げる アウトプット文化の醸成と関係強化/ #DevRelKaigi
nishiuma
2
130
Findy Team+のSOC2取得までの道のり
rvirus0817
0
330
M5製品で作るポン置きセルラー対応カメラ
sayacom
0
140
空間を設計する力を考える / 20251004 Naoki Takahashi
shift_evolve
PRO
3
330
Why React!?? Next.jsそしてReactを改めてイチから選ぶ
ypresto
10
4.4k
SwiftUIのGeometryReaderとScrollViewを基礎から応用まで学び直す:設計と活用事例
fumiyasac0921
0
140
Flaky Testへの現実解をGoのプロポーザルから考える | Go Conference 2025
upamune
1
420
Shirankedo NOCで見えてきたeduroam/OpenRoaming運用ノウハウと課題 - BAKUCHIKU BANBAN #2
marokiki
0
130
KAGのLT会 #8 - 東京リージョンでGAしたAmazon Q in QuickSightを使って、報告用の資料を作ってみた
0air
0
200
Escaping_the_Kraken_-_October_2025.pdf
mdalmijn
0
120
英語は話せません!それでも海外チームと信頼関係を作るため、対話を重ねた2ヶ月間のまなび
niioka_97
0
110
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
173
14k
Building an army of robots
kneath
306
46k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Navigating Team Friction
lara
189
15k
A Tale of Four Properties
chriscoyier
160
23k
Practical Orchestrator
shlominoach
190
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
What's in a price? How to price your products and services
michaelherold
246
12k
We Have a Design System, Now What?
morganepeng
53
7.8k
How to Ace a Technical Interview
jacobian
280
24k
Site-Speed That Sticks
csswizardry
11
880
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
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