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
140
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
27
Sane User Interfaces for Ruby on Rails
this_ahmed
2
150
Compose Software Like Nature Would
this_ahmed
1
160
Welcome to JavaScript
this_ahmed
0
40
Designing & Building RESTful JSON APIs
this_ahmed
4
5.1k
Other Decks in Programming
See All in Programming
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
250
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.3k
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
230
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
3.2k
Оптимизируем производительность блока Казначейство
lamodatech
0
990
ASP.NET Core の OpenAPIサポート
h455h1
0
160
Terraform で作る Amazon ECS の CI/CD パイプライン
hiyanger
0
110
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
220
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
270
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
140
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
3.8k
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
1
190
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Embracing the Ebb and Flow
colly
84
4.5k
Become a Pro
speakerdeck
PRO
26
5.1k
Bash Introduction
62gerente
610
210k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
YesSQL, Process and Tooling at Scale
rocio
171
14k
Thoughts on Productivity
jonyablonski
68
4.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
6
220
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