This is a discussion of legacy refactoring as presented to the Berlin Java Users' Group 2011, November, 10.
The beginning is a mess of ugly code that uses an HttpClient to acquire currency conversions. The higher-order goal of the code is to find deals in currency translation that result in a net positive.
Along the way we look at/discuss
- Introducing an Instance Delegator
- Making a resettable singleton
- Using JMockit to work absolute black magic
- Writing tests on top of existing legacy code
- The woes of trying to get something under test that really wasn't written very well
This was an all-new example developed for the talk, and this was the first time I've used it such. As a result, while there are lots of false started and I made several actual, honest mistakes, I enjoyed it more than maybe a talk I've done many times.
Hope you enjoy warts and all