设为首页 加入收藏

TOP

C++编程风格 前言
2013-10-07 00:28:46 来源: 作者: 【 】 浏览:77
Tags:编程 风格 前言

Preface

As commercial developers of software components, we always strive to have good, consistent style throughout our code. Since source code is usually included in our final products, our users often study our code to learn not just how the components work, but also how to write good software.

This fact ultimately led to the creation of a style guide for JavaTM programming, entitled The Elements of Java Style.① The positive reception to that book, coupled with recurring questions about C++(www.cppentry.com) style issues, resulted in this edition for C++(www.cppentry.com).

If you’ve read The Elements of Java Style (or even if you haven’t), much of the advice in this book will probably be familiar. This is deliberate, as many of the programming principles described are timeless and valid across programming languages. However, the content has been reworked and expanded here to address the unique characteristics of the C++(www.cppentry.com) language.

Audience

We wrote this book for anyone writing C++(www.cppentry.com) code, but especially for programmers who are writing C++(www.cppentry.com) as part of a team. For a team to be effective, everyone must be able to read and understand everyone else’s code. Having consistent style conventions is a good first step!

This book is not intended to teach you C++(www.cppentry.com), but rather it focuses on how C++(www.cppentry.com) code can be written in order to maximize its effectiveness. We therefore assume you are already familiar with C++(www.cppentry.com) and object-oriented programming. There are a number of good books about C++(www.cppentry.com) basics; in particular, we recommend The C++(www.cppentry.com) Programming Language (3rd edition)② and The Design and Evolution of C++(www.cppentry.com), both by Bjarne Stroustrup, the designer of the C++(www.cppentry.com) language.

①Al Vermeulen, Jim Shur, EldonMetz, Scott Ambler, Greg Bumgardner, Patrick Thompson and Trevor Misfeldt. The Elements of Java Style. (Cambridge, UK: Cambridge University Press, 2000).

②Bjarne Stroustrup. The C++(www.cppentry.com) Programming Language, Third Edition. (Reading, Massachusetts: Addison-Wesley, 1997).

前言

作为商业软件组件的开发人员,我们总是努力让自己的代码始终遵循良好、一致的风格。因为源代码也是最终产品的组成部分,所以我们的用户常常会研读代码,以了解组件如何工作,同时学习如何编写好的软件。

这最终导致了Java编程(www.cppentry.com)风格指南The Elements of Java Style 一书的诞生。该书的成功,加上C++(www.cppentry.com)领域存在的类似需求,促成了本书的面世。

不管你是否读过《Java编码风格》,我相信本书中的多数建议你可能都很熟悉。其实这些规范基本都是不受时间限制、跨语言且久经考验的。当然,这些内容都已经根据C++(www.cppentry.com)语言自身的特点做了修正和扩充。

读者对象

本书适合所有编写C++(www.cppentry.com)代码的人,尤其是那些团队中的C++(www.cppentry.com)程序员。一个团队要想有成效,每个人都必须能够阅读并理解其他人的代码。拥有一致的风格约定将是个良好的开始!

本书无意于教你C++(www.cppentry.com),而是专注于应该如何编写最有效的C++(www.cppentry.com)代码。因此,我们假设你已经熟悉C++(www.cppentry.com)和面向对象编程(www.cppentry.com)。关于C++(www.cppentry.com)基础知识有很多优秀的图书,特别是The C++(www.cppentry.com) Programming Language(第3版)  和The Design and Evolution of C++(www.cppentry.com)①,这两本书的作者都是C++(www.cppentry.com)语言的设计者Bjarne Stroustrup。

①Bjarne Stroustrup. The Design and Evolution of C++(www.cppentry.com). (Reading,Massachusetts: Addison- Wesley, 1994).

【责任编辑:董书 TEL:(010)68476606】

回书目      下一节

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇4.9.7 注释的抽取 下一篇C++编程风格 目录

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: