File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Agile and Other Processes and the fly likes Clean Code A Handbook of Agile Software Craftsmanship - Metrics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Clean Code A Handbook of Agile Software Craftsmanship - Metrics" Watch "Clean Code A Handbook of Agile Software Craftsmanship - Metrics" New topic
Author

Clean Code A Handbook of Agile Software Craftsmanship - Metrics

Iván Párraga
Ranch Hand

Joined: Dec 02, 2007
Posts: 54
Hi,

One possible way to measure the quality of the software is to have as much as possible automated metrics using tools such as FindBugs, PMD, Checkstyle, Simian, Cobertura, etc. They provide fast feedback and give an overall perception of what the quality of the code is. In fact, in some organization these metrics are used to evaluate how good a project (or a developer) is.

Do you think this is a good approach? Do you think the use os these automated tools is enough to measure code quality? If not, what is your proposal to detect bad quality code taking into account some of the pressures of our industry such as time pressure?

Cheers,

Iv�n


Iván Párraga García
SCWCD 5, SCJD, SCJP 5, MySQL 5 DBA
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
At the Agile 2008 conference, in his keynote Uncle Bob proposed that the only meaningful metric regarding code quality is "WTF per minute". I guess it was only partly tongue in cheek...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
Originally posted by Ilja Preuss:
At the Agile 2008 conference, in his keynote Uncle Bob proposed that the only meaningful metric regarding code quality is "WTF per minute"


Nice one, but I have a comment. Those metrics might prove useful in some areas regarding code quality (following a certain coding style, number of parameters in a method, LOC in a method, etc.), but they are not enough. The human factor is vital, and it's the most important


Visit my blog: http://jnassef.blogspot.com/
Lutz Hankewitz
Greenhorn

Joined: Dec 10, 2007
Posts: 5
How about the OOAD Metrics from Chidamber and Kemerer
OOAD Metrics from Chidamber and Kemerer


Unfortunately I saw these metrics just in expensive Metrics collecting tools
for C++ in the past.

Do you have any experince with these? Or do you avoid these kind a
metrics?

Kind regards,

Lutz
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
There's a nice plugin for eclipse called metrics that does some of that which is great, but as I said earlier, those plugins help you a little bit, but I can write lousy code that's going to produce good results in metrics tools.
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Originally posted by Alaa Nassef:
Nice one, but I have a comment. Those metrics might prove useful in some areas regarding code quality (following a certain coding style, number of parameters in a method, LOC in a method, etc.), but they are not enough. The human factor is vital, and it's the most important


Absolutely.

Low numbers on such metrics give us places to look for improvement. High metrics do not guarantee anything. In some cases, I've seen really good numbers backed by fairly bad code.

Jeff


Books: Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Robert Martin
Author
Ranch Hand

Joined: Jul 02, 2003
Posts: 76
Originally posted by Iv�n P�rraga:
Hi,

One possible way to measure the quality of the software is to have as much as possible automated metrics using tools such as FindBugs, PMD, Checkstyle, Simian, Cobertura, etc. They provide fast feedback and give an overall perception of what the quality of the code is. In fact, in some organization these metrics are used to evaluate how good a project (or a developer) is.

Do you think this is a good approach? Do you think the use os these automated tools is enough to measure code quality? If not, what is your proposal to detect bad quality code taking into account some of the pressures of our industry such as time pressure?

Cheers,

Iv�n


I think there are some very good metrics to follow. Cyclomatic complexity should be kept to a minimum. Method size, and class size should be small. You can read my PPP book (http://tinyurl.com/5ebk7h) for some of the dependency metrics that I like to use.

...However, metrics are a carving knife when what you really need is a scalpel. Metrics can tell you something is wrong, but they can't give you much guidance about the precise cause. In the case of clean code, the cause is discipline and professionalism (or it's lack). Fixing that problem is a matter of instilling pride of workmanship into the team.


---<br />Uncle Bob.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Clean Code A Handbook of Agile Software Craftsmanship - Metrics
 
Similar Threads
How to motivate team for Unit testing
Required answers to these Testing questions
Software by Numbers
[Refactoring project] How do I begin this ?
correlating metrics to software maintainability?