代码大全[第二版·英文珍藏版]
基本信息
- 原书名: CODE COMPLETE, Second Edition
- 原出版社: Microsoft Press
编辑推荐
代码大全(第二版)是著名IT畅销书作者Steve McConnell十二年前的经典著作的全新演绎,该作者是两届Software Development Magzine Jolt Award震撼大奖得主。
本书中文版自出版以来,在china-pub网站销售很快飚升到第1位,并连续数日居高不下。目前本书中文版发行已经超过30000册,仅china-pub上架首日销售就突破500大关,创技术类图书销售新史!
推荐阅读
内容简介回到顶部↑
《代码大全(第2版)》是著名it畅销书作者、ieee software杂志前主编、具有20年编程与项目管理经验的steve mcconnell十余年前的经典著作的全新演绎:第2版做了全面的更新,增加了很多与时俱进的内容,包括对新语言、新的开发过程与方法论的讨论,等等。这是一本百科全书式的软件构建手册,涵盖了软件构建活动的方方面面,尤其强调提高软件质量的种种实践方法。.
作者特别注重源代码的可读性,详细讨论了类和函数命名、变量命名、数据类型和控制结构、代码布局等编程的最基本要素,也讨论了防御式编程、表驱动法、协同构建、开发者测试、性能优化等有效开发实践,这些都服务于软件的首要技术使命:管理复杂度。为了培养程序员编写高质量代码的习惯,书中展示了大量高质量代码示例(以及用作对比的低质量代码),提高软件质量是降低开发成本的重要途径。除此之外,本书归纳总结了来自专家的经验、业界研究以及学术成果,列举了大量软件开发领域的真实案例与统计数据,提高本书的说服力。..
本书中所论述的技术不仅填补了初级与高级编程实践之间的空白,而且也为程序员们提供了一个有关软件开发技术的信息来源。本书对经验丰富的程序员、技术带头人、自学的程序员及没有太多编程经验的学生都是大有裨益的。可以说,只要您具有一定的编程基础,想成为一名优秀的程序员,阅读本书都不会让您失望。...
作者特别注重源代码的可读性,详细讨论了类和函数命名、变量命名、数据类型和控制结构、代码布局等编程的最基本要素,也讨论了防御式编程、表驱动法、协同构建、开发者测试、性能优化等有效开发实践,这些都服务于软件的首要技术使命:管理复杂度。为了培养程序员编写高质量代码的习惯,书中展示了大量高质量代码示例(以及用作对比的低质量代码),提高软件质量是降低开发成本的重要途径。除此之外,本书归纳总结了来自专家的经验、业界研究以及学术成果,列举了大量软件开发领域的真实案例与统计数据,提高本书的说服力。..
本书中所论述的技术不仅填补了初级与高级编程实践之间的空白,而且也为程序员们提供了一个有关软件开发技术的信息来源。本书对经验丰富的程序员、技术带头人、自学的程序员及没有太多编程经验的学生都是大有裨益的。可以说,只要您具有一定的编程基础,想成为一名优秀的程序员,阅读本书都不会让您失望。...
作译者回到顶部↑
本书提供作译者介绍
史蒂夫·迈克康奈尔(Steve McConnell)被公认为软件开发社区中的首要作者和发言人之一。他是Construx Software公司的首席软件工程师。他所编著的图书包括曾被《软件开发》(Software Development)杂志授予优异产品震撼大奖(Jolt Award for productexcellence)的《代码大全》(Code Complete)和《快速软件开发》(Rapid Development),以及《软件项目生存指南》(Software Preject Survival Guide)和《专业软件开发》(Professional Software Development)等等。
.. << 查看详细
.. << 查看详细
目录回到顶部↑
preface.
acknowledgments
list of checklists
list of tables
list of figures
part 1 laying the foundation
1 welcome to software construction
1.1 what is software construction?
1.2 why is software construction important?
1.3 how to read this book
2 metaphors for a richer understanding of software development
2.1 the importance of metaphors
2.2 how to use software metaphors
2.3 common software metaphors
3 measure twice, cut once: upstream prerequisites
3.1 importance of prerequisites
3.2 determine the kind of software you're working on
3.3 problem-definition prerequisite
3.4 requirements prerequisite
3.5 architecture prerequisite
acknowledgments
list of checklists
list of tables
list of figures
part 1 laying the foundation
1 welcome to software construction
1.1 what is software construction?
1.2 why is software construction important?
1.3 how to read this book
2 metaphors for a richer understanding of software development
2.1 the importance of metaphors
2.2 how to use software metaphors
2.3 common software metaphors
3 measure twice, cut once: upstream prerequisites
3.1 importance of prerequisites
3.2 determine the kind of software you're working on
3.3 problem-definition prerequisite
3.4 requirements prerequisite
3.5 architecture prerequisite
译者序回到顶部↑
这本书讲什么
《代码大全》这本书的原名叫Code Complete,那么code complete在这里是何含义呢?首先,它不代表现代集成开发环境(IDE)中的代码自动补全功能,本书也不打算向您讲解Eclipse或Visual Studio 2005中的代码自动补全功能是如何实现的。其次,code complete也不是真正的软件源代码“大全”的意思,这本书既没有列出连接各种数据库的代码、也没有列出网页中常用的各种JavaScript代码。书中的代码示例恐怕也不能直接copy&paste代码到您自己的项目中。.
那么code complete到底是什么意思?中译本为什么又要取名为“代码大全”呢?虽然从网上讨论的情况看,各位网友对书名含义的理解有出入,但是译者有充分的理由相信,code complete是“编码完成”的意思,是一个软件项目开发过程中的重要里程碑(milestone)。软件项目进行到这里,表明已经完成了所有的编码工作,即将开始系统测试。
这本书讲的正是为了到达“编码完成”这一重要里程碑所必需的软件构建技术,确切地说,就是如何编写高质量的代码。作者认为,应该首先为人编写代码,其次才是为机器(第34.3节);代码主要是供人阅读的。遍布全书的提高代码质量的实实在在的技术和诀窍,是本书最有价值的部分。事实上,我们认为第6、7、10至19章这300多页的内容是本书的精华内容,在其他书里恐怕很难找到如此详尽的对变量、语句、子程序等编程基本要素的讨论。
十多年前,本书第1版以《代码大全》为名翻译出版,在过去的10余年中,这本书影响了整整一代程序员,“代码大全”四个字已成为一个响当当的名字。鉴于此,本书第2版决定保留这个无伤大雅的“错误”,沿用“代码大全”作为书名,也借此向原书第1版各位译者、修订者们的辛勤劳动表示我们的敬意。无论如何,对code complete的理解不会影响对整本书的理解。
本书除了讲如何构建高质量的软件,还讲如何成为一名优秀的程序员(第33章“个人性格”、第4.3节“你在技术浪潮中的位置”、第34.4节“深入一门语言去编程”)。
这本书适合谁看,该怎么看
任何想写出好程序的人,或者想带领一群程序员写出好软件的人,都不应该错过这本好书。作者在前言中指明了本书的读者群(包括经验丰富的程序员、技术带头人、自学的程序员、学生等),请您参阅。
这是一本800多页的大部头,从头到尾阅读要花不少时间,谁都希望能尽快找到对自己有用的内容。译者大致针对不同的读者群提一点阅读建议,仅供参考。..
·初级程序员,请先看第18章“表驱动法”:将复杂的逻辑判断转换为查表,从而简化代码的编写与维护。另外,本章中的一个示例说明了,面向对象设计并不只要因为它是“面向对象”,就一定会好于其他的设计。
·高级程序员,请先看第4章“关键的‘构建’决策”,本章关注的焦点是程序员和技术带头人个人必须(直接或间接)负责的项目准备工作。
·项目经理,请先看第33章“个人性格”,程序设计是一项纯粹的脑力劳动,本章对挑选和培养优秀程序员提出了建议。事实证明,相对于聪明程度(智商),个人性格(情商)对于造就出程序员高手更具有决定性的意义。
·低年级学生,请先看第11章“变量名的力量”。这本书用了整整一章(30多页)的篇幅来讲解“为变量命名”这一编程中最常见的活动,这里提供的建议在别的书里是很难见到的。
·高年级学生,请先看第8章“防御式编程”,本章讲述如何面对严酷的充斥非法数据的真实世界,在遇到“绝不会发生”的事件和其他程序员犯下的错误时如何保护自己。对于那些正在从学术环境转向专业开发环境的学生来说,这是必备的一课。
·制定编码标准的人,请先看第32章“自说明代码”,本章中有一段关于注释的精彩对话,它可能会改变您在制定编码标准时对注释的要求。
·自学编程的人,请先看第7章“高质量的子程序”,本章详细讨论了子程序的命名和参数选择等问题,其中对子程序最佳长度的讨论颇有借鉴意义。
·喜欢参与网上争论的人,请先看第13.3节“全局数据”和第17.3节“goto语句”,听听学术界在这些问题上的争论也挺有意思。
当然,这整本书都非常值得一读,准确地说,值得反复阅读。书中不仅有实实在在的数据和论述,也有一些有趣的比喻,作者偶尔还开开玩笑,读起来一点也不枯燥。
另外需要说明的一点是,书中出现的诸如“(Yourdon 1986b)”表示的是参考文献,可以从第863页起的参考文献列表中查到文献的原名和出处,例如,(Yourdon 1986b)代表的是Edward Yourdon写的Nations at Risk一书。如果只出现“(2000)”字样,那么请您从上下文中推断出作者姓名。
配套网站
《代码大全》这本书的原名叫Code Complete,那么code complete在这里是何含义呢?首先,它不代表现代集成开发环境(IDE)中的代码自动补全功能,本书也不打算向您讲解Eclipse或Visual Studio 2005中的代码自动补全功能是如何实现的。其次,code complete也不是真正的软件源代码“大全”的意思,这本书既没有列出连接各种数据库的代码、也没有列出网页中常用的各种JavaScript代码。书中的代码示例恐怕也不能直接copy&paste代码到您自己的项目中。.
那么code complete到底是什么意思?中译本为什么又要取名为“代码大全”呢?虽然从网上讨论的情况看,各位网友对书名含义的理解有出入,但是译者有充分的理由相信,code complete是“编码完成”的意思,是一个软件项目开发过程中的重要里程碑(milestone)。软件项目进行到这里,表明已经完成了所有的编码工作,即将开始系统测试。
这本书讲的正是为了到达“编码完成”这一重要里程碑所必需的软件构建技术,确切地说,就是如何编写高质量的代码。作者认为,应该首先为人编写代码,其次才是为机器(第34.3节);代码主要是供人阅读的。遍布全书的提高代码质量的实实在在的技术和诀窍,是本书最有价值的部分。事实上,我们认为第6、7、10至19章这300多页的内容是本书的精华内容,在其他书里恐怕很难找到如此详尽的对变量、语句、子程序等编程基本要素的讨论。
十多年前,本书第1版以《代码大全》为名翻译出版,在过去的10余年中,这本书影响了整整一代程序员,“代码大全”四个字已成为一个响当当的名字。鉴于此,本书第2版决定保留这个无伤大雅的“错误”,沿用“代码大全”作为书名,也借此向原书第1版各位译者、修订者们的辛勤劳动表示我们的敬意。无论如何,对code complete的理解不会影响对整本书的理解。
本书除了讲如何构建高质量的软件,还讲如何成为一名优秀的程序员(第33章“个人性格”、第4.3节“你在技术浪潮中的位置”、第34.4节“深入一门语言去编程”)。
这本书适合谁看,该怎么看
任何想写出好程序的人,或者想带领一群程序员写出好软件的人,都不应该错过这本好书。作者在前言中指明了本书的读者群(包括经验丰富的程序员、技术带头人、自学的程序员、学生等),请您参阅。
这是一本800多页的大部头,从头到尾阅读要花不少时间,谁都希望能尽快找到对自己有用的内容。译者大致针对不同的读者群提一点阅读建议,仅供参考。..
·初级程序员,请先看第18章“表驱动法”:将复杂的逻辑判断转换为查表,从而简化代码的编写与维护。另外,本章中的一个示例说明了,面向对象设计并不只要因为它是“面向对象”,就一定会好于其他的设计。
·高级程序员,请先看第4章“关键的‘构建’决策”,本章关注的焦点是程序员和技术带头人个人必须(直接或间接)负责的项目准备工作。
·项目经理,请先看第33章“个人性格”,程序设计是一项纯粹的脑力劳动,本章对挑选和培养优秀程序员提出了建议。事实证明,相对于聪明程度(智商),个人性格(情商)对于造就出程序员高手更具有决定性的意义。
·低年级学生,请先看第11章“变量名的力量”。这本书用了整整一章(30多页)的篇幅来讲解“为变量命名”这一编程中最常见的活动,这里提供的建议在别的书里是很难见到的。
·高年级学生,请先看第8章“防御式编程”,本章讲述如何面对严酷的充斥非法数据的真实世界,在遇到“绝不会发生”的事件和其他程序员犯下的错误时如何保护自己。对于那些正在从学术环境转向专业开发环境的学生来说,这是必备的一课。
·制定编码标准的人,请先看第32章“自说明代码”,本章中有一段关于注释的精彩对话,它可能会改变您在制定编码标准时对注释的要求。
·自学编程的人,请先看第7章“高质量的子程序”,本章详细讨论了子程序的命名和参数选择等问题,其中对子程序最佳长度的讨论颇有借鉴意义。
·喜欢参与网上争论的人,请先看第13.3节“全局数据”和第17.3节“goto语句”,听听学术界在这些问题上的争论也挺有意思。
当然,这整本书都非常值得一读,准确地说,值得反复阅读。书中不仅有实实在在的数据和论述,也有一些有趣的比喻,作者偶尔还开开玩笑,读起来一点也不枯燥。
另外需要说明的一点是,书中出现的诸如“(Yourdon 1986b)”表示的是参考文献,可以从第863页起的参考文献列表中查到文献的原名和出处,例如,(Yourdon 1986b)代表的是Edward Yourdon写的Nations at Risk一书。如果只出现“(2000)”字样,那么请您从上下文中推断出作者姓名。
配套网站
前言回到顶部↑
The gap between the best software engineering practice and the average practice is very wide-perhaps wider than in any other engineering discipline. A tool that disseminates good practice would be important. .
-Fred Broohs
My primary concern in writing this book has been to narrow the gap between the knowledge of industry gurus and professors on the one hand and common commercial practice on the other. Many powerful programming techniques hide in journals and academic papers for years before trickling down tO the programming public.
Although leading-edge software-development practice has advanced rapidly in recent years, common practice hasn't. Many programs are still buggy, late, and over budget, and many fail to satisfy the needs of their users. Researchers in both the software industry and academic settings have discovered effective practices that eliminate most of the programming problems that have been prevalent since the 1970s. Because these practices aren't often reported outside the pages of highly specialized technical journals, however, most programming organizations aren't yet using them today. Studies have found that it typically takes 5 to 15 years or more for a research development to make its way into commercial practice (Raghavan and Chand 1989, Rogers 1995, Parnas 1999). This handbook shortcuts the process, making key discoveries available to the average programmer now.
Who Should Read This Book?
The research and programming experience collected in this handbook will help you to create higher-quality software and to do your work more quickly and with fewer problems. This book will give you insight into why you've had problems in the past and will show you how to avoid problems in the future. The programming practices described here will help you keep big projects under control and help you maintain and modify software successfully as the demands of your projects change.
Experienced Programmers
This handbook serves experienced programmers who want a comprehensive, easy-to-use guide to software development. Because this book focuses on construction, the most familiar part of the software life cycle, it makes powerful software development techniques understandable to self-taught programmers as well as to programmers with formal training.
Technical Leads
Many technical leads have used Code Complete to educate less-experienced programmers on their teams. You can also use it to fill your own knowledge gaps. If you're an experienced programmer, you might not agree with all my conclusions (and I would be surprised ifyou did), but ifyou read this book and think about each issue, only rarely will someone bring up a construction issue that you haven't previously considered.
Self-Taught Programmers
Ifyou haven't had much formal training, you're in good company. About 50,000 new developers enter the profession each year (BLS 2004, Hecker 2004), but only about 35,000 software-related degrees are awarded each year (NCES 2002). From these figures it's a short hop to the conclusion that many programmers don't receive a formal education in software development. Self-taught programmers are found in the emerging group of professionals-engineers, accountants, scientists, teachers, and small-business owners-who program as part of their jobs but who do not necessarily view themselves as programmers. Regardless of the extent of your programming education, this handbook can give you insight into effective programming practices.
Students
The counterpoint to the programmer with experience but little formal training is the fresh college graduate. The recent graduate is often rich in theoretical knowledge but poor in the practical know-how that goes into building production programs. The practical lore of good coding is often passed down slowly in the ritualistic tribal dances of software architects, project leads, analysts, and more-experienced programmers. Even more often, it's the product of the individual programmer's trials and errors. This book is an alternative to the slow workings of the traditional intellectual potlatch. It pulls together the helpful tips and effectwe development strategies previously available mainly by hunting and gathering from other people's experience. It's a hand up for the student making the transition from an academic environment to a professional one.
Where Else Can You Find This Information?
This book synthesizes construction techniques from a variety of sources. In addition to being widely scattered, much of the accumulated wisdom about construction has resided outside written sources for years (Hildebrand 1989, McConnel11997a). There is nothing mysterious about the effective, high-powered programming techniques used by expert programmers. In the day-to-day rush of grinding out the latest project, however, few experts take the time to share what they have learned. Consequently, programmers may have difficulty finding a good source of programming information.
The techniques described in this book fill the void after introductory and advanced programming texts. After you have read Introduction to Java, Advanced Java, and Advanced Advanced Java, what book do you read to learn more about programming? You could read books about the details of Intel or Motorola hardware, Microsoft Windows or Linux operating-system functions, or another programming language-you can't use a language or program in an environment without a good reference to such details. But this is one of the few books that discusses programming per se. Some of the most beneficial programming aids are practices that you can use regardless of the environment or language you're working m. Other books generally neglect such practices, which is why this book concentrates on them.
The information in this book is distilled from many sources, as shown below. The only other way to obtain the information you'll find in this handbook would be to plow through a mountain of books and a few hundred technical journals and then add a significant amount of real-world experience. If you've already done all that, you can still benefit from this book's collecting the information in one place for easy reference.
Key Benefits of This Handbook
Whatever your background, this handbook can help you write better programs in less time and with fewer headaches.
-Fred Broohs
My primary concern in writing this book has been to narrow the gap between the knowledge of industry gurus and professors on the one hand and common commercial practice on the other. Many powerful programming techniques hide in journals and academic papers for years before trickling down tO the programming public.
Although leading-edge software-development practice has advanced rapidly in recent years, common practice hasn't. Many programs are still buggy, late, and over budget, and many fail to satisfy the needs of their users. Researchers in both the software industry and academic settings have discovered effective practices that eliminate most of the programming problems that have been prevalent since the 1970s. Because these practices aren't often reported outside the pages of highly specialized technical journals, however, most programming organizations aren't yet using them today. Studies have found that it typically takes 5 to 15 years or more for a research development to make its way into commercial practice (Raghavan and Chand 1989, Rogers 1995, Parnas 1999). This handbook shortcuts the process, making key discoveries available to the average programmer now.
Who Should Read This Book?
The research and programming experience collected in this handbook will help you to create higher-quality software and to do your work more quickly and with fewer problems. This book will give you insight into why you've had problems in the past and will show you how to avoid problems in the future. The programming practices described here will help you keep big projects under control and help you maintain and modify software successfully as the demands of your projects change.
Experienced Programmers
This handbook serves experienced programmers who want a comprehensive, easy-to-use guide to software development. Because this book focuses on construction, the most familiar part of the software life cycle, it makes powerful software development techniques understandable to self-taught programmers as well as to programmers with formal training.
Technical Leads
Many technical leads have used Code Complete to educate less-experienced programmers on their teams. You can also use it to fill your own knowledge gaps. If you're an experienced programmer, you might not agree with all my conclusions (and I would be surprised ifyou did), but ifyou read this book and think about each issue, only rarely will someone bring up a construction issue that you haven't previously considered.
Self-Taught Programmers
Ifyou haven't had much formal training, you're in good company. About 50,000 new developers enter the profession each year (BLS 2004, Hecker 2004), but only about 35,000 software-related degrees are awarded each year (NCES 2002). From these figures it's a short hop to the conclusion that many programmers don't receive a formal education in software development. Self-taught programmers are found in the emerging group of professionals-engineers, accountants, scientists, teachers, and small-business owners-who program as part of their jobs but who do not necessarily view themselves as programmers. Regardless of the extent of your programming education, this handbook can give you insight into effective programming practices.
Students
The counterpoint to the programmer with experience but little formal training is the fresh college graduate. The recent graduate is often rich in theoretical knowledge but poor in the practical know-how that goes into building production programs. The practical lore of good coding is often passed down slowly in the ritualistic tribal dances of software architects, project leads, analysts, and more-experienced programmers. Even more often, it's the product of the individual programmer's trials and errors. This book is an alternative to the slow workings of the traditional intellectual potlatch. It pulls together the helpful tips and effectwe development strategies previously available mainly by hunting and gathering from other people's experience. It's a hand up for the student making the transition from an academic environment to a professional one.
Where Else Can You Find This Information?
This book synthesizes construction techniques from a variety of sources. In addition to being widely scattered, much of the accumulated wisdom about construction has resided outside written sources for years (Hildebrand 1989, McConnel11997a). There is nothing mysterious about the effective, high-powered programming techniques used by expert programmers. In the day-to-day rush of grinding out the latest project, however, few experts take the time to share what they have learned. Consequently, programmers may have difficulty finding a good source of programming information.
The techniques described in this book fill the void after introductory and advanced programming texts. After you have read Introduction to Java, Advanced Java, and Advanced Advanced Java, what book do you read to learn more about programming? You could read books about the details of Intel or Motorola hardware, Microsoft Windows or Linux operating-system functions, or another programming language-you can't use a language or program in an environment without a good reference to such details. But this is one of the few books that discusses programming per se. Some of the most beneficial programming aids are practices that you can use regardless of the environment or language you're working m. Other books generally neglect such practices, which is why this book concentrates on them.
The information in this book is distilled from many sources, as shown below. The only other way to obtain the information you'll find in this handbook would be to plow through a mountain of books and a few hundred technical journals and then add a significant amount of real-world experience. If you've already done all that, you can still benefit from this book's collecting the information in one place for easy reference.
Key Benefits of This Handbook
Whatever your background, this handbook can help you write better programs in less time and with fewer headaches.
【插图】








点击看大图







加载中...
