Testing Legacy Code & Refactoring Patterns

Track: Core Java
Abstract
Our jobs don't deal with new code, but old crufty and evil code. How do we test such code? How do we get through it? How can we surgically remove some of this harmful code and make it testable? How can we move away from excessive mocking?

This presentation looks at harmful code and discusses some strategies we can use to diagnose, test, apply, and finally refactor to produce something that promotes some sanity in your development process. The content of this course is all in Java and Junit. We discuss the following maneuvers:

* Extract Delegate
* Extract Interface
* Parameterize Method
* Parameterize Constructor
* Sprout Method and Class
* Wrap Method and Class
Daniel Hinojosa
Daniel Hinojosa is a programmer, consultant, instructor, speaker, and author. With over 20 years of experience, he does work for private, educational, and government institutions. Daniel loves JVM languages like Java, Groovy, and Scala; but also works with non-JVM languages like Haskell, Ruby, Python, LISP, C, C++. He is an avid Pomodoro Technique Practitioner and makes every attempt to learn a new programming language every year. Daniel is the author of Testing in Scala and the video of Beginning Scala Programming Video Series for O’Reilly Publishing. For downtime, he enjoys reading, swimming, Legos, football, and cooking.