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
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
220
Rubyのパフォーマンスプロファイリングの改善 / Enhancing performance profiling for Ruby
osyoyu
1
410
実用的かつリーズナブルな 「Azure × Gemini × LINE」~キャラクターBot 実装ライブデモ~
tomodo_ysys
1
170
CSC307 Lecture 14
javiergs
PRO
0
220
Clean Architecture by TypeScript & NestJS
ryounasso
0
150
Introduction to GitOps
hwchiu
0
110
Product Management LT会_クアンド新家
shinshin
0
260
How to use Macrobenchmark
veronikapj
0
160
Rust.Nagoya #1
codemountains
0
170
HMSコンペ 11th Solution (team : kansai-kaggler)
t88
1
680
[After Kotlin Fest 2024 LT Night @ Sansan] もっともっとKotlinを好きになる!K2 Compiler Pluginで遊んでみよう!
kitakkun
2
260
DynamoDB コスト最適化っぽいことの基本 with Terraform
kuro_kurorrr
2
250
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
Ruby is Unlike a Banana
tanoku
96
10k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
Agile that works and the tools we love
rasmusluckow
325
20k
The Illustrated Children's Guide to Kubernetes
chrisshort
39
47k
How to train your dragon (web standard)
notwaldorf
79
5.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
78
15k
Into the Great Unknown - MozCon
thekraken
20
1.3k
BBQ
matthewcrist
82
9k
Learning to Love Humans: Emotional Interface Design
aarron
269
39k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
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