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
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
60
Possible to measure developer productivity?
mehlah
0
65
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
96
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
700
Technical Debt
mehlah
1
320
Data informed growth
mehlah
0
270
Serverless Ruby and AWS Lambda
mehlah
0
200
Middleware all the things
mehlah
2
890
Other Decks in Technology
See All in Technology
2026TECHFRESH畢業分享會 - Lightning Talk - 資料也要 CI/CD? 用 Airbyte 自動化資料同步
line_developers_tw
PRO
0
930
"何を作るか"を任される エンジニアは、どう育つのか
yutaokafuji
1
660
FDE という解 ― 暗黙知と明示知をつなぐ、伴走型エンジニアリング ―
otanet
0
150
LLMにもCAP定理があるという話
harukasakihara
0
330
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
5
1.4k
On-behalf-of Token exchange with AgentCore Identity
hironobuiga
2
160
AIエージェントが名古屋の猛暑からあなたを守る
happysamurai294
0
110
20260619 私の日常業務での生成 AI 活用
masaruogura
1
180
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
190
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
2
560
非定型業務をAI slackbotで自動化する ~ 社内要望を自動壁打ちするbotを作った ~/automating-ad-hoc-work-with-ai-slackbot
shibayu36
0
640
入門!AWS Blocks
ysuzuki
1
110
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
310
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
590
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
530
From π to Pie charts
rasagy
0
210
Typedesign – Prime Four
hannesfritz
42
3.1k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Google's AI Overviews - The New Search
badams
0
1k
Abbi's Birthday
coloredviolet
2
8k
The World Runs on Bad Software
bkeepers
PRO
72
12k
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