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
110
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
40
PG FDW FTW
mehlah
0
160
Product culture
mehlah
0
58
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
650
Technical Debt
mehlah
1
280
Data informed growth
mehlah
0
210
Serverless Ruby and AWS Lambda
mehlah
0
160
Middleware all the things
mehlah
2
840
If only I knew this shit in college
mehlah
0
210
Other Decks in Technology
See All in Technology
20250623 Findy Lunch LT Brown
3150
0
790
AWS CDK 実践的アプローチ N選 / aws-cdk-practical-approaches
gotok365
4
520
_第3回__AIxIoTビジネス共創ラボ紹介資料_20250617.pdf
iotcomjpadmin
0
140
Navigation3でViewModelにデータを渡す方法
mikanichinose
0
210
Amplifyとゼロからはじめた AIコーディング 成果と展望
mkdev10
1
360
ハノーバーメッセ2025座談会.pdf
iotcomjpadmin
0
150
プロダクトエンジニアリング組織への歩み、その現在地 / Our journey to becoming a product engineering organization
hiro_torii
0
110
UIテスト自動化サポート- Testbed for XCUIAutomation practice
notoroid
0
110
変化する開発、進化する体系時代に適応するソフトウェアエンジニアの知識と考え方(JaSST'25 Kansai)
mizunori
0
140
PostgreSQL 18 cancel request key長の変更とRailsへの関連
yahonda
0
110
“社内”だけで完結していた私が、AWS Community Builder になるまで
nagisa53
1
230
Create a Rails8 responsive app with Gemini and RubyLLM
palladius
0
140
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
223
9.7k
4 Signs Your Business is Dying
shpigford
184
22k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Six Lessons from altMBA
skipperchong
28
3.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Agile that works and the tools we love
rasmusluckow
329
21k
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