编程精粹:编写高质量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语言代码
JavaScript高级程序设计(第3版)
[美]Nicholas C.Zakas 著;李松峰、曹力 译
编程精粹:编写高质量C语言代码
Python编程:从入门到实践
[美]埃里克·马瑟斯(Eric Matthes) 著;袁国忠 译
编程精粹:编写高质量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语言代码
Objective-C基础教程 第2版
[美]Scott、[美]Waqar、[美]Mark Dalrymple 著;周庆成 译
编程精粹:编写高质量C语言代码
图解HTTP
[日]上野·宣 著;于均良 译
编程精粹:编写高质量C语言代码
算法图解
袁国忠 译
相关图书 / 更多
编程精粹:编写高质量C语言代码
编程女孩
刘钰卓;[美]Reshma Saujani(拉什玛·萨贾尼
编程精粹:编写高质量C语言代码
编程卓越之道(卷2):运用底层语言思想编写高级语言代码(第2版)
[美]Randall Hyde(兰德尔·海德)
编程精粹:编写高质量C语言代码
编程小百科 为孩子介绍了计算机及编程的发展史,以及基本的编程原理,让孩子从根本上了解编程 拼音标注、有声伴读
介于童书 凤凰含章 出品
编程精粹:编写高质量C语言代码
编程王国:给孩子的编程启蒙绘本(全9册)
卢高林
编程精粹:编写高质量C语言代码
编程王国:给孩子的编程启蒙绘本3——用流程图规划生活
卢高林;王落
编程精粹:编写高质量C语言代码
编程宇宙:量子计算机科学家解读宇宙
赛斯·劳埃德 著;张文卓 译
编程精粹:编写高质量C语言代码
编程基础——C语言学习指导与实训
赵淑娟
编程精粹:编写高质量C语言代码
编程启蒙:从Python走进编程世界
李晋 著;清泉静读 出品
编程精粹:编写高质量C语言代码
编程卓越之道(卷1):深入理解计算机(第2版)
[美]Randall Hyde(兰德尔海德)
编程精粹:编写高质量C语言代码
编程逻辑及C语言实现
周春容;肖祥林;史宏宇
编程精粹:编写高质量C语言代码
编程基础——Python语言
常祖国
编程精粹:编写高质量C语言代码
编程江湖——Python篇(青少年版)
王爱胜
您可能感兴趣 / 更多
编程精粹:编写高质量C语言代码
无辜者的谎言(相信我!看到结局你一定会头皮发麻;全美读者推荐的悬疑神作,GOODREADS高分作品)
[美]A.R.托雷 著;梁颂宇 译;星文文化 出品
编程精粹:编写高质量C语言代码
孩子,把你的手给我1:怎么说孩子才爱听,怎么教孩子才肯学?帮助每一位3-12岁孩子的父母结束与孩子的所有冲突!
[美]海姆·G.吉诺特
编程精粹:编写高质量C语言代码
哲学、历史与僭政——重审施特劳斯与科耶夫之争
[美]弗罗斯特(Bryan-Paul Frost) 编;[美]伯恩斯(Timothy W. Burns)
编程精粹:编写高质量C语言代码
怎样做成大事
[美]丹·加德纳(Dan Gardner) 著;贾拥民 译;湛庐文化 出品;[丹麦]傅以斌(Bent Flyvbjerg)
编程精粹:编写高质量C语言代码
1200年希腊罗马神话
[美]伊迪丝·汉密尔顿
编程精粹:编写高质量C语言代码
爱情心理学(新编本)
[美]罗伯特·J. 斯腾伯格 (美)凯琳·斯腾伯格 倪爱萍 译
编程精粹:编写高质量C语言代码
黄金圈法则
[美]西蒙·斯涅克 著;磨铁文化 出品
编程精粹:编写高质量C语言代码
最后一章
[美]厄尼·派尔
编程精粹:编写高质量C语言代码
汤姆·索亚历险记 彩图注音版 一二三四年级5-6-7-8-9岁小学生课外阅读经典 儿童文学无障碍有声伴读世界名著童话故事
[美]马克 吐温
编程精粹:编写高质量C语言代码
富兰克林自传 名家全译本 改变无数人命运的励志传奇 埃隆马斯克反复推荐 赠富兰克林签名照及精美插图
[美]本杰明·富兰克林 著;李自修 译
编程精粹:编写高质量C语言代码
汤姆素亚历险记:中小学生课外阅读快乐读书吧 儿童文学无障碍有声伴读世界名著童话故事
[美]马克·吐温
编程精粹:编写高质量C语言代码
国际大奖图画书系列 共11册(小老鼠的恐惧的大书,大灰狼,红豆与菲比,别烦我,下雪了 ,穿靴子的猫 ,先有蛋,绿 ,特别快递,如果你想看鲸鱼 ,一个部落的孩子 ) 麦克米伦世纪
[美]莱恩·史密斯 (英)埃米莉·格雷维特 (美)劳拉·瓦卡罗·等/文 (英)埃米莉·格雷维特 等/图 彭懿 杨玲玲 阿甲 孙慧阳 白薇 译