
1996. Smalltalk Best Practice Patterns. Prentice Hall. (ISBN 978-0134769042)
1996. Kent Beck's Guide to Better Smalltalk : A Sorted Collection. Cambridge University Press. (ISBN 978-0521644372)
1999. Extreme Programming Explained: Embrace Change. Addison-Wesley. Winner of the Jolt Productivity Award. (ISBN 978-0321278654)
2000. Planning Extreme Programming. With Martin Fowler. Addison-Wesley. (ISBN 978-0201710915)
2002. Test-Driven Development: By Example. Addison-Wesley. Winner of the Jolt Productivity Award. (ISBN 978-0321146533)
2003. Contributing to Eclipse: Principles, Patterns, and Plugins. With Erich Gamma. Addison-Wesley. (ISBN 978-0321205759)
2004. JUnit Pocket Guide. O'Reilly. (ISBN 978-0596007430)
2004. Extreme Programming Explained: Embrace Change, 2nd Edition. With Cynthia Andres. Addison-Wesley. Completely rewritten. (ISBN 978-0201616415)
2008. Implementation Patterns. Addison-Wesley. (ISBN 978-0321413093)
>> Selected papers
1987. "Using Pattern Languages for Object-Oriented Programs". With Ward Cunningham. OOPSLA'87.
1989. "A Laboratory For Teaching Object-Oriented Thinking". With Ward Cunningham. OOPSLA'89.
1989. "Simple Smalltalk Testing: With Patterns". SUnit framework, origin of xUnit frameworks.
With a testing framework, you won't waste time rolling your own. For Java, you could start with JUnit.
TDD is a formalized approach to writing test functions as you work, which you already do, while simultaneously designing your code. There are many sources on it around the internet, but Kent Beck's book took the magic out of it (a good thing) for me: http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0...
Of course, there are many other specific techniques you can use to test that your algorithms do the right thing, all dependent on what you've made. Regardless, I try to make sure that the a real user gets their hands on an up to date build as often as possible, and they're sure to show me all of the ways that my software is technically excellent, yet in no way solves their actual problem.