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
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
38
Designing & Building RESTful JSON APIs
this_ahmed
4
5.1k
Other Decks in Programming
See All in Programming
Cloud Adoption Frameworkにみる組織とクラウド導入戦略(縮小版)
tomokusaba
1
220
Vue :: Better Testing 2024
up1
1
400
C#および.NETに対する誤解をひも解く
ymd65536
0
300
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.7k
自分だけの世界を創るクリエイティブコーディング / Creative Coding: Creating Your Own World
chobishiba
2
1.7k
[KR] Server Driven Compose With Firebase
skydoves
2
200
コードレビューと私の過去と未来
jxmtst
0
280
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
1
140
Integrating AI in Your Enterprise Java Applications
ivargrimstad
0
230
dbt-ga4パッケージを実業務に導入してみた話
t_tokumaru_feedcorp
0
130
フロントエンドの現在地とこれから
koba04
10
4.5k
5年分のツケを一気に払った話
soogie
3
1.4k
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
A designer walks into a library…
pauljervisheath
202
24k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
29
1.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Typedesign – Prime Four
hannesfritz
39
2.3k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
1
300
From Idea to $5000 a Month in 5 Months
shpigford
381
46k
Git: the NoSQL Database
bkeepers
PRO
425
64k
KATA
mclloyd
27
13k
What's in a price? How to price your products and services
michaelherold
243
11k
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