This is an example for working with legacy code that I use in teaching.
The original code is the one that Brett Schuchert has used in talks about working with legacy code.
- Watch him work with the C# version: http://vimeo.com/34484105
- Get the code here.
- See "A story about too much power" for a written treatment of the Java version of this example.
master
The legacy code we start out with.golden_master
Now we have an integration test and a pseudo-unit test that uses black magic from JMockit.solution
is not complete, but a significant step forward.- Class for currency symbols extracted.
- Extracted caching to decorator pattern using TDD.
Run all tests with ./gradlew
(*nix) or gradlew.bat
(Windows)
Create project files with ./gradlew eclipse
or ./gradlew idea
Thanks to Brett Schuchert for this prolific example – and for generally publishing everything on his wiki under the Creative Commons Attribution-ShareAlike license.
This material is published under the same CC BY-SA 2.5 license as Brett’s talk.