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
120
Working With Legacy Rails Apps
Ahmed Omran
July 10, 2015
Tweet
Share
More Decks by Ahmed Omran
See All by Ahmed Omran
Sane User Interfaces for Ruby on Rails
this_ahmed
2
130
Compose Software Like Nature Would
this_ahmed
1
140
Welcome to JavaScript
this_ahmed
0
34
Designing & Building RESTful JSON APIs
this_ahmed
4
5.1k
Other Decks in Programming
See All in Programming
Semantic search with Django and pgvector
pauloxnet
0
240
オブジェクト指向のリ・オリエンテーション~歴史を振り返り、AI時代に向きなおる~
hanyudaeiiti
10
5.6k
今、知っておきたい! 生成AIエージェントの世界
elith
3
340
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
190
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
370
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
25
7.8k
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.2k
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
39
18k
Elm 0.19.0 Changes
bkuhlmann
0
480
Doctrine ORMでValue Objectを扱う方法4選 #phpstudy / 4 ways to handle Value Objects with Doctrine ORM
77web
4
110
Site Reliability Engineering for GMO
pyama86
6
940
甘い香りに誘われてVanilla Extractを1年間運用してみた
miyahkun
1
110
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
115
18k
The Invisible Side of Design
smashingmag
294
49k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Designing with Data
zakiwarfel
95
4.8k
Building Flexible Design Systems
yeseniaperezcruz
318
37k
Become a Pro
speakerdeck
PRO
10
4.5k
For a Future-Friendly Web
brad_frost
171
8.9k
It's Worth the Effort
3n
180
27k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
16k
Atom: Resistance is Futile
akmur
258
25k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
Reflections from 52 weeks, 52 projects
jeffersonlam
344
19k
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