C语言接口与实现

出版时间:2010 年8月  出版社:人民邮电出版社  作者:(美)David R. Hanson  页数:518  
Tag标签:无  

前言

如今的程序员忙于应付大量关于.API(Application Programming Interface)的信息。但是,大多数程序员都会在其所写的几乎每一个应用程序中使用API并实现API的库,只有少数程序员会创建或发布新的能广泛应用的API。事实上,程序员似乎更喜欢使用自己搞的东西,而不愿意查找能满足他们要求的程序库,这或许是因为写特定应用程序的代码要比设计可广泛使用的API容易。不好意思,我也未能免俗:lcc(Chris Fraser和我为ANSI/ISOC编写的编译器)就是从头开始编写的API。(在A Retargetable C Compiler;Design and Implem-entation一书中有关于lcc的介绍。)编译器是这样一类应用程序:可以使用标准接口,并且能够创建在其他地方也可以使用的接口。这类程序还有内存管理,字符串和符号表以及链表操作等。但是lcc仅使用了很少的标准C库函数的例程,并且它的代码几乎都无法直接应用到其他应用程序中。本书提倡的是一种基于接口及其实现的设计方法,并且通过对24个接口及其实现的描述详细演示了该方法。这些接口涉及很多计算机领域的知识,包括数据结构,算法,字符串处理和并发程序。这些实现并不是简单的玩具,而是为在产品级代码中使用而设计的。实现的代码是可免费提供的。

内容概要

  《C语言接口与实现:创建可重用软件的技术(英文版)》概念清晰、实例详尽,是一本有关设计、实现和有效使用C语言库函数,掌握创建可重用C语言软件模块技术的参考指南。书中提供了大量实例,重在阐述如何用一种与语言无关的方法将接口设计实现独立出来,从而用一种基于接口的设计途径创建可重用的API。  《C语言接口与实现:创建可重用软件的技术(英文版)》是所有C语言程序员不可多得的好书,也是所有希望掌握可重用软件模块技术的人员的理想参考书,适合各层次的面向对象软件开发人员、系统分析员阅读。

作者简介

作者:(美国)汉森(David R.Hanson)汉森(David R.Hanson),普林斯顿大学计算机科学系教授,有着二十多年编程语言研究经验.他曾经同贝尔实验室合作开展研究工作,是适用于UNIX系统上的高质量C编译器Icc的开发者之一。

书籍目录

1 Introduction 11.1 Literate Programs 21.2 Programming Style 81.3 Efficiency 11Further Reading 12Exercises 132 Interfaces and Implementations 152.1 Interfaces 152.2 Implementations 182.3 Abstract Data Types 212.4 Client Responsibilities 242.5 Efficiency 30Further Reading 30Exercises 313 Atoms 333.1 Interface 333.2 Implementation 34Further Reading 424 Exceptions and Assertions 454.1 Interface 474.2 Implementation 534.3 Assertions 59Further Reading 63Exercises 645 Memory Management 675.1 Interface 695.2 Production Implementation 735.3 Checking Implementation 76Further Reading 85Exercises 866 More Memory Management 896.1 Interface 906.2 Implementation 92Further Reading 98Exercises 1007 Lists 1037.1 Interface 1037.2 Implementation 108Further Reading 113Exercises 1148 Tables 1158.1 Interface 1158.2 Example: Word Frequencies 1188.3 Implementation 125Further Reading 132Exercises 1339 Sets 1379.1 Interface 1389.2 Example: Cross-Reference Listings 1409.3 Implementation 1489.3.1 Member Operations 1509.3.2 Set Operations 154Further Reading 158Exercises 15810 Dynamic Arrays 16110.1 Interfaces 16210.2 Implementation 165Further Reading 169Exercises 16911 Sequences 17111.1 Interface 17111.2 Implementation 174Further Reading 180Exercises 18012 Rings 18312.1 Interface 18312.2 Implementation 187Further Reading 196Exercises 19713 Bit Vectors 19913.1 Interface 19913.2 Implementation 20213.2.1 Member Operations 20413.2.2 Comparisons 20913.2.3 Set Operations 211Further Reading 213Exercises 21314 Formatting 21514.1 Interface 21614.1.1 Formatting Functions 21614.1.2 Conversion Functions 21914.2 Implementation 22414.2.1 Formatting Functions 22514.2.2 Conversion Functions 232Further Reading 238Exercises 23915 Low-LevelStrings 24115.1 Interface 24315.2 Example: Printing Identifiers 24915.3 Implementation 25115.3.1 String Operations 25215.3.2 Analyzing Strings 25815.3.3 Conversion Functions 263Further Reading 264Exercises 26516 High-LevelStrings 26916.1 Interface 26916.2 Implementation 27616.2.1 String Operations 28116.2.2 Memory Management 28516.2.3 Analyzing Strings 28816.2.4 Conversion Functions 293Further Reading 293Exercises 29417 Extended-Precision Arithmetic 29717.1 Interface 29717.2 Implementation 30317.2.1 Addition and Subtraction 30517.2.2 Multiplication 30717.2.3 Division and Comparison 30917.2.4 Shifting 31517.2.5 String Conversions 319Further Reading 321Exercises 32218 Arbitrary-Precision Arithmetic 32318.1 Interface 32318.2 Example: A Calculator 32718.3 Implementation 33418.3.1 Negation and Multiplication 33718.3.2 Addition and Subtraction 33818.3.3 Division 34218.3.4 Exponentiation 34318.3.5 Comparisons 34618.3.6 Convenience Functions 34718.3.7 Shifting 34918.3.8 String and Integer Conversions 350Further Reading 353Exercises 35419 Multiple-Precision Arithmetic 35719.1 Interface 35819.2 Example: Another Calculator 36519.3 Implementation 37319.3.1 Conversions 37719.3.2 Unsigned Arithmetic 38019.3.3 Signed Arithmetic 38319.3.4 Convenience Functions 38819.3.5 Comparisons and Logical Operations 39519.3.6 String Conversions 399Further Reading 402Exercises 40220 Threads 40520.1 Interfaces 40820.1.1 Threads 40920.1.2 General Semaphores 41320.1.3 Synchronous Communication Channels 41720.2 Examples 41820.2.1 Sorting Concurrently 41820.2.2 Critical Regions 42320.2.3 Generating Primes 42620.3 Implementations 43120.3.1 Synchronous Communication Channels 43120.3.2 Threads 43420.3.3 Thread Creation and Context-Switching 44620.3.4 Preemption 45420.3.5 General Semaphores 45720.3.6 Context-Switching on the MIPS and ALPHA 459Further Reading 463Exercises 465Interface Summary 469Bibliography 497Index 505

章节摘录

插图:A client is a piece of code that uses a module. Clients import inter-faces; implementations export them. Clients need to see only the inter-face. Indeed, they may have only the object code for an implementation.Clients share interfaces and implementations, thus avoiding unnecessarycode duplication. This methodology also helps avoid bugs —— interfacesand implementations are written and debugged once, but used often.An interface specifies only those identifiers that clients may use, hidingirrelevant representation details and algorithms as much as possible.This helps clients avoid dependencies on the specifics of particularimplementations. This kind of dependency between a client and animplementation —— coupling —— causes bugs when an implementation.

媒体关注与评论

“至今好像还没人写过关于如何设计、实现和有效使用库函数的指南,Hanson的力作填补了这一空白。这是一本可与SoftwareTools比肩的作品,值得所有的C语言程序员珍藏。”  ——W.Richard Stevens已故知名UNIX和网络专家“我向每位C语言程序员推荐这本书。你们早就该重视书中所描述的各种技术了。”  ——NormanRamsey贝尔实验室研究员“从C语言新手变成高手的必读之作;”  ——亚马逊读者评论

编辑推荐

《C语言接口与实现:创建可重用软件的技术(英文版)》特色:接口描述简单明了,程序员可将此书用作相关接口的参考手册深入剖析如何将数据结构及其相关算法打包成可重用的模块分析了全部24个,API和8个示例应用的源代码揭秘了许多鲜有文档的C语言编程技巧可重用的软件权块是构建大规模可靠应用程序的基石,创建可重用的软件模块是每个程序员和项目经理必须掌握的技能C语言对创建可重用的AP0提供的语言和功能支持非常少,虽然C程序员写应用时都会用到API和库,但却很少有人去创建和发布新的能广泛应用的API《C语言接口与实现:创建可重用软件的技术(英文版)》介绍用一种基于接口的设计方法创建可重用的API,这一方法将接口与实现分离开来,且与语言无关书中详细描述了24个接口及其实现,便于读者深入了解此方法这些接口涉及很多计算机领域的知识,包括数据结构、算法、字符串处理和并发程序《C语言接口与实现:创建可重用软件的技术(英文版)》是C语言领域的的经典名著,出版十余年仍畅销不衰,是几代程序员倍加推崇的力作。

图书封面

图书标签Tags

评论、评分、阅读与下载


    C语言接口与实现 PDF格式下载


用户评论 (总计10条)

 
 

  •   内容不必多言,印刷纸张也好。卖家包装很结实。
  •   但是怎么我的书后面破损了。
  •   似乎是买了本旧书啊,封面已经磨损了。
  •     如题,哪位朋友对这本书的课后习题敢兴趣,可以在这里一起讨论讨论。
      我在看这本书的时候,对每章课后习题都不是很理解,不知道该怎么解决,还希望与各位一起讨论。
      
      
      豆娘说我评论太短了~
      
      
      
      还是有点短~
  •     
      我说的“好”,指的是通顺/明白/准确,并不是说有什么文采之类的。
      
      我粗略读过这本书,感觉这书也算翻译得不错了,准确性很好。
      
      前一段看到dang-dang和amazo-n上都有人在恶评这本书,虽然不多,却都很恶毒。
      
      就目前情况来说,翻译得好的书不算多,翻译得不好的书一大堆,对着烂书骂两句也没什么,挑挑书中的翻译错误/笔误也没什么,对着一本翻译不错的书,胡乱骂街,算怎么回事!
      
      再者说了,2003年机械的版本也早就绝版了,没什么利益冲突吧?!
      
      唉,总有喜欢吃屎的疯狗,总有脑有贵恙的弱智,劣币总是淘汰良币,真TMD!
  •     相对于较抽象的主题-“接口”,内容基本上过于丰富了(要建小"类库":))。仅仅需要了解“接口”的话,随便看看开始几章即可,执着于算法的可以从reference去展开...
      
      书中源码的编排方式到时值得商榷的,个人比较不习惯这种先给占位符再随后展开的代码提供方式,未必比直接列出更清晰,特别是对于书中的代码量都不甚大这种情况。
  •   刚看到内存管理,课后题完全不知所云,真是觉得自己菜的无以复加
  •   我也是照着这本书抄了抄代码,感觉难度挺高的,不过估计过两遍以后对C的理解会比之前只局限于语法要清晰的多了。
  •   嗯,也只能咬牙上了
  •   作者/出版社的网站/页面去看看吧
 

250万本中文图书简介、评论、评分,PDF格式免费下载。 第一图书网 手机版

京ICP备13047387号-7