I’ve been using Eclipse and it is a very nice IDE. I’m very impressed with the number of plugin’s available for it. One of the plugins I’ve been using is called CheckStyle. Basically it can check your code for errors whenever you save it. The errors are configurable and it comes with a default implementation of the Sun Java coding style. It can be very annoying to apply it to code that you have already written, but if you use it as you are writing code it makes it much easier to make sure you are coding in a consistent way.

I imagine that in a development shop, it would be very helpful to require that all code be run through CheckStyle before allowing it into the repository. The team could determine what they want to enforce and it would make sure that everyone is doing things consistently.

I took a small program I had written previously and turned on CheckStyle. On of the first things it complained about was and import statement like:


CheckStyle wants to see the individual classes you are importing. It also complains if you import a class that you never use. While both of these things are rather minor they do make the code more readable and they are only a small part of what CheckStyle looks for.

CheckStyle is customizable, so if it is enforcing a rule that you don’t agree with you can turn that rull off. You can create your own rules or modify the existing ones.

Overall CheckStyle seems like a very good way to help enforce good code practice, but it would probably be difficult to implement on an existing project unless you used a greatly reduced ruleset or were willing to dedicate a significant amount of time to cleaning up your code.


Leave a Reply

Your email address will not be published. Required fields are marked *