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
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
67
Possible to measure developer productivity?
mehlah
0
75
PG FDW FTW
mehlah
0
200
Product culture
mehlah
0
100
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
710
Technical Debt
mehlah
1
330
Data informed growth
mehlah
0
280
Serverless Ruby and AWS Lambda
mehlah
0
200
Middleware all the things
mehlah
2
900
Other Decks in Technology
See All in Technology
Forza Horizon 6 のテレメトリ機能で 自動運転に使えそうな学習データを集める話
henjin0
0
150
モバイルアプリ開発概論2026
recruitengineers
PRO
3
500
グローバル基準のSREは、運用現場でどう機能したか:成熟度アセスメントの実践 / SRE NEXT 2026
sorawatanabe
0
140
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
6
2.1k
ホームラボ紹介
y_sera15
0
120
Goでデータパイプラインを作ろう
sansantech
PRO
0
350
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
53k
個人OSSが、机の上から世界に広がるまでの話
shinyasaita
1
370
Pavlokで始める電撃駆動開発
sgrsn
0
180
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
780
AI時代の強いチームの作り方
yuukiyo
25
16k
名古屋の市バスGTFS-JPデータ×スガキヤ 最寄りバス停検索をAmazon ElastiCache Serverless for Valkeyで最適化する
usanchuu
1
490
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
1
520
The Curse of the Amulet
leimatthew05
2
14k
Fireside Chat
paigeccino
42
4k
Writing Fast Ruby
sferik
630
63k
Optimizing for Happiness
mojombo
378
71k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Everyday Curiosity
cassininazir
0
270
Utilizing Notion as your number one productivity tool
mfonobong
4
520
New Earth Scene 8
popppiees
3
2.5k
Code Review Best Practice
trishagee
74
20k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
460
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