Stelligent Home Page
CONSULTING  •  COACHING  •  COLLABORATING

Quick Links
 

Stelligent Coverage


The image “http://www.ibm.com/i/v14/t/ibm-logo.gif” cannot be displayed, because it contains errors.




Automation for the people: Continual refactoring

Using static analysis tools to identify code smells

The goal of refactoring is to improve the overall design of the code; making it easier to read and more easily maintained.  Deciding what code to refactor is often based upon the code's smell, or a hint that something has gone wrong somewhere in your code.  In the latest installment of Automation for the people, Stelligent CTO, Paul Duvall explains how to use static analysis tools to identify code smells to refactor, with examples showing how to improve odiferous code. 

Published by the popular IBM developerWorks', the article, "Continual refactoring" demonstrates how open source static analysis tools such as CheckStyle, PMD, FindBugs, JavaNCSS, and JDepend help teams gain visibility into their code base for consistently finding and fixing code smells in a repeatable manner.  

You'll also learn how to:
  • Reduce conditional complexity code smells by measuring cyclomatic complexity using CheckStyle and providing refactorings such as Replace Conditional with Polymorphism

  • Remove duplicated code smells by assessing code duplication using CheckStyle and providing refactorings such as Pull Up Method

  • Thin large class code smells by counting source lines of code using PMD (or JavaNCSS) and providing refactorings such as Extract Method

  • Wipe out too many imports code smells by determining a class's efferent coupling using CheckStyle (or JDepend) and providing refactorings such as Move Method

The "Automation for the people" series is dedicated to exploring the practical uses of automating software development processes and teaching you when and how to apply automation successfully. Also, check out developerWorks' "Improve Your Java Code Quality" discussion forum for topics addressing best practices for ensuring your code is the best it can be.