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
29
Sane User Interfaces for Ruby on Rails
this_ahmed
2
150
Compose Software Like Nature Would
this_ahmed
1
170
Welcome to JavaScript
this_ahmed
0
40
Designing & Building RESTful JSON APIs
this_ahmed
4
5.2k
Other Decks in Programming
See All in Programming
sappoRo.R #12 初心者セッション
kosugitti
0
230
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
170
Grafana Cloudとソラカメ
devoc
0
140
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
770
Honoとフロントエンドの 型安全性について
yodaka
4
250
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
4
1.3k
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
動作確認やテストで漏れがちな観点3選
starfish719
6
1k
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
370
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
335
57k
Building an army of robots
kneath
302
45k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Done Done
chrislema
182
16k
Music & Morning Musume
bryan
46
6.3k
Become a Pro
speakerdeck
PRO
26
5.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Building Your Own Lightsaber
phodgson
104
6.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
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