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
34
PG FDW FTW
mehlah
0
150
Product culture
mehlah
0
53
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
200
Other Decks in Technology
See All in Technology
MCP Clientを活用するための設計と実装上の工夫
yudai00
1
810
オープンソースのハードウェアのコンテストに参加している話
iotengineer22
0
650
Javaアプリケーションの配布とパッケージング / Distribution and packaging of Java applications
hogelog
1
250
LT:組込み屋さんのオシロが壊れた!
windy_pon
0
470
RDRA3.0を知ろう
kanzaki
2
430
大事なのは、AIの精度だけじゃない!〜1円のズレも許されない経理領域とAI〜
jun_nemoto
11
5.2k
MCP で繋ぐ Figma とデザインシステム〜LLM を使った UI 実装のリアル〜
kimuson
2
1.3k
Scale Security Programs with Scorecarding
ramimac
0
440
libsyncrpcってなに?
uhyo
0
150
TechBull Membersの開発進捗どうですか!?
rvirus0817
0
220
CloudBruteによる外部からのS3バケットの探索・公開の発見について / 20250605 Kumiko Hennmi
shift_evolve
3
190
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
12k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
106
19k
The Invisible Side of Design
smashingmag
299
50k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Visualization
eitanlees
146
16k
Side Projects
sachag
454
42k
Writing Fast Ruby
sferik
628
61k
RailsConf 2023
tenderlove
30
1.1k
Done Done
chrislema
184
16k
Music & Morning Musume
bryan
47
6.6k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
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