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
150
1
Share
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
47
Possible to measure developer productivity?
mehlah
0
57
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
91
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
680
Technical Debt
mehlah
1
310
Data informed growth
mehlah
0
260
Serverless Ruby and AWS Lambda
mehlah
0
190
Middleware all the things
mehlah
2
880
Other Decks in Technology
See All in Technology
AIの揺らぎに“コシ”を与える階層化品質設計
ickx
0
120
UIライブラリに依存しすぎないReact Native設計を目指して
grandbig
0
180
The 7 pitfalls of AI
ufried
0
170
雑談は、センサーだった
bitkey
PRO
0
140
コードや知識を組み込む / Incorporate Code and Knowledge
ks91
PRO
0
190
巨大プラットフォームを進化させる「第3のROI」
recruitengineers
PRO
2
2k
Shipping AI Agents — Lessons from Production
vvatanabe
0
300
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
4
1.6k
基盤を育てる 外部SaaS連携の運用
gamonges_dresscode
1
130
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
7.9k
「QA=テスト」「シフトレフト=スクラムイベントの参加者の一員」の呪縛を解く。アジャイルな開発を止めないために、10Xで挑んだ「右側のしわ寄せ」解消記 #scrumniigata
nihonbuson
PRO
2
310
世界の中心でApp Runnerを叫ぶ FINAL
tsukuboshi
0
160
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
130
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
Being A Developer After 40
akosma
91
590k
The Spectacular Lies of Maps
axbom
PRO
1
720
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Color Theory Basics | Prateek | Gurzu
gurzu
0
300
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Done Done
chrislema
186
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