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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
57
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
91
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
680
Technical Debt
mehlah
1
310
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
音声言語モデル手法に関する発表の紹介
kzinmr
0
150
ハーネスエンジニアリングの概要と設計思想
sergicalsix
9
6.6k
AI活用時代の事業判断高度化を導くエンジニアリング基盤 / 20260424 Atsushi Funahashi
shift_evolve
PRO
2
110
Digital Independence: Why, When and How
wannesrams
0
180
Rapid Start: Faster Internet Connections, with Ruby's Help
kazuho
2
990
No Types Needed, Just Callable Method Check
dak2
1
2.6k
COBOL婆さんの伝説
poropinai1966
0
120
Oracle Cloud Infrastructure:2026年4月度サービス・アップデート
oracle4engineer
PRO
0
220
Cortex Codeのコスト見積ヒントご紹介
yokatsuki
0
130
「誰一人取り残されない」 AIエージェント時代のプロダクト設計思想 Product Management Summit 2026
mizushimac
1
2.4k
はじめての MagicPod生成AI機能 機能紹介から活用方法まで
magicpod
0
120
要件定義の精度を高めるための型と生成AIの活用 / Using Types and Generative AI to Improve the Accuracy of Requirements Definition
haru860
0
220
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
Facilitating Awesome Meetings
lara
57
6.8k
Statistics for Hackers
jakevdp
799
230k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
330
Joys of Absence: A Defence of Solitary Play
codingconduct
1
350
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
BBQ
matthewcrist
89
10k
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