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
150
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
57
Sane User Interfaces for Ruby on Rails
this_ahmed
2
170
Compose Software Like Nature Would
this_ahmed
1
200
Welcome to JavaScript
this_ahmed
0
45
Designing & Building RESTful JSON APIs
this_ahmed
4
5.3k
Other Decks in Programming
See All in Programming
モテるデスク環境
mozumasu
3
1.3k
オープンソースソフトウェアへの解像度🔬
utam0k
17
3.1k
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
18
8.5k
CSC305 Lecture 10
javiergs
PRO
0
250
AI 駆動開発におけるコミュニティと AWS CDK の価値
konokenj
5
240
Writing Better Go: Lessons from 10 Code Reviews
konradreiche
3
6.7k
マンガアプリViewerの大画面対応を考える
kk__777
0
250
オンデバイスAIとXcode
ryodeveloper
0
130
チームの境界をブチ抜いていけ
tokai235
0
220
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
110
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
330
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
1.2k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
The Pragmatic Product Professional
lauravandoore
36
7k
It's Worth the Effort
3n
187
28k
Side Projects
sachag
455
43k
Building Applications with DynamoDB
mza
96
6.7k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Automating Front-end Workflow
addyosmani
1371
200k
Scaling GitHub
holman
463
140k
Writing Fast Ruby
sferik
630
62k
Visualization
eitanlees
149
16k
Code Reviewing Like a Champion
maltzj
526
40k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
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