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
41
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
630
Technical Debt
mehlah
1
270
Data informed growth
mehlah
0
200
Serverless Ruby and AWS Lambda
mehlah
0
150
Middleware all the things
mehlah
2
830
If only I knew this shit in college
mehlah
0
190
Other Decks in Technology
See All in Technology
スタートアップ1人目QAエンジニアが QAチームを立ち上げ、“個”からチーム、 そして“組織”に成長するまで / How to set up QA team at reiwatravel
mii3king
2
1.5k
Moved to https://speakerdeck.com/toshihue/presales-engineer-career-bridging-tech-biz-ja
toshihue
2
740
Goで作って学ぶWebSocket
ryuichi1208
0
190
Data-centric AI入門第6章:Data-centric AIの実践例
x_ttyszk
1
400
関東Kaggler会LT: 人狼コンペとLLM量子化について
nejumi
3
580
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
960
アジャイル開発とスクラム
araihara
0
170
プロダクトエンジニア構想を立ち上げ、プロダクト志向な組織への成長を続けている話 / grow into a product-oriented organization
hiro_torii
1
170
レビューを増やしつつ 高評価維持するテクニック
tsuzuki817
1
710
滅・サービスクラス🔥 / Destruction Service Class
sinsoku
6
1.6k
OpenID BizDay#17 KYC WG活動報告(法人) / 20250219-BizDay17-KYC-legalidentity
oidfj
0
240
AndroidXR 開発ツールごとの できることできないこと
donabe3
0
130
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Code Review Best Practice
trishagee
67
18k
A Philosophy of Restraint
colly
203
16k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Automating Front-end Workflow
addyosmani
1368
200k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
630
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Faster Mobile Websites
deanohume
306
31k
RailsConf 2023
tenderlove
29
1k
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