Introduction to jCosmo

The jCosmo code smell browser [1] detects code smells in Java source code that can be used to review the quality of the analyzed code and indicate regions that could benefit from refactoring.

The source model extraction, implemented using the ASF+SDF Meta-Environment [2], parses Java code and outputs facts in Rigi Standard Format (RSF). The extracted source models contain information about several so-called ``code smells'': signs that suggest that code is problematic or violates programming guidelines. These smells can be used to assess the quality of the analyzed code. In addition to the code smells, the source models also contain facts about the program structure such as packages, classes, and methods, and the relationships between them.

The extracted source models are visualized using the Rigi program visualization tool [3]. The program structure is used to create a graph which can be manipulated to provide the different views needed for various reverse engineering tasks such as program understanding, architecture extraction, and redocumentation. This graph is augmented with smells using ``flag'' nodes: whenever a piece of code possesses a particular smell, the corresponding node gets an additional node attached to it to document the smell. Several visualizations have been developed that show these smells at various levels of abstraction. The smell display is intended to help assess the system's quality and support refactoring by providing a quick and intuitive overview of which parts of the system need refactoring. The code smells that are currently implemented are concerned with switch statements, instanceof statements, and type casts. New smells can be added by plugging additional modules into the extractor and by extending the visualization scripts.

References

  1. jCosmo homepage: http://www.cwi.nl/projects/renovate/javaQA/"
  2. M.G.J. van den Brand, et al. The ASF+SDF Meta-Environment: a component-based language development environment. In Proceedings of Compiler Construction 2001 (CC 2001), LNCS. Springer, 2001.
  3. K. Wong, S.R. Tilley, H.A. Müller, and M.-A.D. Storey. "Structural redocumentation: A case study." IEEE Software, pages 46-54, January 1995.

Download and install

Please see our detailed instructions for downloading and installing the jCosmo code smell browser.


Last updated:
Comments: Eva van Emden/Leon Moonen