The complexity is measured by the number of if, while, do, for, ?:, catch, switch, case statements, and operators && and || (plus one) in the body of a constructor, method, static initializer, or instance initializer. It is a measure of the minimum number of possible paths through the source and therefore the number of required tests. Generally 1-4 is considered good, 5-7 ok, 8-10 consider re-factoring, and 11+ re-factor now!
complexity 是指if, while, do, for, ?:, catch, switch, case && and || 在构造函数,方法,静态初始化,实例初始化?中的数量。他用来衡量执行代码经过的最少路径以及由此需要的测试数。
通常1-4表明非常好,5-7表明可以,8-10表明需要重构,11以上表明马上重构
complexity 是指if, while, do, for, ?:, catch, switch, case && and || 在构造函数,方法,静态初始化,实例初始化?中的数量。他用来衡量执行代码经过的最少路径以及由此需要的测试数。
通常1-4表明非常好,5-7表明可以,8-10表明需要重构,11以上表明马上重构
本文介绍了衡量代码复杂度的标准,通过计数特定控制结构及运算符的数量来评估代码的可测试性和可维护性。通常情况下,较低的复杂度数值表明代码更易于理解和维护。
1174

被折叠的 条评论
为什么被折叠?



