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
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
64
Possible to measure developer productivity?
mehlah
0
68
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
100
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
Zoom2Youtube.Claude
kawaguti
PRO
2
450
Road to SRE NEXTの今までとこれから
hiroyaonoe
0
190
勉強会企画をアプリで構造化してみた 〜そこで見えた、AIとの付き合い方〜 / I've structured a study group plan using an app.
pauli
0
330
デジタル・デザイン:次の50年を描く「進化する青写真」
y150saya
0
820
4人目のSREはAgent
tanimuyk
0
400
AI Agent SaaS を支える自社仮想化基盤への挑戦と実運用 / ai-agent-saas-virtualization
flatt_security
2
2.5k
AI時代における最適なQA組織の作り方
ymty
3
460
地域 SRE コミュニティ最前線 / SRE NEXT 2026 Discussion Night Track C
muziyoshiz
0
130
AI駆動開発におけるQAエンジニアの役割事例 〜AI駆動開発の現場から〜
kobayashiyorimitsu
0
390
美しいコードを書くためにF#を学んでみた話
yud0uhu
1
290
テスト設計の本質を改めて考えてみる~生成AIを活用する時代だからこそ、作ったテストの説明性を高めよう~
yamasaki696
1
380
Claude Codeとハーネスについて考えてみる
oikon48
18
8.7k
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
670
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
600
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Agile that works and the tools we love
rasmusluckow
331
22k
Into the Great Unknown - MozCon
thekraken
41
2.6k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
For a Future-Friendly Web
brad_frost
183
10k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
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