Sunday, November 27, 2005

What's in your build?

A basic build generally consists of clean, compile, and test. However, you can (and should) add more or tweak the build to make life easier and increase the quality of the code you produce. Most people _hate_ working on the build. Build languages are usually painful to work with and optimizing the build isn't very exciting. However, you should be running the build several times a day so each optimization can save you a lot of time over the life of the project.
There are other tools such as CheckStyle and FXCop that are supposed to be helpful. In theory they sound great; however, I've never used either so I didn't include either. Please let me know if you have any suggestions or optimizations I've missed.


Comments:
Checkstyle sounds like a good idea, but my experience with it suggests that making it a part of the build causes more harm than good. For example, I found this gem:
number.substring(0, Integer.parseInt ("3")). Why?
Checkstyle was set up to report magic numbers > 2. The developer in question (a lead !) wanted his code to look clean.
 
I have used checkstyle to various success. I suppose that having it part of an overnight build might be more useful. Like code coverage, checkstyle can provide intersting metrics (cyclomatic complexity, excessive method lengths, etc). If taken with a grain of salt and embraced by the entire team, it can be a useful feedback mechanism.

It is also well written so that you can write custom checks to detect project-specific anti-patterns that you might want to warn people about
 
John,

To be honest, we've had people do similar things and you know what we did? Hit the developer(s) around the head with a ClueByFour.

I think it's a bit of a stretch to blame the tool. For a start, there's no need to enforce the checks in the build.

Why not have the report run on each integration build so that you--as team lead or just nosey parker--can see what lovely turds are being laid in your source code?

Then you can go to the developer and begin the re-education process ala clockwork orange.

Cheers,

Simon
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?