词条 | 编程精粹(编写高质量C语言代码) |
释义 | 《编程精粹编写高质量C语言代码》适于各层次程序开发人员阅读。该书揭示了微软公司应对质量挑战、开发出世界级代码的技术内幕,作者在自己不断探索、实践和思考的基础上,系统总结了多年来指导微软各团队的经验,将其凝聚为许多切实可行的编程实践指导,可谓字字珠玑。正因如此,《编程精粹编写高质量C语言代码》被公认为与《代码大全》齐名的编程技术名著,曾于1993年荣获有软件开发奥斯卡奖之称的Jolt生产效率大奖。书中内容主要针对C语言,但其中的思想对目前的各主流语言编程也完全适用。 书名:编程精粹(编写高质量C语言代码) 作者:(美国)(StephenA.Maguire)马圭尔 ISBN:9787115193162 类别:信息技术 定价:45 出版社:人民邮电出版社 出版时间:2009 装帧:平装 开本:16 版权书 名: 编程精粹(编写高质量C语言代码) 作 者:(美国)(StephenA.Maguire)马圭尔 出版社: 人民邮电出版社 出版时间: 2009 ISBN: 9787115193162 开本: 16 定价: 45.00 元 内容软件日趋复杂,编码错误随之而来。要在测试前发现程序的错误,开发出无错误的程序,关键是弄清楚错误为何产生,又是如何产生。《编程精粹编写高质量C语言代码》给出了多条编程方面的指导,这些指导看似简单,却是作者多年思考及实践的结果,是对其编程经验的总结。书中解决问题的思考过程对于程序开发人员尤显珍贵。 《编程精粹编写高质量C语言代码》适于各层次程序开发人员阅读。 编辑推荐 编写高质量的、没有bug的程序,是每位程序员所追求的目标。但随着软件规模越来越大,功能日趋复杂,这一目标变得越来越困难。 《编程精粹编写高质量C语言代码》揭示了微软公司应对质量挑战、开发出世界级代码的技术内幕,作者在自己不断探索、实践和思考的基础上,系统总结了多年来指导微软各团队的经验,将其凝聚为许多切实可行的编程实践指导,可谓字字珠玑。正因如此,《编程精粹编写高质量C语言代码》被公认为与《代码大全》齐名的编程技术名著,曾于1993年荣获有软件开发奥斯卡奖之称的Jolt生产效率大奖。书中内容主要针对C语言,但其中的思想对目前的各主流语言编程也完全适用。 StephenA.Maguire,世界著名的技术专家和技术作家。曾在微软公司供职多年,领导开发了Mac版的Excel和众多重要的跨平台项目,并多次扮演救火队员的角色,成功拯救那些陷入困境的团队。现为Web开发公司StormDevelopment的高级副总裁。他的另一部名著DebuggingtheDevelopmentProcess继《编程精粹编写高质量C语言代码》之后第二年再次摘得Jolt生产效率大奖,成为空前绝后的传奇。 与《代码大全》齐名的经典著作 提示微软成功的技术奥秘 C语言高手的秘籍 目录1AHYPOTHETICALCOMPILER. Ifyourcompilercoulddetecteverybuginyourprogram——nomatterthetype——andissueanerrormessage,riddingyourcodeofbugswouldbesimple.Suchomniscientcompilersdon'texist,butbyenablingoptionalcompilerwarnings,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 …… |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。