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
75
Confident refactors
Mehdi Lahmam B.
June 19, 2017
Tweet
Share
More Decks by Mehdi Lahmam B.
See All by Mehdi Lahmam B.
PG FDW FTW
mehlah
0
120
Product culture
mehlah
0
30
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
610
Technical Debt
mehlah
1
240
Data informed growth
mehlah
0
170
Serverless Ruby and AWS Lambda
mehlah
0
140
Middleware all the things
mehlah
2
800
If only I knew this shit in college
mehlah
0
170
How the browser renders a web page (long version)
mehlah
1
360
Other Decks in Technology
See All in Technology
TransitGatewayの基礎
toru_kubota
0
230
WebアプリケーションにおけるPDOの使い方入門 / phpcon odawara 2024
meihei3
2
430
普段有償でサポート業務をしているCSAが技術知見を無料で公開する理由
07jp27
1
640
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
150
「共通基盤」を超えよ! 今、Platform Engineeringに取り組むべき理由
jacopen
25
5.9k
HEXA OSINT CTF V3 作戦会議
meow_noisy
0
110
スタートアップの技術顧問を3年間続けて発生した事と気付き
biwakonbu
0
160
o11y入門_外形監視を利用したWebアプリケーションへの最適なモニタリング_TechBrew
k5k
3
100
自動生成を活用した、運用保守コストを抑える Error/Alert/Runbook の一元集約管理 / Centralized management of Error/Alert/Runbook to minimize operational costs using automated code generation
biwashi
9
2.1k
ここが嬉しいABAC ここが辛いよABAC #再解説+補足編
masahirokawahara
0
220
Tebiki株式会社 エンジニア採用資料
tebiki
0
4.1k
開発生産性向上サービスを作るFindyが自分たちで開発生産性を爆上げした組織づくりの歩み / Findy's path to boosting its own development productivity 2024-04-17
ma3tk
3
340
Featured
See All Featured
Statistics for Hackers
jakevdp
789
220k
A better future with KSS
kneath
231
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
15
2.6k
Fireside Chat
paigeccino
20
2.6k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
We Have a Design System, Now What?
morganepeng
42
6.7k
Designing for humans not robots
tammielis
247
25k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
Happy Clients
brianwarren
91
6.4k
What's new in Ruby 2.0
geeforr
337
31k
It's Worth the Effort
3n
180
27k
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