程序员编程圣经:处处是笑话,句句皆真相

  我收集了很多关于软件开发者的编程语录。这些语录和软件开发维护、调试、软件bug、软件设计和文档、代码质量、测试和管理等相关。下面这59条编程语录虽然令人捧腹但也揭示了真相。只有真正的软件开发人员才能理解这些编程语录的价值。下面,就让我们开始吧……

  软件开发人员和程序员语录

  1.Agoodprogrammerissomeonewhoalwayslooksbothwaysbeforecrossingaone-waystreet.(DougLinder)

  好的程序员即使在过单行道时也总是会环顾两边。

  2.Don’tworryifitdoesn’tworkright.Ifeverythingdid,you’dbeoutofajob.(Mosher’sLawofSoftwareEngineering)

  不要担心它能否正常工作。如果一切正常,那么你就会失去工作。

  3.Thetroublewithprogrammersisthatyoucannevertellwhataprogrammerisdoinguntilit’stoolate.(SeymourCray)

  程序员的烦恼是,你永远无法知道一个程序员在做什么,直到为时已晚。

  4.Mostofyouarefamiliarwiththevirtuesofaprogrammer.Therearethree,ofcourse:laziness,impatience,andhubris.(LarryWall)

  程序员的美德:懒惰,没有耐心以及老子天下第一。

  5.Alwayscodeasiftheguywhoendsupmaintainingyourcodewillbeaviolentpsychopathwhoknowswhereyoulive.(MartinGolding)

  写代码的时候总是想象维护你代码的家伙是一个知道你住在哪里的暴力精神病患者。

  6.Oneman’scrappysoftwareisanotherman’sfulltimejob.(JessicaGaston)

  一个人写的烂软件将会给另一个人带来一份全职工作。

  7.Ifbuildersbuiltbuildingsthewayprogrammerswroteprograms,thenthefirstwoodpeckerthatcamealongwounddestroycivilization.(GeraldWeinberg)

  如果建筑工人用程序员写程序的方式建造建筑物,那么来的第一只啄木鸟(找bug)就将摧毁文明。

  8.Themostlikelywayfortheworldtobedestroyed,mostexpertsagree,isbyaccident.That’swherewecomein;we’recomputerprofessionals.Wecauseaccidents.(NathanielBorenstein)

  大多数专家认为,世界被破坏的最有可能的方式是,是因为偶然。那就是我们所要进入的领域:我们是计算机专家。我们制造偶然。

  9.It’sacuriousthingaboutourindustry:notonlydowenotlearnfromourmistakes,wealsodon’tlearnfromoursuccesses.(KeithBraithwaite)

  这是我们这个行业的一件咄咄怪事:我们不仅不从错误中学习,我们也不从成功中学习。

  10.Onceanewtechnologystartsrolling,ifyou’renotpartofthesteamroller,you’repartoftheroad.(StewartBrand)

  一旦一种新技术开始滚动碾压道路,如果你不能成为压路机的一部分,那么你就只能成为道路的一部分。

  11.Ifatfirstyoudon’tsucceed,callitversion1.0(unknown)

  如果第一次你没有成功,那么称之为1.0版,继续加油。

  12.Allprogrammersareplaywrightsandallcomputersarelousyactors.(AnonymousHackActor)

  所有的程序员都剧作家,而所有计算机都是糟糕的演员。

  13.Thesooneryougetbehindinyourwork,themoretimeyouhavetocatchup.(AnonymousScheduler)

  工作拉下得越早,赶上去所需要的时间越多。

  14.WhenaprogramminglanguageiscreatedthatallowsprogrammerstoprograminsimpleEnglish,itwillbediscoveredthatprogrammerscannotspeakEnglish.(AnonymousLinguist)

  当创建一种编程语言允许程序员使用简单英语编程的时候,那么新问题又来了,你会发现程序员不说英语。

  15.Whydoweneverhavetimetodoitright,butalwayshavetimetodoitover?(Anonymous)

  为什么我们总是没有时间把事情做对,却有时间做完它?

  16.Anyfoolcanwritecodethatacomputercanunderstand.Goodprogrammerswritecodethathumanscanunderstand.

  傻瓜写计算机能理解的代码。优秀的程序员写人类能读懂的代码。

  17.Anycodeofyourownthatyouhaven’tlookedatforsixormoremonthsmightaswellhavebeenwrittenbysomeoneelse.(Eagleson’slaw)

  自己的代码六个月或更久不见,还不如别人写的代码。

  编程/软件开发语录

  1.Measuringprogrammingprogressbylinesofcodeislikemeasuringaircraftbuildingprogressbyweight.(BillGates)

  通过代码行数衡量开发进程就好比用重量来衡量飞机制造进度。

  2.Programmingislikesex.Onemistakeandyouhavetosupportitfortherestofyourlife.(MichaelSinz)

  编程就像性爱一样。一个错误就能绑住你的余生。

  3.Walkingonwateranddevelopingsoftwarefromaspecificationareeasyifbotharefrozen.(EdwardVBerard)

  在目的明确的基础上开发软件就像在结冰的水上行走一样简单。

  4.Thefirst90percentofthecodeaccountsforthefirst90percentofthedevelopmenttime…Theremaining10percentofthecodeaccountsfortheother90percentofthedevelopmenttime.(TomCargill)

  开始90%的代码占开始90%的开发时间……剩下10%的代码还是占90%的开发时间。

  5.Commentingyourcodeislikecleaningyourbathroom—youneverwanttodoit,butitreallydoescreateamorepleasantexperienceforyouandyourguests.(RyanCampbell)

  注释代码就像是清洁浴室——尽管你满心不情愿,但它确实可以为你和你的客人创造一种更舒适的体验。

  6.Programmingtodayisaracebetweensoftwareengineersstrivingtobuildbiggerandbetteridiot-proofprograms,andtheuniversetryingtoproducebiggerandbetteridiots.Sofar,theuniverseiswinning.(RickCook)

  当今的编程是软件工程师——努力建设更大多更好的傻瓜式程序,和上帝——试图产出更大多更好的傻瓜之间的竞争。到目前为止,世上帝是获胜者。

  7.Thehardestpartofdesign…iskeepingfeaturesout.(DonaldNorman)

  设计中最难的部分……是阻止功能。

  8.Inordertounderstandrecursion,onemustfirstunderstandrecursion.(Anonymous)

  要想了解递归,首先必须理解递归。

  9.Thereareonlytwokindsofprogramminglanguages:thosepeoplealwaysbitchaboutandthosenobodyuses.(BjarneStroustrup)

  只有两种编程语言:一种是天天挨骂的,另一种是没人用的。

  10.Thebestthingaboutabooleanisevenifyouarewrong,youareonlyoffbyabit.(Anonymous)

  关于布尔值最妙的一点是,就算你错了,你也只是错了这一处而已。

  11.IfJavahadtruegarbagecollection,mostprogramswoulddeletethemselvesuponexecution.(RobertSwell)

  如果Java真的有垃圾收集,那么大多数程序会执行自我删除。

  12.Intheory,thereisnodifferencebetweentheoryandpractice.But,inpractice,thereis.(JanL.A.vandeSnepscheut)

  理论上看,理论和实践之间是没有差别的。但是,在实践中,有。

  13.Ready,fire,aim:thefastapproachtosoftwaredevelopment.Ready,aim,aim,aim,aim:theslowapproachtosoftwaredevelopment.(Anonymous)

  准备,开火,瞄准:快速的软件开发方法。准备,瞄准,瞄准,瞄准,瞄准:缓慢的软件开发方法。

  14.Programmingis10%science,20%ingenuity,and70%gettingtheingenuitytoworkwiththescience.(Anonymous)

  编程就是10%的科学,20%得的独创性,再加70%和这门科学的灵巧合作。

  15.Itiseasiertomeasuresomethingthantounderstandwhatyouhavemeasured.(Anonymous)

  衡量比理解你衡量了什么容易。

  16.Benchmarksdon’tlie,butliarsdobenchmarks.(Anonymous)

  基准不会撒谎,但制定基准的人会撒谎。

  17.Bettertrainpeopleandrisktheyleave–thandonothingandrisktheystay.(Anonymous)

  就算是培训好的员工离开——也好过他们什么也不做却留下来。

  18.ThegoalofComputerScienceistobuildsomethingthatwilllastatleastuntilwe’vefinishedbuildingit.(Anonymous)

  计算机科学的目标是构建一个至少能持续到我们构建完成的东西。

  19.JavaistoJavaScriptwhatCaristoCarpet.(ChrisHeilmann)

  Java之于JavaScript就像car之于carpet(地毯)。后者看上去像是前者的衍生物,实则是完全不同的两个东西。

  20.It’snotatallimportanttogetitrightthefirsttime.It’svitallyimportanttogetitrightthelasttime.(AndrewHuntandDavidThomas)

  第一次是否正确完成一点也不重要。最后一次正确完成才至关重要。

  21.Shouldarrayindicesstartat0or1?Mycompromiseof0.5wasrejectedwithout,Ithought,properconsideration.(StanKelly-Bootle)

  数组的下标一定要从0或1开始吗?我认为,我采取的中间值0.5没有经过适当考虑就被驳回了。

  22.Programsmustbewrittenforpeopletoread,andonlyincidentallyformachinestoexecute.(Abelson/Sussman)

  程序必须写得能供人阅读,机器执行只是附带。

  23.Programmingcanbefun,socancryptography;howevertheyshouldnotbecombined.(KreitzbergandShneiderman)

  编程可以很有趣,密码学也是如此;但是两者不应该搅和在一起。

  24.Copyandpasteisadesignerror.(DavidParnas)

  复制粘贴是一个设计错误。

  25.Computersaregoodatfollowinginstructions,butnotatreadingyourmind.(DonaldKnuth)

  计算机善于遵循指令,不善于读取你的想法。

  软件调试语录

  1.Deletedcodeisdebuggedcode.(JeffSickel)

  删除的代码是经过调试的代码。

  2.Ifdebuggingistheprocessofremovingsoftwarebugs,thenprogrammingmustbetheprocessofputtingthemin.(EdsgerDijkstra)

  如果调试是消除软件bug的过程,那么编程就是产出bug的过程。

  3.Debuggingistwiceashardaswritingthecodeinthefirstplace.Therefore,ifyouwritethecodeascleverlyaspossible,youare–bydefinition–notsmartenoughtodebugit.

  调试一段程序的难度是写出这段程序的难度的两倍,因此,如果你的代码尽可能清楚的话,那么你就不用费力地调试它。

  4.It’shardenoughtofindanerrorinyourcodewhenyou’relookingforit;it’sevenharderwhenyou’veassumedyourcodeiserror-free.(SteveMcConnel)

  你的目的是找bug的时候,bug已经很难找了;更不要说当你认为自己的代码中没有错误的时候。

  软件bug语录

  1.It’snotabug–it’sanundocumentedfeature.(Anonymous)

  这不是bug——这是没有被证明的功能。

  2.Withoutrequirementsordesign,programmingistheartofaddingbugstoanemptytextfile.(LouisSrygley)

  如果没有需求和设计,那么编程就是添加bug到空的文本文件的艺术。

  3.Badcodeisn’tbad,itsjustmisunderstood.(AnonymousCodeBehaviorist)

  所谓坏的代码并不坏,它只是被误解了。

  4.Therearetwowaystowriteerror-freeprograms;onlythethirdoneworks.(AlanJ.Perlis)

  写没有错误的程序有两种方式;但第三种才有效。

  5.Bewareofbugsintheabovecode;Ihaveonlyproveditcorrect,nottriedit.(DonaldKnuth)

  小心上面代码中的bug;我只证明了它是正确的,还没有尝试过。

  软件/终端产品语录1.Beforesoftwarecanbereusableitfirsthastobeusable.(RalphJohnson)

  在软件可以被可重复使用前,它首先必须是可用的。

  2.Softwareundergoesbetatestingshortlybeforeit’sreleased.BetaisLatinfor“stilldoesn’twork”.(Anonymous)

  软件在发布前要经过beta测试。beta即拉丁语“仍然无法正常工作”的意思。

  3.Thebestperformanceimprovementisthetransitionfromthenonworkingstatetotheworkingstate.(J.Osterhout)

  最佳性能改进是指从不可工作状态向工作状态的转变。

  4.Thecheapest,fastest,andmostreliablecomponentsarethosethataren’tthere.(GordonBell)

  最便宜,最快和最可靠的组件是不存在的。

  5.IthinkMicrosoftnamed.Netsoitwouldn’tshowupinaUnixdirectorylisting.(Oktal)

  我认为微软命名.Net,它就不会在Unix目录列表显示出来。

  6.Softwareandcathedralsaremuchthesame–firstwebuildthem,thenwepray.(SamRedwine)

  软件和教堂非常相似——首先,我们建造它们,然后我们祈祷。

  7.Thesoftwareisn’tfinisheduntilthelastuserisdead.(Anonymous)

  直到最后一个用户死去,软件才算完成。

  8.MostsoftwaretodayisverymuchlikeanEgyptianpyramidwithmillionsofbrickspiledontopofeachother,withnostructuralintegrity,butjustdonebybruteforceandthousandsofslaves.(AlanKay)

  现在的大多数软件非常像埃及金字塔,在彼此之间堆建了成千上万的砖块,缺乏结构完整性,只是靠蛮力和成千上万的奴隶完成。