you are not logged in

Navigation

User login

Quality of Development

For the Mixed projectteam to produce high quality code, we use several tools.
High quality code is readable, manageable, well documented, well tested and should not have circular dependencies.
Furthermore.....it should be bug free.....

To help the developers to meet these goals, we use the following tools:


Code (formatting) conventions

http://checkstyle.sourceforge.net/

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.

- CheckStyle plugin for Eclipse to help the developer to make code compliant to the Mixed Code Conventions: http://eclipse-cs.sourceforge.net/update
- CheckStyle plugin for Maven to report Mixed Code Conventions Violations.
- The Mixed Code Conventions (Checkstyle Checker Configuration) can be found in the repository: trunk/docs/checkstyle/mixed_checkstyle_configuration.xml
- To help the developers to adhere to the code conventions checked by Checkstyle, the Eclipse Code Formatter is properly configured. The Eclipse Code Formatter Configuration File can be found in the repository: trunk/docs/eclipse/mixed_eclpise_code_formatter.xml

Continuum and Maven are configured to let Checkstyle create a report during the nightly builds.

 

PMD

http://pmd.sourceforge.net/

PMD scans Java source code and looks for potential problems like:

  • Possible bugs - empty try/catch/finally/switch statements
  • Dead code - unused local variables, parameters and private methods
  • Suboptimal code - wasteful String/StringBuffer usage
  • Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
  • Duplicate code - copied/pasted code means copied/pasted bugs

- PMD plugin for Eclipse to help developers to make code compliant to PMD ruleset: http://pmd.sf.net/eclipse
- PMD plugin for Maven to report PMD violations.
- The PMD ruleset for Mixed can be found in the repository: trunk/docs/pmd/mixed_pmd_rules.xml

Continuum and Maven are configured to let PMD check the code for violations and create a report during all builds.
A build will fail when a PMD rule with priority "error" is violated.

 

CPD

http://pmd.sourceforge.net/cpd.html

Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it.

- CPD is included with PMD, so no extra plugin is needed.

   

Findbugs

http://findbugs.sourceforge.net/

Findbugs is a program to find bugs in Java programs. It looks for instances of "bug patterns" --- code instances that are likely to be errors.
It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Bug patterns arise for a variety of reasons:

  • Difficult language features
  • Misunderstood API methods
  • Misunderstood invariants when code is modified during maintenance
  • Garden variety mistakes: typos, use of the wrong boolean operator

- Findbugs plugin for Eclipse to help developers to serach code for bugs in an early stage of development: http://findbugs.cs.umd.edu/eclipse
- Findbugs plugin for Maven to report Findbugs violations.
- The Findbugs rules can be modified by using filters.
  The filter files for Mixed can be found in the repository: trunk/docs/findbugs/mixed_findbugs_include_filter.xml
                                                                                                    trunk/docs/findbugs/mixed_findbugs_exclude_filter.xml
A manual for applying filters: http://findbugs.sourceforge.net/manual/filter.html

Continuum and Maven are configured to let Findbugs create a report during all builds.


JDepend

http://clarkware.com/software/JDepend.html

JDepend traverses Java class file directories and generates design quality metrics for each Java package.
JDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to manage package dependencies effectively.

- JDepend plugin for Eclipse to help developers to search the code for dependencies: http://andrei.gmxhome.de/eclipse/
- JDepend plugin for Maven to report dependencies in the Mixed code.

Continuum and Maven are configured to let JDepend create a report during all builds.
For now, we only check the reports to detect cyclic dependencies. If one is detected......it should be resolved!

 

JUnit Test

http://junit.sourceforge.net/

The Mixed project uses the test driven development method, in the common three steps: write test, write code, refactor.
Unit tests are created as well as integration tests.
For unit testing we use the Eclipse IDE which comes with JUnit support.

JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

- JUnit plugin for Eclipse to create unit tests, this plugin is default for Eclipse installations.
- JUnit plugin for Maven to run the tests during the build.

Continuum and Maven are configured to let JUnit create a report and run the unit tests during all builds.
If an outcome of one of the tests is negative, the build will fail.

 

CodeCoverage

http://cobertura.sourceforge.net/

Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.

http://coverlipse.sourceforge.net/index.php

Coverlipse is an Eclipse plugin that visualizes the code coverage of JUnit Tests, which you can use to assess the percentage of source code that has a corresponding test.

- Cobertura Code Coverage plugin for Maven to report code coverages.
- There seems to be no Cobertura Code Coverage plugin for Eclipse. Instead, for our Eclipse IDE we use the Eclipse plugin Coverlipse: http://coverlipse.sf.net/update
- If you want use cobertura on the development environment to check code coverage, use Maven to generate a report: 'mvn cobertura:cobertura').

Continuum and Maven are configured to let Cobertura Code Coverage create a report during all builds.
We aim for a 80% code coverage, but the build will not fail when this target is not met.

 

Taglist

Continuum and Maven are configured to create a Taglist report during all builds.
This list shows us where in our code there are Todo- and Fixme-tags.

 

Source Xref

Continuum and Maven are configured to put the source code on the maven report sites during all builds.
These Source Xref reports can be used to do the code review (i.e.). In this way the code reviewer can surf to the code without having the need of a source code IDE or editor.
  

JavaDoc

http://java.sun.com/j2se/javadoc/writingdoccomments/

Last but not least: we use java doc to document our source code and generated the well known javadocs.


Code Review

Dans incorperates some kind of the eXtreme Programming methodology (XP). In some kind, because (for example) we do not practise pair-programming, instead we apply peer-programming.
In peer-programming the code review carries a heavy responsibility. For this purpose the reviewer can use this article to do the code review and check the above requirements and reports.

 


JDepend can do more

Dependencies between software components can cause huge problems when changing code. Even without cyclic dependencies it is possible to have a lot of dependencies between lots of components. This means that when any component changes, it always impacts one or more other components.

It is good to create a policy for dependencies and check it based on the reports of JDepend.

This will, in the long run, make your software much more and better maintainable.

Herman Suijs