Java – code complexity analysis tool goes beyond loop complexity

Although loop complexity is a valuable indicator, I tend to think of it as a poor tool for identifying code that is difficult to maintain In particular, I tend to find that it just highlights certain types of code (such as parsers) and misses difficult recursion, threading and coupling problems, and many defined anti patterns

What other tools are available to identify problematic java code?

Please note that we have used PMD and findbugs, which I think is a good method level problem identification

Solution

My experience is that the most important indicators when viewing code maintainability are:

>Loop complexity to identify large blocks of code that may be difficult to understand / modify. > Nesting depth, find similar points (high nesting depth automatically increases CC, but not necessarily in the opposite way, so the scores of both are very important). > In / out to better understand the relationship between methods / classes and the practical importance of individual methods

Including dynamic techniques is often useful when examining code written by others Simply run common usage scenarios through the analyzer / code coverage tool to find:

>Code actually executed (the analyzer is good for this, but ignores the timing information instead of looking at the hit count). > Code coverage is easy to find (almost) dead code To prevent you from spending time refactoring code that is rarely executed

Common suspects, such as any analyzer, code coverage and metrics tools, can usually help you obtain the data you need to make these assessments

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>