The Joys and Pains of
Working With An Old
Codebase
Gordon Diggs
BACON 2014
Slide 2
Slide 2 text
The Joys and Pains of
Working With An Old
Codebase
Gordon Diggs
BACON 2014
Slide 3
Slide 3 text
if
total_guests
==
150
&&
total_guests
+
1
==
151
...
end
Slide 4
Slide 4 text
Outline
About Me
Introduction to our codebase
Adding features
Executing refactors
Tools we use
The joys
Slide 5
Slide 5 text
@gordondiggs
Record Collector
Slide 6
Slide 6 text
@gordondiggs
Baker / Cook
Slide 7
Slide 7 text
@gordondiggs
Baker / Cook
#devslovebaking
Slide 8
Slide 8 text
@gordondiggs
New York City Resident
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
"I have always found that
plans are useless but
planning is indispensable."
- Dwight D. Eisenhower
Slide 11
Slide 11 text
The Codebase
Ruby 2.1
Rails 2.3
Postgres, Redis, Memcached
Started in 2008
60 contributors
~128k lines of application code
Slide 12
Slide 12 text
#TODO:
redo
this
Slide 13
Slide 13 text
How to add features
Slide 14
Slide 14 text
1. Plan out the feature
Slide 15
Slide 15 text
1. Plan out the feature
Have developers involved in the planning
Slide 16
Slide 16 text
1. Plan out the feature
Have developers involved in the planning
!
Let your unique development concerns be known
Slide 17
Slide 17 text
1. Plan out the feature
Have developers involved in the planning
!
Let your unique development concerns be known
!
Make it a conversation
Slide 18
Slide 18 text
2. Do a technical
kick-off
Slide 19
Slide 19 text
2. Do a technical kick-off
What new data models do we need?
!
What needs to be refactored?
!
What might the challenges be?
Slide 20
Slide 20 text
3. Be prepared to do
something else entirely
Slide 21
Slide 21 text
4. Write lots of tests,
especially for things that
already exist
Slide 22
Slide 22 text
5. Document Things
Slide 23
Slide 23 text
Build awesome things
Slide 24
Slide 24 text
#
because
the
"update_attributes!"
does
not
behave
as
expected,
we
need
this
def
update_attributes_is_broken_with_nested_attribute_validations_in_rails
...
end
Slide 25
Slide 25 text
How to execute
refactors
Slide 26
Slide 26 text
Treat them like features
Slide 27
Slide 27 text
1. Plan out the refactor
Slide 28
Slide 28 text
2. Do a technical
kick-off
Slide 29
Slide 29 text
3. Write lots of tests,
especially for things that
already exist
Slide 30
Slide 30 text
4. Document Things
Slide 31
Slide 31 text
Build awesome things
Slide 32
Slide 32 text
Tools we use (and love)
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
No content
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
Peter Welch -
Programming Sucks
stilldrinking.org/programming-sucks
Slide 42
Slide 42 text
The Joys
Slide 43
Slide 43 text
Get to fix lots of bugs
Slide 44
Slide 44 text
Get to fix lots of
interesting bugs
Slide 45
Slide 45 text
Give time to
fix the bugs
Slide 46
Slide 46 text
Treat your codebase like
a campsite
Slide 47
Slide 47 text
Build awesome things
Slide 48
Slide 48 text
Thank you!
@gordondiggs
Special Thanks to: Mike Bernstein, Michael Hansen, Solomon
Kahn, Alan Macdougall, Aaron Quint, Todd Mazierski, Justin
Searls, Stephanie Shih, Alyssa Stein