|
Wednesday, 02 April 2008 23:44 |
|
Page 1 of 5  | Code checker scans Java source code in your favorite IDE (I assume Eclipse :-)) There are basically of 2 types: - On the fly code checker, as soon as you type a word or save a new document, it run and give a real time feedback
- Offline checker or so called static code analyzer that can be run during the build of your java components
| Why using a code guidelines checker? These tools are highly recommended across a team of different developers for the following reasons: - These tools are highly configurable and can be made to support almost any coding standard.
- Ideal for projects that want to enforce a coding standard (ideally where not all developer code the same way)
- Ease your debugging and maintenance costs by making the code more readable: developers do not have to worry about
deciphering individual coding styles when working on a piece of code they did not write. - They can detect possible bugs or dangerous coding behavior - empty try/catch/finally/switch statements
- Detect dead code - unused local variables, parameters and private methods
- Sub optimal code - wasteful String/String Buffer usage
- Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
- Duplicate code - copied/pasted code means copied/pasted bugs
- Find class design problems, bug patterns like double checked locking.
They give an immediate "objective" feedback and help developers recognize where they have been excellent or lazy; It gives team leader, an opportunity to study the code, design and team from a different perspective; and by slicing off whole classes of faults, You can concentrate more on design shortcomings.
Features All code checker share more or less the same features - Violations severity can be defined at rules level (error, warning, ignore, other).
- Rules can be triggered by threshold/values.
- Rules are stored in XML files.
- Java editor highlight offending lines/rules in violation
- Rules can be extended (require some strong tree parsing and language knowledge)
- Integration in major IDE (eclipse, IDEA, ...)
- Integration in ANT, Maven, ...
Attention The major issues wont be to install these tools... Most developers are convinced that their code is the best, and bad habits are difficult to get rid of. The biggest pain will be to force all developers to agree on a set of common rules that you want to enforce. A good starting point is to use some well known rules or good practices from the industry. Sun is for example publishing some code writing rules. I will look at the major open source and free code checker on the market in this series of articles: - PMD
- Findbugs
- Checkstyle
- Code coverage
|
Anyone has a tutorial for developing ...
what type of antifreeze do i use in m...
css lessons - css scrollbar examples ...
SILLY
Now I can stand at the station watchi...