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
100
Confident refactors
Mehdi Lahmam B.
June 19, 2017
Tweet
Share
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
Possible to measure developer productivity?
mehlah
0
27
PG FDW FTW
mehlah
0
150
Product culture
mehlah
0
39
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
630
Technical Debt
mehlah
1
260
Data informed growth
mehlah
0
190
Serverless Ruby and AWS Lambda
mehlah
0
150
Middleware all the things
mehlah
2
820
If only I knew this shit in college
mehlah
0
190
Other Decks in Technology
See All in Technology
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
今年一年で頑張ること / What I will do my best this year
pauli
1
220
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
250
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.4k
#TRG24 / David Cuartielles / Post Open Source
tarugoconf
0
590
タイミーのデータ活用を支えるdbt Cloud導入とこれから
ttccddtoki
1
160
商品レコメンドでのexplicit negative feedbackの活用
alpicola
2
370
自社 200 記事を元に整理した読みやすいテックブログを書くための Tips 集
masakihirose
2
330
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
450
メールヘッダーを見てみよう
hinono
0
110
Goで実践するBFP
hiroyaterui
1
120
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
34
1.6k
We Have a Design System, Now What?
morganepeng
51
7.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Making the Leap to Tech Lead
cromwellryan
133
9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Scaling GitHub
holman
459
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Producing Creativity
orderedlist
PRO
343
39k
Practical Orchestrator
shlominoach
186
10k
A Philosophy of Restraint
colly
203
16k
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