TAOUP初译样稿_袁德俊

 .-----------------------------------------.
| 建议使用: Notepad记事本工具浏览编辑本文件 |
| 建议字体: Lucida Console, 规则, 五号字    |
| 建议设置: 自动换行                        |
 *-----------------------------------------*

              +---------+
              | Preface | 前言
              +---------+

Unix is not so much an operating system as an oral history.
Unix 与其说是个操作系统,不如说是部口头历史。(Solstice更正之)[注]
--
NealStephenson
作者:NealStephenson
([注]:(SkyMountain提供)……现代意义上的口述历史(Oral History),即把口述历史作为一个专门学科,是从1940年代开始的。1948年,由新闻工作者转行的历史学者亚伦· 芮文斯( Allen Nevins),在美国哥伦比亚大学建立了第一座现代口述历史档案馆,用以记录、保存美国生活中有意义的私人回忆资料。他推动的关于福特汽车公司的历史访问,上自老板,下至普通员工,访谈记录达26000多页,成为研究该公司最为丰富、生动的资料。
——引自http://www.historyshanghai.com/shanghai/file/koushu/1-jiazhi.htm
故oral history是一个学科的科名,类似于物理学、化学一样,是现代历史学的一个分支。此学科在国外甚为热门,用Google可以搜索出一大堆来。
一般译为“口述历史”,也见有译为“口述史”的。)

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.
知识和expertise(专家观点)有很大的区别。知识让你推断出做哪些事是对的;expertise让做“正确的事”成为一种条件反射——几乎完全不需要有意识的思考。(感谢:Solstice更正之)

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.
这本书分四章:Context(来龙去脉)、设计、工具和社团。第一部分(Context(来龙去脉))包括philosophy (思想)和历史,描述了后续部分的基础和动机。第二部分(设计)展开了Unix philosophy (思想)的原理,是更加具体的设计与实现方法和建议。第三部分(工具)聚焦在Unix提供的软件来帮助你解决问题。第四部分(社团)是关于人与人沟通和协作的Unix文化是怎样的effective(生机勃勃)。

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.
因为这本书是为了转播文化,因此它包含有更多的历史和传说,而非通常的技术书籍。Enjoy(享受);这个过程,也是作为一个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.
同样原因,我们拒绝描写过去的历史。你将找到在写这本书的时候所引用的大量的不寻常的参考。我们不希望将这次实践说成能够得出一些永恒的非常合乎逻辑的预言性的成果。写作时的References(参考)意在提醒读者,两、三或五年后相关的一些陈述会变得dated(过时)或是应该被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[1] 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文化有一个不成文的工程传统,它已经发展成为超过literally(??)数百万man-years(人年)的skilled effort(成熟努力)。本书的写成是基于理解该传统的信仰,然后增加它的开发模式作为你的工具包,并帮助你成为一个更出色的程序员和设计师。

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.
文化由人,和通过folklore(民间传说),osmosis(渗透),从他人处学习Unix文化的传统所组成。这本书不是一个person-to-person acculturation(人-人文化传承)的替代品,但它能帮助加速这过程,让你能轻松地体验他人的经验。

.~~~~~~~~~~~~~~~~~~~~~~~~~~~.
! 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程序员,处于经常需要教导新手的位置,或和其他操作系统游击队争辩,并且你发觉很难articulate(清晰明白地表达出)Unix approach(方法)的好处。你应该读这本书。

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.
如果你是一个C,C++,或Java程序员,并有其他操作系统的经验,而且你真打算开始一个Unix基础的项目,你应该看这本书。

....................................
[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.
[1] 1969到2003间的35个年头是个很长的时间。这个时期Unix站点的增长历史趋势线,大概有50,000,000  man-years(人年)以上已经plowed into(转移)到Unix development worldwide(发展的全球化)。
````````````````````````````````````

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 philosophy(系统思想)能被转换到其他操作系统。因此,我们希望花多些注意给非Unix环境 (尤其微软操作系统),而不只是平常的一本Unix书,尤其是工具和案例研究更portable(方便),we say so(我们是这样认为的)。

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.
如果你是一个应用架构师,设计平台或执行策略给一个主要的general-market(通用市场),或vertical application(顶级应用),你应该阅读本书。它可以帮助你理解Unix作为一个开发平台和开源作为开发方式的Unix传统的strengths(力量)。

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开发案例研究。我们将precede or follow(尊从)普遍规律和aphorisms(原则),并以事例来描画它们:这些例子绝不是玩具演示程序,而是被每天使用的实际工作的代码。

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.
我们有意规避本书中充实大量代码或specification-file(说明文档)例子,尽管很多地方可以很容易使用之(或一些地方可以如此)。大部分关于编程的书都给出太多低级细节和例子,导致错误地给读者一个高级感觉"真实再现"。这本书,我们宁愿犯相反的错误。

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.
因此,当你经常被引导阅读代码和说明文档时,书中却很少涉及。代替的是,我们给出了这些例子的网址。

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.
这些有趣的例子会帮助你solidify(专注)于原理,你学习到semi-instinctive(半本能)的工作知识。理想状态,你应该使用Unix系统终端,用网络浏览器阅读本书。所有Unix可以支持,但软件的案例研究需要预先安装,很快linux也将支持。书中pointers(脚注)帮助浏览和实验。这些脚注被放在那些需要深究但又不能中断连续阅读的地方。

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都是稳定的和可用的,但仍然不能保证这点。如果你发现某个连接已经stale(陈旧), 请用你的直觉选择一个短语用你最喜欢的搜索引擎搜一下吧。用我们引用的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.[2]
参考通常注明作者。URL的编号脚注,将标注文本或我们认为可能是perishable(容易腐烂的);还有asides(旁白),战争故事,和玩笑。[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早期开发者的书之前已经涉足此领域。Kernighan & Pike的《Unix编程环境》[Kernighan-Pike84]是相当突出的一个,堪称经典。但今天它显得有些过时,它没有覆盖互联网,和万维网或新的解释语言浪潮,象Perl, Tcl, 和Python。

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系统思想》。这本书在它的讨论范围内非常优秀,但没能全面覆盖我们觉得需要讨论的相关论题。不过,我们还是感谢这些作者告诉我们这个道理,非常简单的Unix设计模式已经是最稳定和成功的模式。

......................................
[2] This particular footnote is dedicated to Terry Pratchett, whose use of footnotes is quite...inspiring.
[2] 这些详细的脚注由Terry Pratchett完成,它对脚注的使用相当投入。
``````````````````````````````````````

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 higher-level partitioning of problems) than this book. The authors’ philosophy is an outgrowth of Unix experience, and it is an excellent complement to this book.
《Pragmatic(实用)程序员》[Hunt-Thomas]是一本相对本书更加诙谐机智的讨论好的设计实践是pitched(定位于)细微的不同层次的软件设计工艺(多关注编码,少关注高级的问题划分)。作者的观点是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],一个重要的Zen Buddhist(禅宗)起源的collection讲述。关于禅的参考分布在整本书中。之所以引用它是因为禅宗提供了一个一些想法的出处,它变得对于软件设计非常重要,但又是很难在头脑中把握的。有宗教信仰的读者认为禅不是一个宗教而是一个精神训练的形式——在它的无神论形式里,禅是非常exactly(严密的)。

.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
! 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(开源组织), 形式上用做操作系统,它经过开源组织最精细的standards-conformance(标准化)测试。本书中我们使用的"Unix"是被当今程序员广为使用,相关的操作系统(无论是否贴有Unix基础的标牌)都或多或少引用了从Bell实验室最原始的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 facilities(工具),后跟圆括号内手册段落号,通常是在我们强调它是Unix命令的时候出现。这样,举例,读“munger(1)”为“‘munger’程序出自Unix手册页的第一段,无论它是否出现在你的系统内。”段落2是C系统调用,段落3是C库调用,段落5是文件格式和协议,段落8是系统管理工具。其他段落不同Unix各不相同,本书不做讨论。尝试,通过Unix命令行方式输入man 1 man(老的System V Unixes可能需要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.
本书后面很多点,我们谈到‘old school’和 ‘new school’ 方法。作为RAP音乐,new-school开始于1990年。在这里,它是关联于脚本语言的兴起,GUIs,开源Unixes,和互联网。Old-school则指1990年前(尤其是1985年前)的昂贵(共享)计算机的时代,私有的Unixes,外壳脚本,和无处不在的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/].
    这2个相关的项目通常一起使用。cdrtools工具包是一系列CLI关于写CD-ROM的CLI工具集;通过网络搜索“cdrtools”。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程序使用POP3或IMAP邮件协议从远程邮件服务器获取邮件。参考fetchmail的主页[http://www.catb.org/~esr/fetchmail] (或从网上搜索“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 avail-able from the GIMP home page [http://www.gimp.org/] (or search for "GIMP" on the Web).
    GIMP(GNU图象管理程序)是一个全功能绘画和图象管理程序,它可以用最传统经典的方法编辑种类繁多的图象格式。源码可以从GIMP主页[http://www.gimp.org/](或从网上搜索"GIMP")。

mutt:
    The mutt mail user agent is the current best-of-breed among text-based 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电子邮件代理中最好的一个,它非常好地支持了MIME(Multipurpose Internet Mail Extensions(多用途互联网邮件扩展)),并且使用了私秘助理象PGP (Pretty Good Privacy) 和 GPG (GNU 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命令转换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, and Ken Thompson)为本书增加了大量的好的建议。Doug McIlroy,更无偿地贡献了他的批评和深刻的意见,展示出同样的关注和卓越的奉贤,他带来了30年前原始的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.
本书受益于5年来同许多人的讨论,这促使我将它写出来。Mark M. Miller帮我完成了有关threads(线程)的enlightenment(启发)。John Cowan提供了一些有关界面设计模式的意见和草拟了wily和VM/CMS的案例研究,还有Jef Raskin告诉我Rule of Least Surprise出自那里。UIUC系统结构组织提供了早期章节的有用feedback(反馈)。Unix Gets Wrong(犯错)的部分和Flexibility in Depth(深度弹性)都直接来源他们的review(评价)。Russell J. Nelson为第7章Bernstein chaining提供了些资料。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.
数百名Unix程序员,无法尽数列于此处,在本书2003年1月至6月的公开评论期间给予了大量忠告和建议。而且,我发现通过网络open peer review(公开评价)的过程兼具激烈的挑战和激烈的回报。工作结束前的任何错误的责任都留给了我自己。

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[3] (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.
本书的expository(阐述)风格和一些观点受到了design patterns movement(设计模式运动)(SkyMountain更正)的影响;甚至,我有将书名改为《Unix设计模式》的想法。我最终没有,是因为我不赞同该运动的隐含的核心教条,也不觉得有必要使用它的全部形式,或它的文化baggage(行囊)。然而,我的观点还是受到了Christopher Alexander的工作的影响[3](尤其是《建造永恒的方法与模式语言》,还有《the Gang of Four[注]》的影响和他们学校的其他人的大量帮助,告诉我如何尽可能以Alexander的观点在一定高度讨论软件设计,而不只是完全模糊的,没有价值的泛泛讨论。有兴趣的读者应该看看《设计模式:可复用面向对象软件的基础(SkyMountain更正)》[GangOfFour]对设计模式做了一定介绍。
[注:《设计模式》的四个作者“the Gang of Four”缩写作"GoF",中文译名通译“四人帮”](感谢:SkyMountain补充)

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.
视觉和imagination(外观)的编辑并不象他们通常一样。Mark Taub就是一个,他敏锐的观察到了报摊市场的价值并巧妙地鼓励我完成了本书。Copy拷贝编辑则以敏锐淹灌和足够的能力提升了写作技巧而不是象他们通常一样,尤其是 Mary Lou Nohr给与了更高的评级。Jerry Votta抓住了我的封面的精髓,并使它看上要超过我能想象的。Prentice-Hall的全体员工给予了很高的关注于编辑和生产过程,尽可能帮助我控制好我的思路,而非仅仅单纯地在文字上,甚至细致到本书的外观设计,艺术和市场。

.......................................
[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].
[3] 对Alexander的工作的表示感谢,这里是部分有价值的在线版连接,可以在Christopher Alexander的Some Notes找到[http://www.math.utsa.edu/sphere/salingar/Chris.text.html]。
[注]:(SkyMountain提供)Christopher Alexander是一个著名建筑学家,他的著作对设计模式的产生和发展有很大的影响。The Timeless Way of Building and A Pattern Language 是Alexander的两本书:《建筑的永恒之道》及其姐妹篇《建筑模式语言》。据网上资料介绍,两书中文版在2002年已由知识产权出版社出版
```````````````````````````````````````

              +-----------------+
              | Part I. Context | 来龙去脉
              +-----------------+


Chapter 1. Philosophy
第一章. 思想体系

Philosophy Matters
Those who do not understand Unix are condemned to reinvent it, poorly.
哲学实质就是:那些不理解Unix的人往往可怜地认为是对它的(在不知他人以前发明的情况下的)reinvent(重复发明)。
--
HenrySpencer
Usenet signature, November 1987
作者:HenrySpencer
Usenet签名,1987年11月

.~~~~~~~~~~~~~~~~~~~~~~~~.
! Culture? What Culture?  ! 文化?什么文化?
`~~~~~~~~~~~~~~~~~~~~~~~~`

This is a book about Unix programming, but in it we’re going to toss around the words ‘culture’, ‘art’, and ‘philosophy’ a lot. If you are not a programmer, or you are a programmer who has had little contact with the Unix world, this may seem strange. But Unix has a culture; it has a distinctive art of programming; and it carries with it a powerful design philosophy. Understanding these traditions will help you build better software, even if you’re developing for a non-Unix platform.
这是一本关于Unix编程的书,但其中我们投入了更多的围绕“文化”“艺术”“哲学”的内容。如果你不是一个程序员,或你是个程序员但很少接触Unix世界,这看起来会比较陌生。但Unix有一个文化;有一个与众不同的编程艺术;它还承载着一个强大的设计哲学。理解这些传统将帮助你建造更好的软件,尽管你正在一个非Unix平台上开发。

Every branch of engineering and design has technical cultures. In most kinds of engineering, the unwritten traditions of the field are parts of a working practitioner’s education as important as (and, as experience grows, often more important than) the official handbooks and textbooks. Senior engineers develop huge bodies of implicit knowledge, which they pass to their juniors by (as Zen Buddhists put it) “a special transmission, outside the scriptures”.
每个工程分支和设计都蕴涵技术文化。大部分种类的工程中,比起官方手册和教科书,该领域不成文的传统是从业者接受教育的重要部分(还有,经验积累,经常更加重要)。资深的工程人员发展了一个庞大的含蓄知识体系,并pass(传递)给(禅宗叫推put(给))新进工程人员,“过程是特殊的,游离于文本之外的”。

Software engineering is generally an exception to this rule; technology has changed so rapidly, software environments have come and gone so quickly, that technical cultures have been weak and ephemeral. There are, however, exceptions to this exception. A very few software technologies have proved durable enough to evolve strong technical cultures, distinctive arts, and an associated design philosophy transmitted across generations of engineers.
软件工程通常是该规则的一个例外;技术更迭迅速,软件环境来去频繁,技术文化变的微弱而短命。可是还是有这个例外的例外存在。非常少的软件工艺被证实足够持久,可以发展为强大的技术文化,与众不同的艺术,而且相关的设计思想体系在一代代工程师中传播。

The Unix culture is one of these. The Internet culture is another — or, in the twenty-first century, arguably the same one. The two have grown increasingly difficult to separate since the early 1980s, and in this book we won’t try particularly hard.
Unix文化就是其中之一。互联网文化是另一个 —— 或者,在21世纪,是可以相提并论的同样的一个。早在1980年前,这两个已经日益增长且很难分开,本书并不想试图独立开来讨论。

.~~~~~~~~~~~~~~~~~~~~~~~~.
! The Durability of Unix  ! Unix的持久力
`~~~~~~~~~~~~~~~~~~~~~~~~`

Unix was born in 1969 and has been in continuous production use ever since. That’s several geologic eras by computer-industry standards — older than the PC or workstations or microprocessors or even video display terminals, and contemporaneous with the first semiconductor memories. Of all production timesharing systems today, only IBM’s VM/CMS can claim to have existed longer, and Unix machines have provided hundreds of thousands of times more service hours; indeed, Unix has probably supported more computing than all other timesharing systems put together.
Unix诞生于1969年,并一直沿用至今。这是几个计算机工业标准的物理意义上的纪元 — 比PC/工作站/微处理器/视频显示终端还老旧,以及同时代的第一块半导体存储器。所有今天的分时系统产品,不只IBM的VM/CMS被提到拥有多长的生存期,Unix机器也同样提供了成百上千次的服务小时;其实,Unix大概已经承担了比其他所有分时系统的加在一起还要长的计算支持。

Unix has found use on a wider variety of machines than any other operating system can claim. From supercomputers to handhelds and embedded networking hardware, through workstations and servers and PCs and minicomputers, Unix has probably seen more architectures and more odd hardware than any three other operating systems combined.
比起任何一个其他操作系统来说,Unix已经被更广泛地用于多变的机器上。从超级计算机到手持和嵌入式网络设备,通过工作站和服务器还有PC以及微型计算机,比起其他任何第3方操作系统和在一起,Unix已经看上去更加architectures(结构化),更odd hardware(硬件无关)。

Unix has supported a mind-bogglingly wide spectrum of uses. No other operating system has shone simultaneously as a research vehicle, a friendly host for technical custom applications, a platform for commercial-off-the-shelf business software, and a vital component technology of the Internet.
Unix已经支持了一个mind-bogglingly(??)广泛地使用。不象其它操作系统所描述的是一个研究工具,而是一个友好的运行技术习惯应用的主机,一个非商业模式下的商业软件的平台,和一个互联网技术的重要组成部分。

Confident predictions that Unix would wither away, or be crowded out by other operating systems, have been made yearly since its infancy. And yet Unix, in its present-day avatars as Linux and BSD and Solaris and MacOS X and half a dozen other variants, seems stronger than ever today.
自它诞生就已经充实了太多的“自信的预言”,Unix将会消失,或被其他操作系统挤垮。但还是Unix,在化身为Linux和BSD和Solaris和MacOS X以及众多的继承者,看上去比以前更加强壮。

    Robert Metcalf [the inventor of Ethernet] says that if something comes along to replace Ethernet, it will be called “Ethernet”, so therefore Ethernet will never die.[4] Unix has already undergone several such transformations.
    Robert Metcalf[以太网发明人]说过,如果什么会在将来替代以太网,它就叫做“以太网”,因此以太网将永远不回消亡[4]。Unix也已经经历过了几个这样的转变。

KenThompson

At least one of Unix’s central technologies — the C language — has been widely naturalized elsewhere. Indeed it is now hard to imagine doing software engineering without C as a ubiquitous common language of systems programming. Unix also introduced both the now-ubiquitous tree-shaped file namespace with directory nodes and the pipeline for connecting programs.
最后一个Unix的核心技术 — C语言 — 已经被广泛地移植到别处。事实上它已经根植于所有的软件工程中,没有一个象C语言这样普遍地存在于系统编程的语言了。Unix还创造了现在已无处不在的目录节点的树形文件命名方式,和连接程序的管道技术。

Unix’s durability and adaptability have been nothing short of astonishing. Other technologies have come and gone like mayflies. Machines have increased a thousandfold in power, languages have mutated, industry practice has gone through multiple revolutions — and Unix hangs in there, still producing, still paying the bills, and still commanding loyalty from many of the best and brightest software technologists on the planet.
Unix的经久和适应性已经不在只是短暂的惊讶。其它技术确象蝴蝶一样飞来飞去。机器性能已经成千倍的增长,语言也变异了很多,工业实践已经过了多次变革 — 然而,Unix依然矗立在那里,仍然生产着,仍然支付着各种费用,在这个星球上,依然命令众多忠实的最优秀和聪明的软件技术人员。

..................................
[4] In fact, Ethernet has already been replaced by a different technology with the same name — twice.
Once when coax was replaced with twisted pair, and a second time when gigabit Ethernet came in.
[4] 事实上,以太网已经被不同的技术替换了,尽管有相同的名字 — twice。
那是从coax被twisted pair(双绞线)替换,第二次是gigabit以太网到来。
``````````````````````````````````

One of the many consequences of the exponential power-versus-time curve in computing, and the corresponding pace of software development, is that 50% of what one knows becomes obsolete over every 18 months. Unix does not abolish this phenomenon, but does do a good job of containing it. There’s a bedrock of unchanging basics —languages, system calls, and tool invocations —that one can actually keep using for years, even decades. Elsewhere it is impossible to predict what will be stable; even entire operating systems cycle out of use. Under Unix, there is a fairly sharp distinction between transient knowledge and lasting knowledge, and one can know ahead of time (with about 90% certainty) which category something is likely to fall in when one learns it. Thus the loyalty Unix commands.
在众多的幂指数曲线的计算结果中,相应的软件开发步骤中,每18个月就有50%被淘汰。Unix在这个现象中没有被淘汰,相反却是一个好的成果被保留下来。有这样一个不变的基本根基 — 语言,系统调用,和工具 — 它将一直持续使用多年,甚至数十年。在别处,什么将稳定下来则是不可预测的;甚至整个操作系统循环不再被使用。在Unix下,有个相当明显的区分就是transient(短暂)知识和lasting(持久)知识,当一个人可以获得之前(大约90%可以)积累的一些东西,当一个人学习了它,它就象落叶一样沉淀下来。这就是Unix命令的忠实度。

Much of Unix’s stability and success has to be attributed to its inherent strengths, to design decisions Ken Thompson, Dennis Ritchie, Brian Kernighan, Doug McIlroy, Rob Pike and other early Unix developers made back at the beginning; decisions that have been proven sound over and over. But just as much is due to the design philosophy, art of programming, and technical culture that grew up around Unix in the early days. This tradition has continuously and successfully propagated itself in symbiosis with Unix ever since.
大部分Unix的稳定和成功,不得不归功于它固有的强壮,有关设计决策(感谢:elife的更正),Ken Thompson, Dennis Ritchie, Brian Kernighan, Doug McIlroy, Rob Pike和其他早期的Unix开发者一开始就已经被确定;并得到一遍遍反复地论证。不仅这些,关于设计思想,编程艺术,技术文化等,在Unix的早期日子里已经围绕其成长了。这个传统自那时起,就已经不断地成功地与Unix一起繁殖壮大。

.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
! The Case against Learning Unix Culture  !
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 67
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 67
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值