Code Smell Metrics

For a recent posting on the ExtremeProgramming list, I put together this list of "metrics" I use to detect code smells. This list might also be helpful for people new to refactoring, to begin to understand how to detect poorly factored code. All of the specific numbers below must be tuned to your own tastes and coding style, of course.

I'm sure there are more, so feel free to add as many as you can think of. This list is VERY roughly in order from most smelly to least, so please try to preserve that if you change this list in place.


- KevinSmith

I don't know if any of these qualify as metrics. Most seem to be trigger points rather than measures of anything.
I'm not at all sure these qualify as metrics as opposed to indicators

You are correct. Many are metrics. Some are not. If you want to move all of this to CodeSmellIndicators?, feel free. KevinSmith

I'm not sure any of these are really metrics. They are great inidicators, but BooleanMetricsAreUseless.

frex: Metrics need to be measurable, which means that they need to be unambiguous. For those of us that can't get past a quoted use of the word "metric", I've added links to other discussions that may help illuminate the issues a bit more. I also added the entry about the static class to the list. -- TomKubit

Added few more notes - T. Wiszkowski
I'm sure that some people have scripts for DetectingCodeSmells?. Would anyone care to share? -- BenA

See DetectingCodeSmellsInPhp. -- BrentNewhall

View edit of March 19, 2008 or FindPage with title or text search