Refactoring Legacy Code 101 (Dev Jam / Clinic)
Level: Introductory
You’ve started your new project and “surprise” (not really) you’re dealing with legacy code. This unique workshop will focus on a few specific techniques that help make up the majority of what to do in improving legacy code design. Our forefathers gave us “Extract Method” and “Rename”. Cleaning up code is fun and challenging at times! When you achieve some level of code cleanliness or success you begin to feel the reward soon after, even during. A few agile-minded friends will be helping to walk attendees through a pairing adventure with plenty of typical legacy examples to work with together.
Process/Mechanics
- Short introductions
- Determine pair teams (Ideally pairs of two but we’re flexible. People should feel comfortable.)
- Choose some classic legacy examples
- Identify code smells identified by Martin Fowler and others such as
- Comments
- Long method
- Long parameter list
- Large class
- Dead or Future enhancement code
- Refactor away with techniques like
- Extract method
- Pull up/down method
- Rename and make code expressive
- Test Driven Development (TDD)
- Fix code at the wrong level of abstraction
- Refactor with patterns like
- The First Refactoring Step
- Refactoring In Very Small Steps
- Test Every Refactoring
- Refactor with principles like
- Single Responsibility Principle (identified by Uncle Bob Martin)
Learning outcomes
- How to start refactoring
- Learn how to improve code readability
- Work more effectively with legacy code
- Leave the code cleaner and better
- Learn how to build more cohesive code
Featured participants
Primary target persona
Other target personas
