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
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
75
Possible to measure developer productivity?
mehlah
0
76
PG FDW FTW
mehlah
0
200
Product culture
mehlah
0
110
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
APIセキュリティを組織で実現するには~注力する点と設計・実装に入れたい対策~
riiimparm
2
720
1.5時間を無駄にして学んだwsl2におけるaptとsnapの選択と仕組み
yosaka0123
0
460
『自分で判断できるか』を基準に、プロダクトのハンズオン研修でAI利用の線を引いてみた / Where We Drew the Line on AI in Hands-on Training
honyanya
1
440
AI駆動開発をチームに根付かせる - 「1行も書かない」チームがHarnessを育てた1年 -
kenichirokimura
6
3.3k
Claude Codeで開発以外の業務も爆速化しよう!
minorun365
PRO
11
9k
AI時代のデータ基盤を考える問い
pacocat
0
740
顧客の要望は2次情報である 〜アンテナを張るFDEの構造論〜
noriakioji
5
1k
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
信頼性はSREだけのものじゃない
hkawaras
0
300
dbt と Snowflake と tag
kevinrobot34
2
290
MCPを待つな、パスキーを拡げよう(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
350
あなたの知らないバージョン命名規則
sat
PRO
2
850
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
450
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
180
Speed Design
sergeychernyshev
33
2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
450
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
400
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
390
AI: The stuff that nobody shows you
jnunemaker
PRO
9
950
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
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