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
Working With Legacy Rails Apps
Search
Ahmed Omran
July 10, 2015
Programming
0
160
Working With Legacy Rails Apps
Ahmed Omran
July 10, 2015
Tweet
Share
More Decks by Ahmed Omran
See All by Ahmed Omran
Compose Software Like Nature Would - RubyConf 2024
this_ahmed
0
71
Sane User Interfaces for Ruby on Rails
this_ahmed
2
180
Compose Software Like Nature Would
this_ahmed
1
210
Welcome to JavaScript
this_ahmed
0
48
Designing & Building RESTful JSON APIs
this_ahmed
4
5.3k
Other Decks in Programming
See All in Programming
Package Management Learnings from Homebrew
mikemcquaid
0
170
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
230
Python札幌 LT資料
t3tra
7
1.1k
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
670
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
140
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
AI時代の認知負荷との向き合い方
optfit
0
130
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.2k
CSC307 Lecture 01
javiergs
PRO
0
680
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
1
150
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
110
CSC307 Lecture 05
javiergs
PRO
0
490
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
8.1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
280
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
30 Presentation Tips
portentint
PRO
1
210
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
67
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
Amusing Abliteration
ianozsvald
0
92
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
60
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
Transcript
Working With Legacy Rails Apps @this_ahmed
Working With Legacy Rails Apps @this_ahmed
legacy code • untested code (Michael C. Feathers) • code
someone else wrote (old gems, outsourcing, maintainers left) • difficult to work with • risky to change • but serves a useful function
googling legacy code …
every project has legacy code?
None
• learning & experimenting • ambitious applications • big project,
developer churn, hiring outside help • bad code … even with the best of intentions • “Technical debt”
None
–Robert C. Martin “Even the most disciplined development team, knowing
the best principles, using the best patterns, and following the best practices will create messes from time to time.”
in the face of legacy code you can …
None
or…
None
Useful techniques
Rebuild Refactor
–Robert C. Martin “…taking a tangled, opaque, convoluted system and
slowly, gradually, piece by piece, step by step, turning it into a simple, nicely structured, well-designed system.”
Boy Scout Rule Clean up around you work area. Small
fixes; small refractors.
cover and modify • add unit test • test passes
• modify code • test passes
use mock objects to break dependencies
None
mock dependencies
break complicated dependencies with seams
None
seam => put in method + stub
first step to later refactor
i don’t understand this code…
Ask someone
code archeology
code archeology git blame / Github
code archeology search code for context git blame / Github
code archeology project management ticket git blame / Github search
code for context
code archeology git blame / Github project management ticket commit
message search code for context
review • boy scout rule • cover and modify •
break dependencies with mocks and seams • understand code with archeology
some parting thoughts
unit test
None
None
• code review • small git branches • add lots
of context in pull request / commit message