说lenchar是源代码中的字符数,它是否是源代码长度的有效度量?
答案 0 :(得分:1)
不,不是。人们可以"游戏"您的指标没有达到质量。
如果您的指标是"很多字符==好"然后你最终得到非常大的源文件&维护噩梦的课程,通常名字很差(再一次,只是为了比较你的指标)或者是一个淫秽的评论:
var excessivelyLongVariableNameSoWhenBonusTimeComesAroundAustinIsRewardedMightily = 0;
/*
This for loop loops over the entire collection (as implemented in IEnumerable
and is fully explained later). My goal here was a O(1) implementation but
since that's highly unlikely (possible mathematically impossible but I'm no
PhD so I'll just leave it to them.
Oh yeah, the motive -- I'm trying sum the integers between 0 and 9 (inclusive)
*/
for(int i = 0; i < 10; i++)
sum += i;
相反,当&#34;很多字符==坏&#34;然后你的名字很糟糕:
var x = 1
可执行线路会更好,但即便如此,你也可以开放游戏。&#34;但即便如此,人们也可以通过抽取一堆无操作线进行游戏。
您最有可能更好地使用像......这样的指标。