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
140
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
39
Possible to measure developer productivity?
mehlah
0
48
PG FDW FTW
mehlah
0
180
Product culture
mehlah
0
79
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
人はいかにして 確率的な挙動を 受け入れていくのか
vaaaaanquish
0
140
「違う現場で格闘する二人」——社内コミュニティがつないだトヨタ流アジャイルの実践とその先
shinichitakeuchi
0
540
みんなでAI上手ピーポーになろう! / Let’s All Get AI-Savvy!
kaminashi
0
170
kintone開発のプラットフォームエンジニアの紹介
cybozuinsideout
PRO
0
560
これまでのネットワーク運用を変えるかもしれないアプデをおさらい
hatahata021
4
250
#22 CA × atmaCup 3rd 1st Place Solution
yumizu
1
230
Node vs Deno vs Bun 〜推しランタイムを見つけよう〜
kamekyame
1
570
AI時代のPMに求められるのは 「Ops」と「Enablement」
shimotaroo
0
150
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.3k
BPaaSオペレーション・kubell社内 n8n活用による効率化検証事例紹介
kentarofujii
0
200
新規事業 toitta におけるAI 機能評価の話 / AI Feature Evaluation in toitta
pokutuna
0
130
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
420
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
890
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
0
520
エンジニアに許された特別な時間の終わり
watany
106
230k
Navigating Weather and Climate Data
rabernat
0
72
30 Presentation Tips
portentint
PRO
1
190
Marketing to machines
jonoalderson
1
4.6k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
620
New Earth Scene 8
popppiees
1
1.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Mobile First: as difficult as doing things right
swwweet
225
10k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
54
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