CG@CPPBLOG

/*=========================================*/
随笔 - 76, 文章 - 39, 评论 - 137, 引用 - 0
数据加载中……

《Unix程序设计艺术》前言

Preface

前言

 

Unix is not so much an operating system as an oral history.

--Neal Stephenson

与其说Unix是个操作系统,不如说是一部口述史。

——Neal Stephenson

 

There is a vast difference between knowledge and expertise. Knowledge lets you deduce the right thing to do; expertise makes the right thing a reflex, hardly requiring conscious thought at all. This book has a lot of knowledge in it, but it is mainly about expertise. It is going to try to teach you the things about Unix development that Unix experts know, but aren’t aware that they know. It is therefore less about technicalia and more about shared culture than most Unix books — both explicit and implicit culture, both conscious and unconscious traditions. It is not a ‘how-to’ book, it is a ‘why-to’ book.

“知”(书本知识)与“识”(专业的技术经验)有着天壤之别。“知”使你以推理演绎出正确之事物;“识”则使你几乎无须下意识的去思考,就得出正确结论,好象条件反射一样。虽然本书中写满了“知”,但这些却都关乎于“识”。它将试图传授你有关Unix开发之事物,这些虽为Unix专家所知晓,但他们却未意识到自己知道。故此,较之大多数Unix书籍,本书寡谈于技术,而偏多于共享文化——包涵其外在与内在之文化,以及有意与无意造成之习俗。所以说,这不是本关于“如何”的书,而是本关于“为何”的书。

 

The why-to has great practical importance, because far too much software is poorly designed. Much of it suffers from bloat, is exceedingly hard to maintain, and is too difficult to port to new platforms or extend in ways the original programmers didn’t anticipate. These problems are symptoms of bad design. We hope that readers of this book will learn something of what Unix has to teach about good design.

因为太多软件设计之拙劣,故“为何”有着巨大实用价值。那些大多遭受注水般填塞折磨的软件,极难以维护,倘若欲移植到新平台,或以原作者未曾预计之方向扩展,皆非常之难。这些问题均为不良设计之病象。我们希望本书读者能学到Unix以其所具有之良好设计所传授给你的东西。

 

This book is divided into four parts: Context, Design, Tools, and Community. The first part (Context) is philosophy and history, to help provide foundation and motivation for what follows. The second part (Design) unfolds the principles of the Unix philosophy into more specific advice about design and implementation. The third part (Tools) focuses on the software Unix provides for helping you solve problems. The fourth part (Community) is about the human-to-human transactions and agreements that make the Unix culture so effective at what it does.

本书分为四部分:背景、设计、工具和社团。第一部分(背景)是哲学和历史,为随后部分提供基础和动机。第二部分(设计)深入剖析Unix哲学原理,一直到得出与设计和实现有关的明确指点。第三部分(工具)着眼于Unix提供给你以助于解决问题的软件。第四部分(社团)介绍人际间的交流和约定,正如它们做出的那样,这些使Unix文化产生了非常深远的影响。

 

Because this is a book about shared culture, I never planned to write it alone. You will notice that the text includes guest appearances by prominent Unix developers, the shapers of the Unix tradition. The book went through an extended public review process during which I invited these luminaries to comment on and argue with the text. Rather than submerging the results of that review process in the final version, these guests were encouraged to speak with their own voices, amplifying and developing and even disagreeing with the main line of the text.

因为这是一本关于共享文化的书,所以我从未想过独自去完成它。你应该会发现书中包括一些由杰出的Unix开发者和Unix习俗缔造者所写的客串文章。在我邀请这些博学的人来评论和争辩书中文字时,本书也经历了一次广泛的公众审阅过程。与其在成书时,将这评论的过程掩去,不如让这些佳宾说出自己的声音,虽然于本书主旨,可能使其充实,可能使其延伸,甚至也可能与其偏离。

 

In this book, when I use the editorial ‘we’ it is not to pretend omniscience but to reflect the fact that it attempts to articulate the expertise of an entire community.

在本书中,当我用“我们”的口吻时,不是我想装成全知全能的上帝,而是想表达一个事实,它正努力成为整个社团的“识”。

 

Because this book is aimed at transmitting culture, it includes much more in the way of history and folklore and asides than is normal for a technical book. Enjoy; these things, too, are part of your education as a Unix programmer. No single one of the historical details is vital, but the gestalt of them all is important. We think it makes a more interesting story this way. More importantly, understanding where Unix came from and how it got the way it is will help you develop an intuitive feel for the Unix style.

因为本书的宗旨是传播文化,所以较之那些正经的技术书籍,讲了更多的历史传说以及题外话。好好享受吧,这些也是培养你成为Unix程序员的一部分。整个伟大的历史是由那些细枝末节的事情组成的。我们认为这种方式会使故事更有趣。更重要的是,明白了Unix从哪里来以及如何踏上这条路,会助你培养Unix方式的直觉。

 

For the same reason, we refuse to write as if history is over. You will find an unusually large number of references to the time of writing in this book. We do not wish to pretend that current practice reflects some sort of timeless and perfectly logical outcome of preordained destiny. References to time of writing are meant as an alert to the reader two or three or five years hence that the associated statements of fact may have become dated and should be double-checked.

出 于同样的原因,我们也不愿把历史写成好像已经结束了似的。你会发现在这本书中有非常多的地方指出了写作的时间。我们不希望把当前的惯例说成永恒真理之一, 并且是命中注定。指明写作的时间意味着,对读者来说,这是一个警告。两年、三年抑或五年之后,这个情况的相关陈述可能已经过时,而且你要加倍小心。

 

Other things this book is not is neither a C tutorial, nor a guide to the Unix commands and API. It is not a reference for sed or Yacc or Perl or Python. It’s not a network programming primer, nor an exhaustive guide to the mysteries of X. It’s not a tour of Unix’s internals and architecture, either. Other books cover these specifics better, and this book points you at them as appropriate.

另外,这本书既不是一本C语言教程,也不是Unix 命令和API 的指南。它不是一本sed或者Yacc或者Perl或者Python的参考,也不是一本网络编程入门,更不是一本关于神秘的X的详尽指南,当然也不是一个Unix内核和架构的导读。其它书籍更好的覆盖了这些细节,本书会在适当的时候把它们指给你。

 

Beyond all these technical specifics, the Unix culture has an unwritten engineering tradition that has developed over literally millions of man-years of skilled effort. This book is written in the belief that understanding that tradition, and adding its design patterns to your toolkit, will help you become a better programmer and designer.

在所有这些技术细节之外,Unix文化有着一个传统,毫不夸张的讲,这个传统已经以娴熟之努力发展了数百万人年[1]。力求让你理解这个传统,并把它那种设计模式添入你的工具箱中,以助你成为一个优秀的程序员和设计师,是本书写作的信念。

 

Cultures consist of people, and the traditional way to learn Unix culture is from other people and through the folklore, by osmosis. This book is not a substitute for person-to-person acculturation, but it can help accelerate the process by allowing you to tap the experience of others.

民众造就文化,习惯上,我们从传说中和他人那里学习Unix文化,这种学习是潜移默化的。本书不是一个人际文化交流的替代品,但它允许你分享他人的经验,以助于加快这个过程。

 

Who Should Read This Book

本书适合谁

 

You should read this book if you are an experienced Unix programmer who is often in the position of either educating novice programmers or debating partisans of other operating systems, and you find it hard to articulate the benefits of the Unix approach.

如果你是一个富有经验的Unix程序员,经常出现在那些指点新手程序员的地方,或者你时常和其他派系的操作系统支持者争辩,却苦于无法把和Unix类似系统的优点讲清楚,那么,你应该读这本书。

 

You should read this book if you are a C, C++, or Java programmer with experience on other operating systems and you are about to start a Unix-based project.

如果你曾经是一个在其他操作系统上有经验的CC++或者Java程序员,而你又准备开始一个基于Unix的工程时,你应该读这本书。

 

You should read this book if you are a Unix user with novice-level up to middle-level skills in the operating system, but little development experience, and want to learn how to design software effectively under Unix.

如果你是一个从新手向中级水平迈进的Unix操作系统使用者,但有一点点开发经验,又想学习如何在Unix下有效的设计软件,那么你应该读这本书。

 

You should read this book if you are a non-Unix programmer who has figured out that the Unix tradition might have something to teach you. We believe you’re right, and that the Unix philosophy can be exported to other operating systems. So we will pay more attention to non-Unix environments (especially Microsoft operating systems) than is usual in a Unix book; and when tools and case studies are portable, we say so.

如果你是一个领悟到可能从Unix传统中受益的非Unix程序员,你应该读这本书。我们相信你是对的,因为Unix哲学可以应用到其它操作系统中去。故此不象一本普通的Unix书籍,我们对非Unix环境(尤其是微软的操作系统)投以更多的关注。并且当工具和实例研究是可移植时,我们也会指出。

 

You should read this book if you are an application architect considering platforms or implementation strategies for a major general-market or vertical application. It will help you understand the strengths of Unix as a development platform, and of the Unix tradition of open source as a development method.

如果你是一个应用程序架构师,正在考虑各种平台,或者为主要的通用市场,不然就是纵向应用选择不同的实现策略时,你应该读这本书,它会助你了解Unix作为一个开发平台的实力,以及把开源作为开发方法的Unix传统。

 

You should not read this book if what you are looking for is the details of C coding or how to use the Unix kernel API. There are many good books on these topics; Advanced Programming in the Unix Environment [Stevens92] is classic among explorations of the Unix API, and The Practice of Programming [Kernighan-Pike99] is recommended reading for all C programmers (indeed for all programmers in any language).

如果你正在找一本,关于C编码细节或者如何使用Unix内核API的书,那么你不应该读这本书。在这些方面有太多的好书,《Unix环境下高级编程》[Stevens92]是一本在Unix API之间历险的经典书籍,《程序设计实践》[Kernighan-Pike99]也被所有C程序员作为推荐读物(实际上,天下间程序员都应该看)。

 

How to Use This Book

如何使用本书

 

This book is both practical and philosophical. Some parts are aphoristic and general, others will examine specific case studies in Unix development. We will precede or follow general principles and aphorisms with examples that illustrate them: examples drawn not from toy demonstration programs but rather from real working code that is in use every day.

这本书既关心实践也关心哲学。它的一部分是格言和普适原理,其它部分则是分析在研究Unix发展中的特殊情况。通常在格言和普适原理之前或之后,我们将为它们举出实例。这些实例不是从玩具程序中抽取出来的,而是从一些如今每天都在用的,可以真正运行的代码中抽取的。

 

We have deliberately avoided filling the book with lots of code or specification-file examples, even though in many places this might have made it easier to write (and in some places perhaps easier to read!). Most books about programming give too many low-level details and examples, but fail at giving the reader a high-level feel for what is really going on. In this book, we prefer to err in the opposite direction.

我 们尽量避免用大量的,像代码或规范文件这样的例子来填塞本书,虽然在很多地方这会使写起来容易些(或许在某些地方更容易读!)。许多与编程有关的书籍给出 了大量低水平的细节和例子,而想这样让读者对实际的后续部分有一个高层次的认识,无疑是失败的。我们反其道行之,哪怕步入歧途。

 

Therefore, while you will often be invited to read code and specification files, relatively few are actually included in the book. Instead, we point you at examples on the Web.

所以,当你需要经常性的阅读代码和规范文件时,相关部分通常很少会包含在书中。相反,我们会在Web上给出例子

 

Absorbing these examples will help solidify the principles you learn into semi-instinctive working knowledge. Ideally, you should read this book near the console of a running Unix system, with a Web browser handy. Any Unix will do, but the software case studies are more likely to be preinstalled and immediately available for inspection on a Linux system. The pointers in the book are invitations to browse and experiment. Introduction of these pointers is paced so that wandering off to explore for a while won’t break up exposition that has to be continuous.

理解这些例子会帮助你巩固你所学到的原理,并把它们变成你工作时的一种近乎于本能的知识。比较理想的是,在你读这本书时,你旁边有一个运行Unix的终端,以及一个唾手可得的Web浏览器。任何的Unix都可以,但是在一个Linux系统中,你应该检查我们用于实例研究的软件是否已经预先安装好,并且马上可以用。当需要你上网查阅或者做实验时,我们会给你指出。这些把你像神游一样的指向它处的说明是顺畅的,丝毫不会打断你原本进行的阅读。

 

Note: while we have made every effort to cite URLs that should remain stable and usable, there is no way we can guarantee this. If you find that a cited link has gone stale, use common sense and do a phrase search with your favorite Web search engine. Where possible we suggest ways to do this near the URLs we cite.

注意:虽然我们尽力去引用稳定和可用的URL,但我们无法保证这一点。如果你发现一个我们引用的链接失效了,那么,像平时一样,在你喜欢的Web搜索引擎上做一个短语搜索。以这种办法得到的结果应该和我们引用的URL差不多。

 

Most abbreviations used in this book are expanded at first use. For convenience, we have also provided a glossary in an appendix.

本书中的大多缩略词在首次使用时是以完整形式出现的。为了方便起见,我们在附录也提供了一个术语表。

 

References are usually by author name. Numbered footnotes are for URLs that would intrude on the text or that we suspect might be perishable; also for asides, war stories, and jokes.

参考资料通常以作者姓名排序。那几个有限的脚注都是些本应加入正文或者容易失效的URL,以及一些题外话,战争故事,还有笑话[2]

 

To make this book more accessible to less technical readers, we invited some non-programmers to read it and identify terms that seemed both obscure and necessary to the flow of exposition. We also use footnotes for definitions of elementary terms that an experienced programmer is unlikely to need.

为了使几乎不懂技术的读者能理解这本书,我们邀请了一些不是程序员的人来读这本书,以便找出那些在叙述过程中必需的,但是有些晦涩的术语。我们也把一些基本术语的解释放入了脚注,虽然对有经验程序员可能不需要。

 

Related References

相关参考资料

 

Some famous papers and a few books by Unix’s early developers have mined this territory before. Kernighan & Pike’s The Unix Programming Environment [Kernighan-Pike84] stands out among these and is rightly considered a classic. But today it shows its age a bit; it doesn’t cover the Internet, and the World Wide Web or the new wave of interpreted languages like Perl, Tcl, and Python.

以前,在涉足这个领域的少数Unix早期开发者所著的书和著名论文中,KernighanPike的《Unix编程环境》[Kernighan-Pike84]脱颖而出,成为了一本经典著作。但是今天它看起来有点陈旧了,它没有包含InternetWorld Wide Web,也没有预见到如今的解释语言浪潮,好象PerlTclPython

 

About halfway into the composition of this book, we learned of Mike Gancarz’s The Unix Philosophy [Gancarz]. This book is excellent within its range, but did not attempt to cover the full spectrum of topics we felt needed to be addressed. Nevertheless we are grateful to the author for the reminder that the very simplest Unix design patterns have been the most persistent and successful ones.

在这本书的写作其间,我们拜读了Mike Gancarz的《Unix哲学》[Gancarz]。它是这个领域里一本极好的书。但是它没有涵盖这个主题的所有延伸范围,而这却是我们认为也应该去写的。不过,我们仍然要感谢作者,关于那些已经非常稳定和成熟,可又十分朴素的Unix设计模式,作者给了我们很多提示。

 

The Pragmatic Programmer [Hunt-Thomas] is a witty and wise disquisition on good design practice pitched at a slightly different level of the software-design craft (more about coding, less about higherlevel partitioning of problems) than this book. The authors’ philosophy is an outgrowth of Unix experience, and it is an excellent complement to this book.

《注重实效的程序员》(又译《程序员修炼之道》)[Hunt-Thomas]是一本诙谐和睿智的专题集,谈论良好的注重实效的设计,着眼于软件设计工艺(更多关注编码,而不是较高层次上的问题划分)的不同层次。作者的哲学来自于Unix上的经验,是本书的一个极好的补充。

 

The Practice of Programming [Kernighan-Pike99] covers some of the same ground as The Pragmatic Programmer from a position deep within the Unix tradition.

《程序设计实践》[Kernighan-Pike99]关注的范围和《注重实效的程序员》相同,但在Unix传统方面更深入。

 

Finally (and with admitted intent to provoke) we recommend Zen Flesh, Zen Bones [Reps-Senzaki], an important collection of Zen Buddhist primary sources. References to Zen are scattered throughout this book. They are included because Zen provides a vocabulary for addressing some ideas that turn out to be very important for software design but are otherwise very difficult to hold in the mind. Readers with religious attachments are invited to consider Zen not as a religion but as a therapeutic form of mental discipline—which, in its purest non-theistic forms, is exactly what Zen is.

最后(毫无疑问那会招来愤怒),我们推荐《Zen Flesh, Zen Bones[Reps-Senzaki], 这是一个佛教禅宗入门资料的重要收录集,对禅宗的引证遍及这本书的各处。之所以在这里包括这本书,是因为在为那些对软件设计产生了非常重要的,但同时又难 以领悟的思想取名时,禅宗给我们提供了一个词汇表。有宗教信仰的读者可以把禅宗作为一个改善智力的训练方式,而不是把它作为一种宗教来看——从纯粹的无神 论角度来看,禅宗也的确是这样的。

 

Conventions Used in This Book

本书中的约定

 

The term “UNIX” is technically and legally a trademark of The Open Group, and should formally be used only for operating systems which are certified to have passed The Open Group’s elaborate standards-conformance tests. In this book we use “Unix” in the looser sense widely current among programmers, to refer to any operating system (whether formally Unix-branded or not) that is either genetically descended from Bell Labs’s ancestral Unix code or written in close imitation of its descendants. In particular, Linux (from which we draw most of our examples) is a Unix under

this definition.

从技术以及法律上来说,术语“UNIX”是属于Open Group的商标,而且它要能够通过Open Group的符合标准的精心测试,这样的操作系统才能正式使用这个名称。在这本书中,我们所谈及的“UNIX”范围比较宽泛,我们指的是通常程序员们指的那些操作系统(不管有没有被正式地打上“UNIX”标志),它可能衍生于贝尔实验室的那个UNIX始祖的源代码,也可能是那些被写的象UNIX后代的仿造品。特别地,在这个定义下,Linux(大多数我们引用的例子都来自于它)也是一个Unix

 

This book employs the Unix manual page convention of tagging Unix facilities with a following manual section in parentheses, usually on first introduction when we want to emphasize that this is a Unix command. Thus, for example, read “munger(1)” as “the ‘munger’ program, which will be documented in section 1 (user tools) of the Unix manual pages, if it’s present on your system.” Section 2 is C system calls, section 3 is C library calls, section 5 is file formats and protocols, section 8 is system administration tools. Other sections vary among Unixes but are not cited in this book. For more, type man 1 man at your Unix shell prompt (older System V Unixes may require man –s 1 man).

在标记Unix工具时,这本书采用了Unix手册页的习俗。在我们想强调的Unix命令首次出现时,我们在其后的圆括号里加上了手册页的章节。例如,当看到“munger(1)”时,那就表示“程序munger,如果你的系统提供的话,它的文档在Unix手册页的第一部分(用户工具)里”。第二部分是C系统调用,第三部分是C函数库调用,第五部分是文件格式和协议,第八部分是系统管理员工具。对于各种Unix手册页的其他部分,本书没有提及。要想获得更多了解的话,就在你的Unix shell提示符下键入man 1 man(对于古老的System V Unix,可能需要输入man –s 1 man)。

 

Sometimes we mention a Unix application (such as Emacs, without a manual-section suffix and capitalized. This is a clue that the name actually represents a well-established family of Unix programs with essentially the same function, and we are discussing generic properties of all of them. Emacs, for example, includes xemacs.

有些时候,我们提到一个Unix应用程序(例如Emacs)时却没有带手册页章节后缀,并且首字母是大写。这表明这个名字在这里,实际上描述一个本质上有着相同功能的,已经被确定好的Unix程序家族。这时我们只讨论它们的共有的性质。例如,Emacs包括xemacs

 

At various points later in this book we refer to ‘old school’ and ‘new school’ methods. As with rap music, new-school starts about 1990. In this context, it’s associated with the rise of scripting languages, GUIs, open-source Unixes, and the Web. Old-school refers to the pre-1990 (and especially pre-1985) world of expensive (shared) computers, proprietary Unixes, scripting in shell, and C everywhere. This difference is worth pointing out because cheaper and less memory constrained machines have wrought some significant changes on the Unix programming style.

在本书随后的不同地方,我们会提到“旧学派”和“新学派”方法。大约在1990年,伴随着rap音乐,新学派出现了,它的出现和当时脚本语言,GUI,开源Unix以及Web的兴起有关。旧学派指的1990年以前(尤其是1985年以前)的学术界,那些人用着昂贵(共享)的计算机,私有的Unixshell下的脚本以及无处不在的C。这个差异绝对值得指出,因为廉价以及几乎没有内存限制的机器使得Unix编程风格发生了重大的改变。

 

Our Case Studies

我们的实例研究

 

A lot of books on programming rely on toy examples constructed specifically to prove a point. This one won’t. Our case studies will be real, pre-existing pieces of software that are in production use every day. Here are some of the major ones:

大多数关于编程的书都依靠一些特别创建的玩具例子来证明一个观点,本书却不想这样。我们学习的例子是真实的,是我们每天都在使用的成品软件的一部分。下面是主要的几个:

 

cdrtools/xcdroast These two separate projects are usually used together. The cdrtools package is a set of CLI tools for writing CD-ROMs; Web search for “cdrtools”. The xcdroast application is a GUI front end for cdrtools; see the xcdroast project site [http://www.xcdroast.org/].

Cdrtools/xcdroast 这两个单独的项目通常被放在一起。Cdrtools包是一套刻录CD-ROMCLI工具集。可以在Web上搜索一下“cdtools”。xcdroast是为cdrtools写的一个GUI前端应用程序。参见xcdroast项目站点[http://www.xcdroast.org/]

 

fetchmail                            The fetchmail program retrieves mail from remote-mail servers using the POP3 or IMAP post-office protocols. See the fetchmail home page [http://www.catb.org/~esr/fetchmail] (or search for “fetchmail” on the Web).

fetchmail                             fetchmail是一个使用POP3或者IMAP邮件传输协议,从远程邮件服务器上获取邮件的程序。参见fetchmail的主页[http://www.catb.org/~esr/fetchmail](或者在Web上搜索“fetchmail”)。

 

GIMP                                 The GIMP (GNU Image Manipulation Program) is a full-featured paint, draw, and image-manipulation program that can edit a huge variety of graphical formats in sophisticated ways. Sources are available from the GIMP home page [http://www.gimp.org/] (or search for "GIMP" on the Web).

GIMP                   GIMPGNU图象处理程序)是一个全功能的绘图和图象处理程序,它以精巧的方式编辑各种不同的图象格式。从GIMP的主页可以获取可用的源码[http://www.gimp.org/](或者在Web上搜索“GIMP”)。

 

mutt                                   The mutt mail user agent is the current best-of-breed among textbased Unix electronic mail agents, with notably good support for MIME (Multipurpose Internet Mail Extensions) and the use of privacy aids such as PGP (Pretty Good Privacy) and GPG (GNU Privacy Guard). Source code and executable binaries are available at the Mutt project site [http://www.mutt.org].

mutt                    在众多基于文本的Unix电子邮件代理程序中,mutt邮件用户代理程序是当前最好的一个。它对于MIMEMultipurpose Internet Mail Extensions)以及诸如PGPPretty Good Privacy)和GPGGNU Privacy Guard)这样的加密功能支持的非常好。在Mutt工程的站点[http://www.mutt.org]上,可以找到可用的源代码和可执行二进制文件。

 

xmlto                                 The xmlto command renders DocBook and other XML documents in various output formats, including HTML and text and PostScript. For sources and documentation, see the xmlto project site [http://cyberelk.net/tim/xmlto/].

xmlto                   xmlto命令用来把DocBook和那些XML文档转换成不同的格式,包括HTML、文本文件以及PostScript。在xmlto工程站点上可以找到源代码和文档[http://cyberelk.net/tim/xmlto/]

 

To minimize the amount of code the user needs to read to understand the examples, we have tried to choose case studies that can be used more than once, ideally to illustrate several different design principles and practices. For this same reason, many of the examples are from my projects. No claim that these are the best possible ones is implied, merely that I find them sufficiently familiar to be useful for multiple expository purposes.

为了尽量减少需要读者去读的代码以及去理解的例子的数量,我们尝试去挑选可以反复使用的例子来研究,以求完美地说明那几个不同的设计原则和惯例。出于同样的原因,许多例子来自我的工程。这并非暗示它们是最好的,只不过我觉得我对它们很熟悉,这会对各种目的的解释有帮助。

 

Author’s Acknowledgements

致谢

 

The guest contributors (Ken Arnold, Steven M. Bellovin, Stuart Feldman, Jim Gettys, Steve Johnson, Brian Kernighan, David Korn, Mike Lesk, Doug McIlroy, Marshall Kirk McKusick, Keith Packard, Henry Spencer, and Ken Thompson) added a great deal of value to this book.. Doug McIlroy, in particular, went far beyond the call of duty in the thoroughness of his critique and the depth of his contributions, displaying the same care and dedication to excellence which he brought to managing the original Unix research group thirty years ago.

客串作者(Ken Arnold, Steven M. Bellovin, Stuart Feldman, Jim Gettys, Steve Johnson, Brian Kernighan, David Korn, Mike Lesk, Doug McIlroy, Marshall Kirk McKusick, Keith Packard, Henry Spencer, Ken Thompson)为这本书增添了许多有价值的文章。特别是Doug McIlroy,他深刻的批评和极具深度的文章,远远超出了我邀请他时给出的任务,象三十年前管理最初的Unix研发组那样,他给予了同样的关注和奉献。

 

Special thanks go to Rob Landley and to my wife Catherine Raymond, both of whom delivered intensive line-by-line critiques of manuscript drafts. Rob’s insightful and attentive commentary actually inspired more than one entire chapter in the final manuscript, and he had a lot to do with its present organization and range; if he had written all the text he pushed me to improve, I would have to call him a co-author. Cathy was my test audience representing non-technical readers; to the extent this book is accessible to people who aren’t already programmers, that’s largely her doing.

特别感谢Rob Landley和我的妻子Catherine Raymond,他们均对本书的原稿逐行阅读,并做出了深入的评价。Rob深刻且专注的评论比这最终手稿的一整章更令人激动,他在全文表述的组织和范围方面作了大量的工作,如果所有推动我改进的文字全由他来撰写,那我就不得不称他为合著者。Cathy是我的试验听众,代表了非技术读者。为了拓展这本书的范围,让那些还不是程序员的人接受,有大量的工作要她去做。

 

This book benefited from discussions with many other people over the five years it took me to write it. Mark M. Miller helped me achieve enlightenment about threads. John Cowan supplied some insights about interface design patterns and drafted the case studies of wily and VM/CMS, and Jef Raskin showed me where the Rule of Least Surprise comes from. The UIUC System Architecture Group contributed useful feedback on early chapters. The sections on What Unix Gets Wrong and Flexibility in Depth were directly inspired by their review. Russell J. Nelson contributed the material on Bernstein chaining in Chapter 7. Jay Maynard contributed most of the material in the MVS case study in Chapter 3. Les Hatton provided many helpful comments on the Languages chapter and motivated the portion of Chapter 4 on Optimal Module Size. David A. Wheeler contributed many perceptive criticisms and some case-study material, especially in the Design part. Russ Cox helped develop the survey of Plan 9. Dennis Ritchie corrected me on some historical points about C.

在我写书的这五年多里,和其他许多人的讨论对本书的促成有很大帮助。Mark M. Miller启发了我对线程的领悟。John Cowan对接口设计模式提供了一些见解,并为wilyVM/CMS的学习提供了实例。Jef Raskin向我说明了最小诧异原理是从哪里来的。UIUC系统架构小组对最初章节提供了有用的反馈。像“Unix之过”和“深入理解适应性”这样的章节,其灵感就直接来源于他们的审阅。Russell J. Nelson为第7章的伯恩斯坦链表提供了材料。Jay Maynard为第3章中MVS的学习实例提供了大量的材料。在“语言”一章中,Les Hatton提供了许多有帮助的注解,并且促成了第4章关于最佳模块尺寸的那部分。David A. Wheeler提供了许多有见地的批评和学习实例的资料,特别是在“设计”这部分。Russ Cox审定了本书第9次修改的计划。Dennis Ritchie纠正了我在C的历史上的一些观点。

 

Hundreds of Unix programmers, far too many to list here, contributed advice and comments during the book’s public review period between January and June of 2003. As always, I found the process of open peer review over the Web both intensely challenging and intensely rewarding. Also as always, responsibility for any errors in the resulting work remains my own.

在本书20031月到6月这段公众审阅期间,成百上千的Unix程序员提供了建议和注解,很遗憾这里不能一一列出。像往常一样,我发现这种在Web上公开的同行审阅充满了有趣的挑战和奖赏。也是像往常一样,最终著作中出现任何错误的责任都留给了我。

 

The expository style and some of the concerns of this book have been influenced by the design patterns movement; indeed, I flirted with the idea of titling the book Unix Design Patterns. I didn’t, because I disagree with some of the implicit central dogmas of the movement and don’t feel the need to use all its formal apparatus or accept its cultural baggage. Nevertheless, my approach has certainly been influenced by Christopher Alexander’s work (especially The Timeless Way of Building and A Pattern Language, and I owe the Gang of Four and other members of their school a large debt of gratitude for showing me how it is possible to use Alexander’s insights to talk about software design at a high level without merely uttering vague and useless generalities. Interested readers should see Design Patterns: Elements of Reusable Object-Oriented Software [GangOfFour] for an introduction to design patterns.

本书的说明风格以及关注点都受到了设计模式运动的影响。实际上,我曾经卖弄的想把这本书命名为“Unix设计模式”。最终我没有如此做,因为对这场运动中的某些隐含的中心教义,我并不苟同。我并不觉得所有都需要使用它的索引形式,也不准备承担这种文化带来的负累。然而,我的方式当然受到了Christopher Alexander著作[3]的影响(尤其是《建筑的永恒之道》和《模式语言》,在此我要感谢“四人帮”和他们学派的其他成员,感谢他们向我展示了如何用Alexander的观点,在相当高的层次上讨论软件设计的可能性,而且没有含混不请的言语和无用的概括。感兴趣的读者若想了解设计模式,应该看看《设计模式——可复用的面向对象软件基础》[GangOfFour])。

 

The title of this book is, of course, a reference to Donald Knuth’s The Art of Computer Programming. While not specifically associated with the Unix tradition, Knuth has been an influence on us all.

当然,本书的书名借鉴了Donald Knuth的《计算机编程艺术》。虽然它和Unix传统无明显的关联,但Knuth的确已经影响了我们每个人。

 

Editors with vision and imagination aren’t as common as they should be. Mark Taub is one; he saw merit in a stalled project and skillfully nudged me into finishing it. Copy editors with a good ear for prose style and enough ability to improve writing that isn’t like theirs are even less common, but Mary Lou Nohr makes that grade. Jerry Votta seized on my concept for the cover and made it look better than I had imagined. The whole crew at Prentice-Hall gets high marks for making the editorial and production process as painless as possible, and for cheerfully accommodating my control-freak tendencies not just over the text but deep into the details of the book’s visual design, art, and marketing.

有眼界和想象力的编辑不象他们看起来那么普通。Mark Taub就是这样一个人。他看到了一个停工项目的价值,并且巧妙的推动我去完成它。文字编辑应该极不平常,他要能够欣赏散文风格,并有足够的能力去改善那些文字,也许他们看起来并不象,但Mary Lou Nohr做到了这种水平。对于封面,Jerry Votta领会了我的想法,并且做的比我想象的要好。在使这本书尽可能毫无痛楚的编写和出版的过程中,Prentice出版社的全体人员做的很好。他们很愉快的接纳了我古怪的操控倾向,这些不仅表现在文字上,而且深入到书籍感官上的设计,艺术,以及市场运作。

 

 



[1] The three and a half decades between 1969 and 2003 is a long time. Going by the historical trend curve in number of Unix sites during that period, probably somewhere upwards of fifty million man-years have been plowed into Unix development worldwide.

1969年到2003年的35年是一个很长的时间,这期间,在历史的大浪中,涌现过多少Unix站点,可能在世界范围内差不多已经耗费了五千万人年。

[2] This particular footnote is dedicated to Terry Pratchett, whose use of footnotes is quite...inspiring.

这个特殊的脚注献给Terry Pratchet,他那脚注的用法实在是,恩,是太有趣了。

[3] An appreciation of Alexander’s work, with links to on-line versions of significant portions, may be found at Some Notes on Christopher Alexander [http://www.math.utsa.edu/sphere/salingar/Chris.text.html].

对于Alexander著作的正确评价,以及重要部分的在线版本链接,应该可以在一些与Christopher Alexander有关的笔记中找到[http://www.math.utsa.edu/sphere/salingar/Chris.text.html]

posted on 2007-12-17 23:44 cuigang 阅读(482) 评论(0)  编辑 收藏 引用 所属分类: 翻译


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理