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
1
150
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
42
Possible to measure developer productivity?
mehlah
0
51
PG FDW FTW
mehlah
0
180
Product culture
mehlah
0
85
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
670
Technical Debt
mehlah
1
300
Data informed growth
mehlah
0
250
Serverless Ruby and AWS Lambda
mehlah
0
190
Middleware all the things
mehlah
2
870
Other Decks in Technology
See All in Technology
LINEヤフーにおけるAI駆動開発組織のプロデュース施策
lycorptech_jp
PRO
0
240
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
AWS CDK の目玉新機能「Mixins」とは / cdk-mixins
gotok365
2
310
【PyCon mini Shizuoka 2026】生成AI時代に画像処理やオーディオ処理のノードエディターを作る理由
kazuhitotakahashi
0
210
俺の失敗を乗り越えろ!メーカーの開発現場での失敗談と乗り越え方 ~ゆるゆるチームリーダー編~
spiddle
0
420
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
180
ローカルでLLMを使ってみよう
kosmosebi
0
210
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
640
Secure Boot 2026 - Aggiornamento dei certificati UEFI e piano di adozione in azienda
memiug
0
120
ヘルシーSRE
tk3fftk
2
200
LY Tableauでの Tableau x AIの実践 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
1k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
11k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
660
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
200
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
How to build a perfect <img>
jonoalderson
1
5.2k
The Curse of the Amulet
leimatthew05
1
9.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
What's in a price? How to price your products and services
michaelherold
247
13k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
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