paip.提升效率僵尸代码的迷思

paip.提升效率--僵尸代码的迷思

僵尸代码是指你的代码库里被注释掉的那部分代码, 很少去使用它,就像僵尸一样,

看雷kill-the-zombies-in-your-code

================如下是保存僵尸代码的原因..和优点

==a.永远不要信任版本控制系统

svn也许常常crash..或者需要更改地址..或者没网络..网络并不是始终连接的..实际上,大部分时间网络是不好的..
 ((原文:缺乏对版本控制系统作用的信任。有版本控制系统在,删除的代码永远不会真正的死掉。它们被埋到棺材里但却活着。所以,注释代码的方法没有多大实际效用。))
 ==b.今天代码不会真正地死去,,,也许俄们要赞马就要恢复它..
 ==c.使用给注释...many "zombie code"" is not zombie code. It’s inline documentation
 ==d.代码历史..
 ==e。code with doc  ..no code frag..
 
 作者 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com
来源: http://blog.csdn.net/attilax


===========disadvantage僵尸代码的缺点
a.关键词搜索--它们就存在我们的代码库中。程序员在维护和重构代码时会和它们遭遇,通常是滚动屏幕时和它们擦肩而过,或是在进行关键词搜索时和它们撞个满怀。但这些代码也确实是死的,
b.增加信噪比,这能够增进理解和快速阅读,并且可以帮助我们免于因误解而写出充满bug的代码。僵尸代码刚好起反作用。它阻碍了代码阅读和维护,因为它减少了屏幕上有意义的内容比例。这是视觉噪音,因为你不能确定自己是否
c.歧义妨碍了调试
d.关键字搜索优化


=============结论:
僵尸代码的好处儿远远大于祸患..所以, 大部分情形哈,还是保存为好...

You make some good points,  in Keyword Search, zombie code will be noise ,is  a disadvance..
in most time ,we should use the ZombieCode..   follow is  same reason to leave  zombie code  ..
==1.network yet not always can connect..or it's more slowly than we need...
if we use svn/git in remote server,,the network is big problem..many place is has no network yet...
and the speed is slowly yet..in the year 2000,many peaple think Net OS will instead of MS Windows OS..but 14 years past, now is year 2014,but where is the NOS??? the NetOS yet can't to use... maybe the netword speed never to fast as  we need...
==2.hardDisk speed never fast as we need ...rebuilt the VCS too trouble..
if we install Version Control System in we local pc ..it maybe slow my pc .and the backup VCS file is bigger than we think..
if we often chang PC or change  harddisk . the restore Backup VCS file is diffuct than think..and rebuilt the VCS too trouble..
==3.Keyword Search:    in this condition ,zombie code is noise,,,but we has many tools to auto clear the "zombieCode" ,then can Keyword Search will be a clearly good result...       but ,we have not a Tool to auto complete the  "zombieCode"  into code file..
==4. sumup::: so, zombieCode is simple,quick,little..  in most time( 80%)  ,we should use the ZombieCode..  only same time (20%),can clear the ZombCode..



原文地址http://www.bitnative.com/2012/10/22/kill-the-zombies-in-your-code/



原文地址:https://www.cnblogs.com/attilax/p/15199264.html