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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mehdi Lahmam B.
June 19, 2017
Technology
1
150
Confident refactors
Mehdi Lahmam B.
June 19, 2017
Tweet
Share
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
Beyond code: Becoming a Product Engineer
mehlah
0
40
Possible to measure developer productivity?
mehlah
0
50
PG FDW FTW
mehlah
0
180
Product culture
mehlah
0
82
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
670
Technical Debt
mehlah
1
300
Data informed growth
mehlah
0
250
Serverless Ruby and AWS Lambda
mehlah
0
180
Middleware all the things
mehlah
2
870
Other Decks in Technology
See All in Technology
Cloud Runでコロプラが挑む 生成AI×ゲーム『神魔狩りのツクヨミ』の裏側
colopl
0
260
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
56
47k
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
140
AI駆動開発を事業のコアに置く
tasukuonizawa
1
1.4k
22nd ACRi Webinar - 1Finity Tamura-san's slide
nao_sumikawa
0
130
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
290
AgentCore RuntimeをVPCにデプロイして 開発ドキュメント作成AIエージェントを作った
alchemy1115
2
120
生成AIの研究活用_AILab2025研修
cyberagentdevelopers
PRO
0
380
AIが実装する時代、人間は仕様と検証を設計する
gotalab555
4
900
Claude Code で画面の仕様書を作ろう
zozotech
PRO
0
210
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
240
私たち準委任PdEは2つのプロダクトに挑戦する ~ソフトウェア、開発支援という”二重”のプロダクトエンジニアリングの実践~ / 20260212 Naoki Takahashi
shift_evolve
PRO
2
310
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
120
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
790
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
58
50k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
210
Abbi's Birthday
coloredviolet
1
4.8k
Typedesign – Prime Four
hannesfritz
42
3k
Writing Fast Ruby
sferik
630
62k
How to Ace a Technical Interview
jacobian
281
24k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
440
Between Models and Reality
mayunak
1
200
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
130
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