这篇文章的原文在这里(http://mindprod.com/jgloss/unmain.html),我看完后我想说:
我把文章节选了一些,也并没有完全翻译,简译一下,也加入了一些自己的调侃。对于有下面这些编程习惯的朋友,请大家对号入座。另外,维护程序的朋友们,你们死定了!!
woodpeckerIf builders built buildings the way programmers write programs, then the first woodpecker that came along would destroy civilization. (如果建筑师盖房子就像程序员写程序一样,那么,第一只到来的啄木鸟就能毁掉我们的文明)~ Gerald Weinberg
对,你没看错,本文就是教你怎么写出让同事无法维护的代码。
一、程序命名
二、伪装欺诈
for(j=0; j<array_len; j+ =8){
total += array[j+0 ];
total += array[j+1 ];
total += array[j+2 ]; /* Main body of
total += array[j+3]; * loop is unrolled
total += array[j+4]; * for greater speed.
total += array[j+5]; */
total += array[j+6 ];
total += array[j+7 ];
}
三、文档和注释
四、程序设计
五、测试
六、其他
总之,我们的口号是—— Write Everywhere, Read Nowhere