I would like to know if somebody often uses metrics to validate its code/design. As example, I think I will use:
- number of lines per method (< 20)
- number of variables per method (< 7)
- number of paremeters per method (< 8)
- number of methods per class (< 20)
- number of field per class (< 20)
- inheritance tree depth (< 6).
- Lack of Cohesion in Methods
Most of these metrics are very simple.
What is your policy about this kind of mesure ? Do you use a tool to check their (e.g. NDepend) ?
OO Metrics are a bit of a pet project for me (It was the subject of my master thesis). So yes I'm using these and I use a tool of my own.
For years the book "Object Oriented Software Metrics" by Mark Lorenz was the best resource for OO metrics. But recently I have seen more resources.
Unfortunately I have other deadlines so no time to work on the tool. But eventually I will be adding new metrics (and new language constructs).
Update We are using the tool now to detect possible problems in the source. Several metrics we added (not all pure OO):
There are still more. We keep the ones that give a good image of the pain spots in the code. So we have direct feedback if these are corrected.