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
170
0
Share
Working With Legacy Rails Apps
Ahmed Omran
July 10, 2015
More Decks by Ahmed Omran
See All by Ahmed Omran
Compose Software Like Nature Would - RubyConf 2024
this_ahmed
0
87
Sane User Interfaces for Ruby on Rails
this_ahmed
2
180
Compose Software Like Nature Would
this_ahmed
1
230
Welcome to JavaScript
this_ahmed
0
53
Designing & Building RESTful JSON APIs
this_ahmed
4
5.4k
Other Decks in Programming
See All in Programming
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
2
150
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
150
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
200
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
410
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
0
220
🦞OpenClaw works with AWS
licux
1
370
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
3.2k
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
1
190
GitHubCopilotCLIをはじめよう.pdf
htkym
0
340
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
510
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
So, you think you're a good person
axbom
PRO
2
2k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
170
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
560
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
300
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Rails Girls Zürich Keynote
gr2m
96
14k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
190
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
310
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