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
96
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
23
PG FDW FTW
mehlah
0
140
Product culture
mehlah
0
35
OpenAPI and AsyncAPI specifications as contracts
mehlah
0
630
Technical Debt
mehlah
1
260
Data informed growth
mehlah
0
190
Serverless Ruby and AWS Lambda
mehlah
0
140
Middleware all the things
mehlah
2
810
If only I knew this shit in college
mehlah
0
190
Other Decks in Technology
See All in Technology
Figma Dev Modeで進化するデザインとエンジニアリングの協働 / figma-with-engineering
cyberagentdevelopers
PRO
1
340
Vueで Webコンポーネントを作って Reactで使う / 20241030-cloudsign-vuefes_after_night
bengo4com
3
180
AWS SAW(AWS Support Automation Workflows)をもっと広めたい
kazzpapa3
2
170
APIテスト自動化の勘所
yokawasa
4
1.1k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
49k
EKS初心者が早めに知っておきたかったこと
cuorain
0
140
日経ビジュアルデータにおける スクロールテリングと地図/nikkei-tech-talk-26
nikkei_engineer_recruiting
0
160
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
3
840
Mackerelが取り組むオブザーバビリティ - Mackerel Tech Day
mackerelio
0
330
DFTの実践的基礎理論
pfn
PRO
2
100
キーワードの再整理のススメ ~テストタイプ/テストレベルで最適化!~/20241025 Midori Inada
shift_evolve
0
120
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
130
Featured
See All Featured
A better future with KSS
kneath
238
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
670
Building Adaptive Systems
keathley
38
2.2k
Statistics for Hackers
jakevdp
796
220k
Navigating Team Friction
lara
183
14k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
How GitHub (no longer) Works
holman
311
140k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
Docker and Python
trallard
40
3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
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