Talk from Joe Mastey
Common approaches to working with legacy code
- Continue adding onto poorly structured code
- Making small changes
Alternative approach
- Name the evil (the issues with the codebase)
- Sorting files by line length
bundle exec rake stats
- Using tools such as RuboCop to set code structure benchmarks
- Adding Rspec tests that checks for line counts in a program
"As we fix things, we are going to break things."
Priorities
- Make your tests better - delete poorly written tests
- Make writing new tests fast - attempt to write tests that don't need to interface with Rails directly
- Eliminate dynamic code - metaprogramming can make a codebase unreadable (and therefore incredibly challenging to add/update/etc) - readability is vital
- Behead the dragon - tear apart convoluted components
Key to success: Ensure to focus on the process.
Link to his slide deck