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
19
Sane User Interfaces for Ruby on Rails
this_ahmed
2
140
Compose Software Like Nature Would
this_ahmed
1
160
Welcome to JavaScript
this_ahmed
0
38
Designing & Building RESTful JSON APIs
this_ahmed
4
5.1k
Other Decks in Programming
See All in Programming
Recoilを剥がしている話
kirik
5
6.6k
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
930
Haze - Real time background blurring
chrisbanes
1
510
CSC305 Lecture 26
javiergs
PRO
0
140
Jakarta EE meets AI
ivargrimstad
0
240
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
MCP with Cloudflare Workers
yusukebe
2
220
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
7k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Producing Creativity
orderedlist
PRO
341
39k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Faster Mobile Websites
deanohume
305
30k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
GitHub's CSS Performance
jonrohan
1030
460k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
GraphQLとの向き合い方2022年版
quramy
44
13k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Designing on Purpose - Digital PM Summit 2013
jponch
116
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