$30 off During Our Annual Pro Sale. View Details »
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
150
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
62
Sane User Interfaces for Ruby on Rails
this_ahmed
2
170
Compose Software Like Nature Would
this_ahmed
1
200
Welcome to JavaScript
this_ahmed
0
47
Designing & Building RESTful JSON APIs
this_ahmed
4
5.3k
Other Decks in Programming
See All in Programming
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
5
1.1k
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
6.3k
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
5
620
目的で駆動する、AI時代のアーキテクチャ設計 / purpose-driven-architecture
minodriven
11
3.7k
イベントストーミングのはじめかた / Getting Started with Event Storming
nrslib
1
770
Herb to ReActionView: A New Foundation for the View Layer @ San Francisco Ruby Conference 2025
marcoroth
0
210
CSC305 Lecture 14
javiergs
PRO
0
330
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
110
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
7.5k
dotfiles 式年遷宮 令和最新版
masawada
1
230
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
110
モビリティSaaSにおけるデータ利活用の発展
nealle
1
670
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
How STYLIGHT went responsive
nonsquared
100
5.9k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Producing Creativity
orderedlist
PRO
348
40k
Designing for Performance
lara
610
69k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Faster Mobile Websites
deanohume
310
31k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Facilitating Awesome Meetings
lara
57
6.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
68k
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