Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Confident refactors
Search
Mehdi Lahmam B.
June 19, 2017
Technology
170
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Confident refactors
Mehdi Lahmam B.
June 19, 2017
Transcript
48 slides
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
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
Beyond code: Becoming a Product Engineer
mehlah
0
84
Possible to measure developer productivity?
mehlah
0
88
PG FDW FTW
mehlah
0
210
Product culture
mehlah
0
120
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
720
Technical Debt
mehlah
1
350
Data informed growth
mehlah
0
300
Serverless Ruby and AWS Lambda
mehlah
0
210
Middleware all the things
mehlah
2
920
Other Decks in Technology
See All in Technology
E2E Test というハーネス — AI時代の自動テスト民主化
daishukojima
10
5.8k
cdkdがどんだけ早いか、実際に動かして見てみよう
smt7174
1
130
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
4
760
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
270
Agent Routerで作るマルチテナント 推論基盤 #CNDW2026 / Building Multi-Tenant Inference Platform with Agent Router #CNDW2026
everpeace
3
370
変更差分を読むために環境を整備しよう
pipepasta
1
470
お風呂場をサーバルームにしよう
yusuke427
0
360
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
410
AI-Ready なデータ基盤ってなに? & 新卒未経験が、いま考えていること
imuta
0
720
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
140
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
630
Datadog の権限統制 〜Org 統合に向けて調べた注意点 / JDDUG-Meetup_24
visional_engineering_and_design
1
190
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
620
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.5k
Raft: Consensus for Rubyists
vanstee
143
7.9k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
310
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
We Have a Design System, Now What?
morganepeng
55
8.4k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
How STYLIGHT went responsive
nonsquared
100
6.4k