Archive for October, 2007

Get the CRAP Level of Your Java Code

Saturday, October 20th, 2007

I have to admit, when I first heard about the open source project Crap4j, I thought it was a joke. It sounded like a sarcastic, tongue-in-check spoof on the masses of brittle legacy Java code accumulating daily in software development shops around the world.

It isn’t a joke.

The Crap4j Web site describes the Change Risk Analysis and Predictions software metric as “a mildly offensive metric name to help protect you from truly offensive code.” Well said. The levity of the name belies the seriousness of the problem. Java is no longer a new language. Greenfield development has made way for maintenance and incremental upgrades to massive legacy code bases for which the original development team is long gone.

We all know legacy Java code is often poorly documented, but dig a little deeper and you’ll discover something even worse: it’s poorly tested! Now, consider that legions of developers have added little tweaks and bug fixes along the way without giving consideration to meaningful refactoring. What else can you do but throw up your hands (or your lunch) and declare “This code is crap!”