Find your crappy code

crap4JCoding Standards play a vital role in the development of any software applications and development irrespective of the language that is used to develop the same. Every language whether it can be C, C++ or Java following the coding standards is must for any applications mainly to address bugs, memory leaks, performance issues and scalability. Since the style of coding may vary from language to language or developer to developer always there is always a degree of error in any software development. Most of the time the code gets crappy when multiple developers started working on the same piece of class or code and results in maintainability issues. There is always a possbility of crap code present in any software application but the degree varies. How crappy is your code ? Can somebody tell the degree of crappiness ? The answer is Yes. Alberto Savoia and Bob Evans of Agitar Labs which is a research division of Agitar Software came up with a solution called Crap4J framework for Java.

What is this Crap4J all about? What is so special about this framework? Crap4J is a framework written in java that implements CRAP (Change Risk Analysis and Predictions) software metric. With the help of some built-in automated tests Crap4J uses cyclomatic complexity and code coverage to estimate the risks and predicts the complexity and maintainability of the code. To find the degree of crappiness Crap4J uses the formula,

CRAP(m) = comp(m)^2 * (1 – cov(m)/100)^3 + comp(m)

Where comp(m) is the cyclomatic complexity of method m, and cov(m) is the test code coverage provided by automated tests (e.g. JUnit tests, etc).

crap4j Report

Crap4J can be used as a plugin in Eclipse and along with the automated JUnit tests we can find the code coverage and the complexity of the code provided if the test cases are extensive. Crap4J rates the code using a CRAP index or CRAP Number. Lower the CRAP number,less the risk of maintainability and good scalability. Crap4j can also estimate of the amount of work required to address crappy methods. Eclipse plugin for Crap4J can be downloaded from here. Want to know about the metric, check the following link.

Want to know more or Want to try ? Check out Crap4J.

The demo video about crap4J in youtube can be viewed below,

Popularity: 1% [?]

Share or Bookmark:
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • BlinkList
  • Furl
  • StumbleUpon
  • TwitThis
  • YahooMyWeb

May be you like to read this

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>