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
89
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
54
Designing & Building RESTful JSON APIs
this_ahmed
4
5.4k
Other Decks in Programming
See All in Programming
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
130
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
140
Moments When Things Go Wrong
aurimas
3
130
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
230
AI開発を加速するためにテスト戦略を言語化した
yoshihiro_shu
0
100
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
250
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.4k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
400
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
11k
Inspired By RubyKaigi (EN)
atzzcokek
0
470
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
310
Typedesign – Prime Four
hannesfritz
42
3.1k
Docker and Python
trallard
47
3.9k
How to build a perfect <img>
jonoalderson
1
5.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Chasing Engaging Ingredients in Design
codingconduct
0
200
Building AI with AI
inesmontani
PRO
1
1k
How GitHub (no longer) Works
holman
316
150k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
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