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
1
140
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
39
Possible to measure developer productivity?
mehlah
0
48
PG FDW FTW
mehlah
0
180
Product culture
mehlah
0
79
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
180
Middleware all the things
mehlah
2
870
Other Decks in Technology
See All in Technology
Kusakabe_面白いダッシュボードの表現方法
ykka
0
360
Databricks Free Editionで始めるLakeflow SDP
taka_aki
0
170
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
かわいい身体と声を持つ そういうものに私はなりたい
yoshimura_datam
0
240
AIAgentを駆使してSREが貢献する開発体験の向上
yoshiiryo1
3
920
20260120 Amazon VPC のパブリックサブネットを無くしたい!
masaruogura
2
140
Digitization部 紹介資料
sansan33
PRO
1
6.6k
ソフトとハード両方いけるデータ人材の育て方
waiwai2111
1
540
BiDiってなんだ?
tomorrowkey
1
230
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.3k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
Test your architecture with Archunit
thirion
1
2.1k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
89
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
710
A better future with KSS
kneath
240
18k
Mind Mapping
helmedeiros
PRO
0
53
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
KATA
mclloyd
PRO
33
15k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
370
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