...码复杂度可能是含 有过多的条件语句( if、while 或者 for 语句等)造成的,可以通过圈复杂度数(Cyclomatic Complexity Number,CCN)的度量来检查。当 CCN 为 10 或超过 10 时,一般就表明该方法过 于复杂。
基于1个网页-相关网页
If you diagram the method shown in Listing 11 into a flow chart, you can easily count the number of edges and nodes and calculate the cyclomatic complexity, as shown in Figure 1.
如果把 清单 11 所示的方法画成流程图(见图 1),就很容易算出边数和节点数并计算出圈复杂度。
Some of the common questions relating to cyclomatic complexity are "How does my code compare to others?" and "What is a good number for a particular class?"
与圈复杂度相关的常见问题包括 “我的代码与别人的代码相比怎么样?” 和 “对于一个类,多大的数值是合适的?”
The cyclomatic complexity formula, first developed by Thomas McCabe, is based on the number of branches in a function.
圈复杂性公式(cyclomatic complexity formula),被Thomas Mc Cabe首先提出,它是基于一个函数的分支数量来确定复杂度的。
应用推荐