
《编程精粹编写高质量C语言代码来自》是由(美国)(StephenA.M360百科aguire)马圭尔编写的一本书籍。该书器府集语病固后活爱揭示了微软公司应对质量挑战、开发出世界级代码的技术内幕,作者在自己不断探索、实践和思考的基础上,系统总结了多年附能且来指导微软各团队的经验,孙史官牛少号技处往将其凝聚为许多切实可早供困华城督行的编程实践指斗放于导,可谓字字珠玑。
- 书名 编程精粹(编写高质量C语言代码)
- 作者 (美国)(StephenA.Maguire)马圭尔
- ISBN 9787115193162
- 类别 信息技术
- 定价 45
编辑推荐
软来自件日趋复杂,编码错误随之360百科而来。要在测试前发现程百轻序的错误,开发出无错误的编径黑工雨愿控白可程序,关键是弄清楚错误为何乐除调产生,又是如何产生。项氢度岩兴成《编程精粹编写高质量C入顶企何语言代码》给出了多条编程方面的指导,这些指导看似简单,却是作者多年思考及实践的结果,是对其编程经翻威刑得给打航千答略树验的总结。书中解决问题的思考过程对于程序开发人员尤显珍贵。
《编程精粹编写高质量C语言代码》适于各层次程序开发人员阅读移固切久态六鸡宗章。
编写高质量的、没有bug的程序,是每位程序员所追求的目标。但随着软件规模越来越大,功能日趋复杂,这一目标变得越来越困难。
《编程精粹编写高质量C语言代码》揭示了微软公司应对质量挑战、开发出世界级代码的技术内幕,作者在自己不断探索、实践和思考的基础上,系统总结了多年来指导微软各团队的经验,将其走土袁资时们翻凝聚为许多切实可行的编程实践指导,可谓字字珠玑。正因如此,《编程精粹编写高质量C语言代码》被公认为与《代码大全》齐名的编程技术名著,曾于1993年荣获有软件开发奥斯卡奖之部送天强销组称的Jolt生产效率里得大奖。书中内容主要针对C语言,但其中的思想对目前的各主流语言编程也完全适用。
StephenA.Maguire,世界著名的技术专家和技术作家。曾在微软公司供职多年,领导开发了Mac版的Excel和众多重要的跨平台项目,并多次扮演救火队员的角色,成功拯救那些陷入困境的团队。现为Web开发公司StormDevelopment的高级副总裁。他的另一部名著DebuggingtheDevelopmentProcess继《编程精粹编写高质量C语言代码》之后第宣间理肥风远运短光二年再次摘得Jolt生产效率大奖,成为空前绝后的传奇。
与《代码大全》齐名的经典著作
提示微软成功的技术奥秘
C语言高手的秘籍
目录
许1AHYPOTHETICALCOMPILER.
Ifyourcompilercoulddetecteverybuginyourprogram-毫粒握或队社纸领间剂-nomatterthetype--andissueanerrormessage,ri府胶信述言脚初画似年ddingyourcodeofbugswouldbesi丝圆每差铁钱载统怎希mple.Sucho保货述规游且mniscientcom季战放广名地态哪组级pilersdon'texist,b六外utbyenablingoptionalcompilerwarnings,usingsyntaxandportabilitycheckers,andusingautomatedunittests,youcanincreasethenumberofbugsthataredetectedforyouautomatically.
2ASSERTYOURSELF
Agooddevelopmentstrategyistomaintaintwoversionsofyourprogram:onethatyoushipandonethatyouusetodebugthecode.Byusingdebuggingassertionstatements,youcandetectbugscausedbybadfunctionarguments,accidentaluseofundefinedbehavior,mistakenassumptionsmadebyotherprogrammers,andimpossibleconditionsthatneverthelesssomehowshowup.Debug-onlybackupalgorithmshelpverifyfunctionresultsandthealgorithmsusedinfunctions.
3FORTIFYYOURSUBSYSTEMS
Assertionswaitquietlyuntilbugsshowup.Evenmorepowerfularesubsystemintegritychecksthatactivelyvalidatesubsystemsandalertyoutobugsbeforethebugsaffecttheprogram.TheintegritychecksforthestandardCmemorymanagercandetectdanglingpointers,lostmemoryblocks,andillegaluseofmemorythathasnotbeeninitializedorthathasalreadybeenreleased.Integritycheckscanalsobeusedtoeliminaterarebehavior,whichisresponsibleforuntestedscenarios,andtoforcesubsystembugstobereproduciblesothattheycanbetrackeddownandfixed.
4STEPTHROUGHYOURCODE
Thebestwaytofindbugsistostepthroughallnewcodeinadebugger.Bysteppingthrougheachinstructionwithyourfocusonthedataflow,youcanquicklydetectproblemsinyourexpressionsandalgorithms.Keepingthefocusonthedata,nottheinstructions,givesyouasecond,verydifferent,viewofthecode.Steppingthroughcodetakestime,butnotnearlyasmuchasmostprogrammerswouldexpectitto.
5CANDY-MACHINEINTERFACES
It'snotenoughthatyourfunctionsbebug-free;functionsmustbeeasytousewithoutintroducingunexpectedbugs.Ifbugratesaretobereduced,eachfunctionneedstohaveonewell-definedpurpose,tohaveexplicitsingle-purposeinputsandoutputs,tobereadableatthepointwhereitiscalled,andideallytoneverreturnanerrorcondition.Functionswiththeseattributesareeasytovalidateusingassertionsanddebugcode,andtheyminimizetheamountoferrorhandlingcodethatmustbewritten.
6RISKYBUSINESS
Giventhenumerousimplementationpossibilitiesforagivenfunction,itshouldcomeasnosurprisethatsomeimplementationswillbemoreerrorpronethanothers.Thekeytowritingrobustfunctionsistoexchangeriskyalgorithmsandlanguageidiomsforalternativesthathaveproventobecomparablyefficientyetmuchsafer.Atoneextremethiscanmeanusingunambiguousdatatypes;attheotheritcanmeantossingoutanentiredesignsimplybecauseitwouldbedifficult,orimpossible,totest.
7TREACHERIESOFTHETRADE
Someprogrammingpracticesaresoriskytheyshouldneverbeused.Mostsuchpracticesareobviouslyrisky,butsomeseemquitesafe,evendesirable,becausetheyfillaneedwithoutapparenthazard.Thesetreacherouscodingpracticesarethewolvesinsheep'sclothing.Whyshouldn'tyoureferencememoryyou'vejustreleased?Whyisitriskytopassdatainglobalorstaticstorage?Whyshouldyouavoidparasiticfunctions?Whyitisunwisetorelyoneverynit-pickydetailoutlinedintheANSIstandard?
8THERESTISATTITUDE
Aprogrammercanfolloweveryguidclineinthisbook,butwithouttheproperattitudeandasetofgoodprogramminghabits,writingbug-freecodewillbemuchharderthanitneedstobe.Ifaprogrammerbelievesthatabugcansimply"goaway,"orthatfixingbugs"later"won'tbeharmfultotheproduct,bugswillpersist,ffaprogrammerregularly"cleansup"code,allowsunnecessaryflexibilityinfunctions,welcomesevery"free"featurethatpopsoutofadesign,orsimply"tries"haphazardsolutionstoproblemshopingtohituponsomethingthatworks,writingbug-freecodewillbeanuphillbattle.Havingagoodsetofhabitsandattitudesispossiblythemostimportantrequirementforconsistentlywritingbug-freecode.
EPILOGUEWHEREDOYOUGOFROMHERE?
APPENDIXACODINGCHECKLISTS
APPENDIXBMEMORYLOGGINGROUTINES
APPENDIXCANSWERS
REFERENCES
INDEX
……
转载请注明出处安可林文章网 » 编程精粹(编写高质量C语言代码)