Introduction

Everyone agrees that unit testing your code is a great idea. But, we can take it further. Most modern programming languages (Java, Smalltalk, Ruby, etc) have powerful reflective capabilities that allow programmers to reflect on their source. Automated standards enforcement is an idea that combines the power of unit testing and reflection together. It tests that team contracts and coding standards are kept in check. Violations are known immediately and not during the code review. Reviews themselves can now focus on business logic and not mundane concerns such as making sure resources are properly finalized. It allows the developer to save face by being able to fix their code before check in. It's also better than a document that no one will read. Enforcing standards through testing allows developers to think about complex business problems and keep the code clean. Finally, it ensures team decisions are not forgotten. We have a test to keep us honest.

Downloads (All contain unit tests to show what is possible)

Reflective Testing (Java Version): Requires Java 5, JUnit 3.8, and BCEL 5.2
Reflective Testing (Squeak Version): Requires Squeak 3.8

Presentations

Smalltalk Solutions 2006
Omaha Java User's Group 2006 (coming soon)

Recommended Reading

Books

"Software Testing Techniques"-Beizer
"Code Complete 2"-McConnell
"Object-Oriented Software Metrics"-Lorenz, Kidd
"Object-Oriented Reegineering Patterns"-Demeyer, Ducasse, Nierstrasz
"Working Effectively With Legacy Code"-Feathers
"AspectJ In Action"-Laddad (Chapter 6)

Articles

"Finding Refactorings via Change Metrics"-Demeyer, Ducasse, Nierstrasz
"Metrics, Do They Really Help?"-Demeyer, Ducasse
"Big Ball Of Mud"-Foote, Yoder

Projects That Help

Java

JUnit
BCEL
JMetric
AspectJ

Smalltalk

SUnit
Method Wrappers
AspectS
SLint