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
39
Sane User Interfaces for Ruby on Rails
this_ahmed
2
160
Compose Software Like Nature Would
this_ahmed
1
180
Welcome to JavaScript
this_ahmed
0
40
Designing & Building RESTful JSON APIs
this_ahmed
4
5.2k
Other Decks in Programming
See All in Programming
開発者フレンドリーで顧客も満足?Platformの秘密
algoartis
0
250
データベースの技術選定を突き詰める ~複数事例から考える最適なデータベースの選び方~
nnaka2992
3
3k
TypeScript エンジニアが Android 開発の世界に飛び込んだ話
yuisakamoto
4
180
TVer iOSチームの共通認識の作り方 - Findy Job LT iOSアプリ開発の裏側 開発組織が向き合う課題とこれから
techtver
PRO
0
300
ビカム・ア・コパイロット
ymd65536
1
170
最速Green Tea 🍵 Garbage Collector
kuro_kurorrr
1
160
バランスを見極めよう!実装の意味を明示するための型定義 TSKaigi 2025 Day2 (5/24)
whatasoda
1
220
flutter_kaigi_mini_4.pdf
nobu74658
0
160
ソフトウェア品質特性、意識してますか?AIの真の力を引き出す活用事例 / ai-and-software-quality
minodriven
17
5.2k
オープンソースコントリビュート入門
_katsuma
0
150
Digging into the Matrix: Practicing Code Archaeology
arthurdoler
PRO
0
120
Boast Code Party / RubyKaigi 2025 After Event
lemonade_37
0
120
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
172
14k
A designer walks into a library…
pauljervisheath
205
24k
The Pragmatic Product Professional
lauravandoore
33
6.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Code Review Best Practice
trishagee
68
18k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
40
7.3k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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