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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
60
Possible to measure developer productivity?
mehlah
0
65
PG FDW FTW
mehlah
0
190
Product culture
mehlah
0
96
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
700
Technical Debt
mehlah
1
320
Data informed growth
mehlah
0
270
Serverless Ruby and AWS Lambda
mehlah
0
200
Middleware all the things
mehlah
2
890
Other Decks in Technology
See All in Technology
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
730
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
2
560
AIっぽい文章を採点して人間らしく直すアプリを作ってみた
yama3133
2
140
On-behalf-of Token exchange with AgentCore Identity
hironobuiga
2
160
非定型業務をAI slackbotで自動化する ~ 社内要望を自動壁打ちするbotを作った ~/automating-ad-hoc-work-with-ai-slackbot
shibayu36
0
640
AIのReact習熟度を測る
uhyo
2
360
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
570
FDE という解 ― 暗黙知と明示知をつなぐ、伴走型エンジニアリング ―
otanet
0
150
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
360
フロンティアAIのゲート化と地政学リスク
nagatsu
0
130
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
0
2.2k
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
Building the Perfect Custom Keyboard
takai
2
790
Building an army of robots
kneath
306
46k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
エンジニアに許された特別な時間の終わり
watany
107
250k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Site-Speed That Sticks
csswizardry
13
1.2k
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