编程精粹:编写高质量C语言代码

编程精粹:编写高质量C语言代码
分享
扫描下方二维码分享到微信
打开微信,点击右上角”+“,
使用”扫一扫“即可将网页分享到朋友圈。
作者: [美] (StephenA.Maguire)
2009-02
版次: 1
ISBN: 9787115193162
定价: 45.00
装帧: 平装
开本: 16开
纸张: 胶版纸
页数: 256页
字数: 341千字
正文语种: 英语
原版书名: Writing Solid Code
51人买过
  •   《编程精粹编写高质量C语言代码(英文版)》给出了多条编程方面的指导,这些指导看似简单,却是作者多年思考及实践的结果,是对其编程经验的总结。书中解决问题的思考过程对于程序开发人员尤显珍贵。
      软件日趋复杂,编码错误随之而来。要在测试前发现程序的错误,开发出无错误的程序,关键是弄清楚错误为何产生,又是如何产生。 Stephen A.Maguire,世界著名的技术专家和技术作家。曾在微软公司供职多年,领导开发了Mac版的Excel和众多重要的跨平台项目,并多次扮演救火队员的角色,成功拯救那些陷入困境的团队。现为Web开发公司Storm Development的高级副总裁。他的另一部名著Debugging the Develo 1AHYPOTHETICALCOMPILER.
    Ifyourcompilercoulddetecteverybuginyourprogram——nomatterthetype——andissueanerrormessage,riddingyourcodeofbugswouldbesimple.Suchomniscientcompilersdontexist,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
    Itsnotenoughthatyourfunctionsbebug-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.Thesetreacherouscodingpracticesarethewolvesinsheepsclothing.Whyshouldntyoureferencememoryyouvejustreleased?Whyisitriskytopassdatainglobalorstaticstorage?Whyshouldyouavoidparasiticfunctions?Whyitisunwisetorelyoneverynit-pickydetailoutlinedintheANSIstandard?

    8THERESTISATTITUDE
    Aprogrammercanfolloweveryguidclineinthisbook,butwithouttheproperattitudeandasetofgoodprogramminghabits,writingbug-freecodewillbemuchharderthanitneedstobe.Ifaprogrammerbelievesthatabugcansimply"goaway,"orthatfixingbugs"later"wontbeharmfultotheproduct,bugswillpersist,ffaprogrammerregularly"cleansup"code,allowsunnecessaryflexibilityinfunctions,welcomesevery"free"featurethatpopsoutofadesign,orsimply"tries"haphazardsolutionstoproblemshopingtohituponsomethingthatworks,writingbug-freecodewillbeanuphillbattle.Havingagoodsetofhabitsandattitudesispossiblythemostimportantrequirementforconsistentlywritingbug-freecode.
    EPILOGUEWHEREDOYOUGOFROMHERE?
    APPENDIXACODINGCHECKLISTS
    APPENDIXBMEMORYLOGGINGROUTINES
    APPENDIXCANSWERS
    REFERENCES
    INDEX
  • 内容简介:
      《编程精粹编写高质量C语言代码(英文版)》给出了多条编程方面的指导,这些指导看似简单,却是作者多年思考及实践的结果,是对其编程经验的总结。书中解决问题的思考过程对于程序开发人员尤显珍贵。
      软件日趋复杂,编码错误随之而来。要在测试前发现程序的错误,开发出无错误的程序,关键是弄清楚错误为何产生,又是如何产生。
  • 作者简介:
    Stephen A.Maguire,世界著名的技术专家和技术作家。曾在微软公司供职多年,领导开发了Mac版的Excel和众多重要的跨平台项目,并多次扮演救火队员的角色,成功拯救那些陷入困境的团队。现为Web开发公司Storm Development的高级副总裁。他的另一部名著Debugging the Develo
  • 目录:
    1AHYPOTHETICALCOMPILER.
    Ifyourcompilercoulddetecteverybuginyourprogram——nomatterthetype——andissueanerrormessage,riddingyourcodeofbugswouldbesimple.Suchomniscientcompilersdontexist,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
    Itsnotenoughthatyourfunctionsbebug-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.Thesetreacherouscodingpracticesarethewolvesinsheepsclothing.Whyshouldntyoureferencememoryyouvejustreleased?Whyisitriskytopassdatainglobalorstaticstorage?Whyshouldyouavoidparasiticfunctions?Whyitisunwisetorelyoneverynit-pickydetailoutlinedintheANSIstandard?

    8THERESTISATTITUDE
    Aprogrammercanfolloweveryguidclineinthisbook,butwithouttheproperattitudeandasetofgoodprogramminghabits,writingbug-freecodewillbemuchharderthanitneedstobe.Ifaprogrammerbelievesthatabugcansimply"goaway,"orthatfixingbugs"later"wontbeharmfultotheproduct,bugswillpersist,ffaprogrammerregularly"cleansup"code,allowsunnecessaryflexibilityinfunctions,welcomesevery"free"featurethatpopsoutofadesign,orsimply"tries"haphazardsolutionstoproblemshopingtohituponsomethingthatworks,writingbug-freecodewillbeanuphillbattle.Havingagoodsetofhabitsandattitudesispossiblythemostimportantrequirementforconsistentlywritingbug-freecode.
    EPILOGUEWHEREDOYOUGOFROMHERE?
    APPENDIXACODINGCHECKLISTS
    APPENDIXBMEMORYLOGGINGROUTINES
    APPENDIXCANSWERS
    REFERENCES
    INDEX
查看详情
系列丛书 / 更多
编程精粹:编写高质量C语言代码
机器学习实战
[美]Peter Harrington 著;李锐、李鹏、曲亚东 译
编程精粹:编写高质量C语言代码
图灵程序设计丛书:Python基础教程
[挪威]Magnus Lie Hetland 著;司维、曾军崴、谭颖华 译
编程精粹:编写高质量C语言代码
Python编程:从入门到实践
[美]埃里克·马瑟斯(Eric Matthes) 著;袁国忠 译
编程精粹:编写高质量C语言代码
JavaScript高级程序设计(第3版)
[美]Nicholas C.Zakas 著;李松峰、曹力 译
编程精粹:编写高质量C语言代码
R语言实战(第2版)
[美]卡巴科弗(Robert I. Kabacoff) 著;王小宁、刘撷芯、黄俊文 译
编程精粹:编写高质量C语言代码
算法(第4版)
[美]Robert、[美]Kevin Wayne 著;谢路云 译
编程精粹:编写高质量C语言代码
大数据:互联网大规模数据挖掘与分布式处理
[美]Anand、[美]Jeffrey David Ullman 著;王斌 译
编程精粹:编写高质量C语言代码
Spark快速大数据分析
[美]卡劳(Holden Karau)、[美]肯维尼斯科(Andy Konwinski)、[美]温德尔(Patrick Wendell)、[加拿大]扎哈里亚(Matei Zaharia) 著;王道远 译
编程精粹:编写高质量C语言代码
MySQL必知必会
[英]福塔(Ben Forta) 著;刘晓霞、钟鸣 译
编程精粹:编写高质量C语言代码
图解HTTP
[日]上野·宣 著;于均良 译
编程精粹:编写高质量C语言代码
算法图解
袁国忠 译
编程精粹:编写高质量C语言代码
Spring Boot实战
[美]克雷格·沃斯(Craig Walls) 著;丁雪丰 译
相关图书 / 更多
编程精粹:编写高质量C语言代码
编程侠:4再次开启的门
宋阿伦
编程精粹:编写高质量C语言代码
编程侠:3漏洞升级
宋阿伦
编程精粹:编写高质量C语言代码
编程改变生活——用PySide6/PyQt6创建GUI程序(基础篇·微课视频版)
邢世通
编程精粹:编写高质量C语言代码
编程侠:2英雄的诞生
宋阿伦
编程精粹:编写高质量C语言代码
编程初体验:思维启蒙
张梦晗、吴培 编著 梦堡文化 绘
编程精粹:编写高质量C语言代码
编程王国:给孩子的编程启蒙绘本(全9册)
卢高林
编程精粹:编写高质量C语言代码
编程创新应用:从创客到人工智能
马兰、高凯 编著 梦堡文化 绘
编程精粹:编写高质量C语言代码
编程侠:套装(共5册)
宋阿伦
编程精粹:编写高质量C语言代码
编程王国:给孩子的编程启蒙绘本1——出发!去1111站
卢高林, 王落
编程精粹:编写高质量C语言代码
编程趣味学:Scratch3.0
赵宇、李京 编著 梦堡文化 绘
编程精粹:编写高质量C语言代码
编程侠:5异次元旅行
宋阿伦
编程精粹:编写高质量C语言代码
编程改变生活——用PySide6/PyQt6创建GUI程序(进阶篇·微课视频版)
邢世通
您可能感兴趣 / 更多
编程精粹:编写高质量C语言代码
归属感:如何通过社群获得商业竞争优势
[美]大卫·斯平克斯(David Spinks) 著;颉腾文化 出品
编程精粹:编写高质量C语言代码
《城市的夜晚》2024百班千人暑期书目小学生1年级名师推荐全新正版现货速发
[美]朱莉·唐宁 著;冷玉斌 冷念则 译
编程精粹:编写高质量C语言代码
雪花的故事(用照片展示雪花的秘密,为你揭开冬日奇景的奥秘)
[美]马克·卡西诺[美]乔恩·尼尔森
编程精粹:编写高质量C语言代码
进阶书系-国际史的技艺
[美] 马克·特拉亨伯格
编程精粹:编写高质量C语言代码
杜甫传
[美]弗洛伦斯.艾思柯
编程精粹:编写高质量C语言代码
神奇的数字零:从数字0开始的极简数学史和人类发展史
[美]查尔斯·塞弗(Charles Seife)著 杨杨立汝 译
编程精粹:编写高质量C语言代码
爵士乐史(精装本)
[美]泰德·乔亚 著
编程精粹:编写高质量C语言代码
环境的科学 (平装版)
[美]威廉·坎宁安 后浪
编程精粹:编写高质量C语言代码
美利坚在燃烧:20世纪60年代以来的警察暴力与黑人反抗
[美]伊丽莎白·欣顿 著 胡位钧 译
编程精粹:编写高质量C语言代码
数学侦探 游乐园里的古怪笑脸
[美]丹尼尔·肯尼 艾米丽·博艾尔 著 刘玙婧、王婧 译;小博集出品
编程精粹:编写高质量C语言代码
儒教中国及其现代命运(三部曲)
[美]列文森 作者;[中]季剑青 译者
编程精粹:编写高质量C语言代码
逃家小兔成长绘本系列
[美]玛格丽特.怀兹.布朗