• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            CG@CPPBLOG

            /*=========================================*/
            隨筆 - 76, 文章 - 39, 評論 - 137, 引用 - 0
            數(shù)據(jù)加載中……

            《Unix程序設(shè)計(jì)藝術(shù)》前言

            Preface

            前言

             

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

            --Neal Stephenson

            與其說Unix是個(gè)操作系統(tǒng),不如說是一部口述史。

            ——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.

            “知”(書本知識)與“識”(專業(yè)的技術(shù)經(jīng)驗(yàn))有著天壤之別。“知”使你以推理演繹出正確之事物;“識”則使你幾乎無須下意識的去思考,就得出正確結(jié)論,好象條件反射一樣。雖然本書中寫滿了“知”,但這些卻都關(guān)乎于“識”。它將試圖傳授你有關(guān)Unix開發(fā)之事物,這些雖為Unix專家所知曉,但他們卻未意識到自己知道。故此,較之大多數(shù)Unix書籍,本書寡談?dòng)诩夹g(shù),而偏多于共享文化——包涵其外在與內(nèi)在之文化,以及有意與無意造成之習(xí)俗。所以說,這不是本關(guān)于“如何”的書,而是本關(guān)于“為何”的書。

             

            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.

            因?yàn)樘嘬浖O(shè)計(jì)之拙劣,故“為何”有著巨大實(shí)用價(jià)值。那些大多遭受注水般填塞折磨的軟件,極難以維護(hù),倘若欲移植到新平臺,或以原作者未曾預(yù)計(jì)之方向擴(kuò)展,皆非常之難。這些問題均為不良設(shè)計(jì)之病象。我們希望本書讀者能學(xué)到Unix以其所具有之良好設(shè)計(jì)所傳授給你的東西。

             

            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.

            本書分為四部分:背景、設(shè)計(jì)、工具和社團(tuán)。第一部分(背景)是哲學(xué)和歷史,為隨后部分提供基礎(chǔ)和動(dòng)機(jī)。第二部分(設(shè)計(jì))深入剖析Unix哲學(xué)原理,一直到得出與設(shè)計(jì)和實(shí)現(xiàn)有關(guān)的明確指點(diǎn)。第三部分(工具)著眼于Unix提供給你以助于解決問題的軟件。第四部分(社團(tuán))介紹人際間的交流和約定,正如它們做出的那樣,這些使Unix文化產(chǎn)生了非常深遠(yuǎn)的影響。

             

            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.

            因?yàn)檫@是一本關(guān)于共享文化的書,所以我從未想過獨(dú)自去完成它。你應(yīng)該會(huì)發(fā)現(xiàn)書中包括一些由杰出的Unix開發(fā)者和Unix習(xí)俗締造者所寫的客串文章。在我邀請這些博學(xué)的人來評論和爭辯書中文字時(shí),本書也經(jīng)歷了一次廣泛的公眾審閱過程。與其在成書時(shí),將這評論的過程掩去,不如讓這些佳賓說出自己的聲音,雖然于本書主旨,可能使其充實(shí),可能使其延伸,甚至也可能與其偏離。

             

            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.

            在本書中,當(dāng)我用“我們”的口吻時(shí),不是我想裝成全知全能的上帝,而是想表達(dá)一個(gè)事實(shí),它正努力成為整個(gè)社團(tuán)的“識”。

             

            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.

            因?yàn)楸緯淖谥际莻鞑ノ幕暂^之那些正經(jīng)的技術(shù)書籍,講了更多的歷史傳說以及題外話。好好享受吧,這些也是培養(yǎng)你成為Unix程序員的一部分。整個(gè)偉大的歷史是由那些細(xì)枝末節(jié)的事情組成的。我們認(rèn)為這種方式會(huì)使故事更有趣。更重要的是,明白了Unix從哪里來以及如何踏上這條路,會(huì)助你培養(yǎng)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.

            出 于同樣的原因,我們也不愿把歷史寫成好像已經(jīng)結(jié)束了似的。你會(huì)發(fā)現(xiàn)在這本書中有非常多的地方指出了寫作的時(shí)間。我們不希望把當(dāng)前的慣例說成永恒真理之一, 并且是命中注定。指明寫作的時(shí)間意味著,對讀者來說,這是一個(gè)警告。兩年、三年抑或五年之后,這個(gè)情況的相關(guān)陳述可能已經(jīng)過時(shí),而且你要加倍小心。

             

            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的參考,也不是一本網(wǎng)絡(luò)編程入門,更不是一本關(guān)于神秘的X的詳盡指南,當(dāng)然也不是一個(gè)Unix內(nèi)核和架構(gòu)的導(dǎo)讀。其它書籍更好的覆蓋了這些細(xì)節(jié),本書會(huì)在適當(dāng)?shù)臅r(shí)候把它們指給你。

             

            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.

            在所有這些技術(shù)細(xì)節(jié)之外,Unix文化有著一個(gè)傳統(tǒng),毫不夸張的講,這個(gè)傳統(tǒng)已經(jīng)以嫻熟之努力發(fā)展了數(shù)百萬人年[1]。力求讓你理解這個(gè)傳統(tǒng),并把它那種設(shè)計(jì)模式添入你的工具箱中,以助你成為一個(gè)優(yōu)秀的程序員和設(shè)計(jì)師,是本書寫作的信念。

             

            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.

            民眾造就文化,習(xí)慣上,我們從傳說中和他人那里學(xué)習(xí)Unix文化,這種學(xué)習(xí)是潛移默化的。本書不是一個(gè)人際文化交流的替代品,但它允許你分享他人的經(jīng)驗(yàn),以助于加快這個(gè)過程。

             

            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.

            如果你是一個(gè)富有經(jīng)驗(yàn)的Unix程序員,經(jīng)常出現(xiàn)在那些指點(diǎn)新手程序員的地方,或者你時(shí)常和其他派系的操作系統(tǒng)支持者爭辯,卻苦于無法把和Unix類似系統(tǒng)的優(yōu)點(diǎn)講清楚,那么,你應(yīng)該讀這本書。

             

            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.

            如果你曾經(jīng)是一個(gè)在其他操作系統(tǒng)上有經(jīng)驗(yàn)的CC++或者Java程序員,而你又準(zhǔn)備開始一個(gè)基于Unix的工程時(shí),你應(yīng)該讀這本書。

             

            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.

            如果你是一個(gè)從新手向中級水平邁進(jìn)的Unix操作系統(tǒng)使用者,但有一點(diǎn)點(diǎn)開發(fā)經(jīng)驗(yàn),又想學(xué)習(xí)如何在Unix下有效的設(shè)計(jì)軟件,那么你應(yīng)該讀這本書。

             

            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.

            如果你是一個(gè)領(lǐng)悟到可能從Unix傳統(tǒng)中受益的非Unix程序員,你應(yīng)該讀這本書。我們相信你是對的,因?yàn)?/span>Unix哲學(xué)可以應(yīng)用到其它操作系統(tǒng)中去。故此不象一本普通的Unix書籍,我們對非Unix環(huán)境(尤其是微軟的操作系統(tǒng))投以更多的關(guān)注。并且當(dāng)工具和實(shí)例研究是可移植時(shí),我們也會(huì)指出。

             

            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.

            如果你是一個(gè)應(yīng)用程序架構(gòu)師,正在考慮各種平臺,或者為主要的通用市場,不然就是縱向應(yīng)用選擇不同的實(shí)現(xiàn)策略時(shí),你應(yīng)該讀這本書,它會(huì)助你了解Unix作為一個(gè)開發(fā)平臺的實(shí)力,以及把開源作為開發(fā)方法的Unix傳統(tǒng)。

             

            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).

            如果你正在找一本,關(guān)于C編碼細(xì)節(jié)或者如何使用Unix內(nèi)核API的書,那么你不應(yīng)該讀這本書。在這些方面有太多的好書,《Unix環(huán)境下高級編程》[Stevens92]是一本在Unix API之間歷險(xiǎn)的經(jīng)典書籍,《程序設(shè)計(jì)實(shí)踐》[Kernighan-Pike99]也被所有C程序員作為推薦讀物(實(shí)際上,天下間程序員都應(yīng)該看)。

             

            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.

            這本書既關(guān)心實(shí)踐也關(guān)心哲學(xué)。它的一部分是格言和普適原理,其它部分則是分析在研究Unix發(fā)展中的特殊情況。通常在格言和普適原理之前或之后,我們將為它們舉出實(shí)例。這些實(shí)例不是從玩具程序中抽取出來的,而是從一些如今每天都在用的,可以真正運(yùn)行的代碼中抽取的。

             

            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.

            我 們盡量避免用大量的,像代碼或規(guī)范文件這樣的例子來填塞本書,雖然在很多地方這會(huì)使寫起來容易些(或許在某些地方更容易讀!)。許多與編程有關(guān)的書籍給出 了大量低水平的細(xì)節(jié)和例子,而想這樣讓讀者對實(shí)際的后續(xù)部分有一個(gè)高層次的認(rèn)識,無疑是失敗的。我們反其道行之,哪怕步入歧途。

             

            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.

            所以,當(dāng)你需要經(jīng)常性的閱讀代碼和規(guī)范文件時(shí),相關(guān)部分通常很少會(huì)包含在書中。相反,我們會(huì)在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.

            理解這些例子會(huì)幫助你鞏固你所學(xué)到的原理,并把它們變成你工作時(shí)的一種近乎于本能的知識。比較理想的是,在你讀這本書時(shí),你旁邊有一個(gè)運(yùn)行Unix的終端,以及一個(gè)唾手可得的Web瀏覽器。任何的Unix都可以,但是在一個(gè)Linux系統(tǒng)中,你應(yīng)該檢查我們用于實(shí)例研究的軟件是否已經(jīng)預(yù)先安裝好,并且馬上可以用。當(dāng)需要你上網(wǎng)查閱或者做實(shí)驗(yàn)時(shí),我們會(huì)給你指出。這些把你像神游一樣的指向它處的說明是順暢的,絲毫不會(huì)打斷你原本進(jìn)行的閱讀。

             

            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.

            注意:雖然我們盡力去引用穩(wěn)定和可用的URL,但我們無法保證這一點(diǎn)。如果你發(fā)現(xiàn)一個(gè)我們引用的鏈接失效了,那么,像平時(shí)一樣,在你喜歡的Web搜索引擎上做一個(gè)短語搜索。以這種辦法得到的結(jié)果應(yīng)該和我們引用的URL差不多。

             

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

            本書中的大多縮略詞在首次使用時(shí)是以完整形式出現(xiàn)的。為了方便起見,我們在附錄也提供了一個(gè)術(shù)語表。

             

            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.

            參考資料通常以作者姓名排序。那幾個(gè)有限的腳注都是些本應(yīng)加入正文或者容易失效的URL,以及一些題外話,戰(zhàn)爭故事,還有笑話[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.

            為了使幾乎不懂技術(shù)的讀者能理解這本書,我們邀請了一些不是程序員的人來讀這本書,以便找出那些在敘述過程中必需的,但是有些晦澀的術(shù)語。我們也把一些基本術(shù)語的解釋放入了腳注,雖然對有經(jīng)驗(yàn)程序員可能不需要。

             

            Related References

            相關(guān)參考資料

             

            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.

            以前,在涉足這個(gè)領(lǐng)域的少數(shù)Unix早期開發(fā)者所著的書和著名論文中,KernighanPike的《Unix編程環(huán)境》[Kernighan-Pike84]脫穎而出,成為了一本經(jīng)典著作。但是今天它看起來有點(diǎn)陳舊了,它沒有包含InternetWorld Wide Web,也沒有預(yù)見到如今的解釋語言浪潮,好象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哲學(xué)》[Gancarz]。它是這個(gè)領(lǐng)域里一本極好的書。但是它沒有涵蓋這個(gè)主題的所有延伸范圍,而這卻是我們認(rèn)為也應(yīng)該去寫的。不過,我們?nèi)匀灰兄x作者,關(guān)于那些已經(jīng)非常穩(wěn)定和成熟,可又十分樸素的Unix設(shè)計(jì)模式,作者給了我們很多提示。

             

            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.

            《注重實(shí)效的程序員》(又譯《程序員修煉之道》)[Hunt-Thomas]是一本詼諧和睿智的專題集,談?wù)摿己玫淖⒅貙?shí)效的設(shè)計(jì),著眼于軟件設(shè)計(jì)工藝(更多關(guān)注編碼,而不是較高層次上的問題劃分)的不同層次。作者的哲學(xué)來自于Unix上的經(jīng)驗(yàn),是本書的一個(gè)極好的補(bǔ)充。

             

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

            《程序設(shè)計(jì)實(shí)踐》[Kernighan-Pike99]關(guān)注的范圍和《注重實(shí)效的程序員》相同,但在Unix傳統(tǒng)方面更深入。

             

            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.

            最后(毫無疑問那會(huì)招來憤怒),我們推薦《Zen Flesh, Zen Bones[Reps-Senzaki], 這是一個(gè)佛教禪宗入門資料的重要收錄集,對禪宗的引證遍及這本書的各處。之所以在這里包括這本書,是因?yàn)樵跒槟切浖O(shè)計(jì)產(chǎn)生了非常重要的,但同時(shí)又難 以領(lǐng)悟的思想取名時(shí),禪宗給我們提供了一個(gè)詞匯表。有宗教信仰的讀者可以把禪宗作為一個(gè)改善智力的訓(xùn)練方式,而不是把它作為一種宗教來看——從純粹的無神 論角度來看,禪宗也的確是這樣的。

             

            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.

            從技術(shù)以及法律上來說,術(shù)語“UNIX”是屬于Open Group的商標(biāo),而且它要能夠通過Open Group的符合標(biāo)準(zhǔn)的精心測試,這樣的操作系統(tǒng)才能正式使用這個(gè)名稱。在這本書中,我們所談及的“UNIX”范圍比較寬泛,我們指的是通常程序員們指的那些操作系統(tǒng)(不管有沒有被正式地打上“UNIX”標(biāo)志),它可能衍生于貝爾實(shí)驗(yàn)室的那個(gè)UNIX始祖的源代碼,也可能是那些被寫的象UNIX后代的仿造品。特別地,在這個(gè)定義下,Linux(大多數(shù)我們引用的例子都來自于它)也是一個(gè)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).

            在標(biāo)記Unix工具時(shí),這本書采用了Unix手冊頁的習(xí)俗。在我們想強(qiáng)調(diào)的Unix命令首次出現(xiàn)時(shí),我們在其后的圓括號里加上了手冊頁的章節(jié)。例如,當(dāng)看到“munger(1)”時(shí),那就表示“程序munger,如果你的系統(tǒng)提供的話,它的文檔在Unix手冊頁的第一部分(用戶工具)里”。第二部分是C系統(tǒng)調(diào)用,第三部分是C函數(shù)庫調(diào)用,第五部分是文件格式和協(xié)議,第八部分是系統(tǒng)管理員工具。對于各種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.

            有些時(shí)候,我們提到一個(gè)Unix應(yīng)用程序(例如Emacs)時(shí)卻沒有帶手冊頁章節(jié)后綴,并且首字母是大寫。這表明這個(gè)名字在這里,實(shí)際上描述一個(gè)本質(zhì)上有著相同功能的,已經(jīng)被確定好的Unix程序家族。這時(shí)我們只討論它們的共有的性質(zhì)。例如,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.

            在本書隨后的不同地方,我們會(huì)提到“舊學(xué)派”和“新學(xué)派”方法。大約在1990年,伴隨著rap音樂,新學(xué)派出現(xiàn)了,它的出現(xiàn)和當(dāng)時(shí)腳本語言,GUI,開源Unix以及Web的興起有關(guān)。舊學(xué)派指的1990年以前(尤其是1985年以前)的學(xué)術(shù)界,那些人用著昂貴(共享)的計(jì)算機(jī),私有的Unixshell下的腳本以及無處不在的C。這個(gè)差異絕對值得指出,因?yàn)榱畠r(jià)以及幾乎沒有內(nèi)存限制的機(jī)器使得Unix編程風(fēng)格發(fā)生了重大的改變。

             

            Our Case Studies

            我們的實(shí)例研究

             

            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:

            大多數(shù)關(guān)于編程的書都依靠一些特別創(chuàng)建的玩具例子來證明一個(gè)觀點(diǎn),本書卻不想這樣。我們學(xué)習(xí)的例子是真實(shí)的,是我們每天都在使用的成品軟件的一部分。下面是主要的幾個(gè):

             

            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 這兩個(gè)單獨(dú)的項(xiàng)目通常被放在一起。Cdrtools包是一套刻錄CD-ROMCLI工具集。可以在Web上搜索一下“cdtools”。xcdroast是為cdrtools寫的一個(gè)GUI前端應(yīng)用程序。參見xcdroast項(xiàng)目站點(diǎn)[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是一個(gè)使用POP3或者IMAP郵件傳輸協(xié)議,從遠(yuǎn)程郵件服務(wù)器上獲取郵件的程序。參見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圖象處理程序)是一個(gè)全功能的繪圖和圖象處理程序,它以精巧的方式編輯各種不同的圖象格式。從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郵件用戶代理程序是當(dāng)前最好的一個(gè)。它對于MIMEMultipurpose Internet Mail Extensions)以及諸如PGPPretty Good Privacy)和GPGGNU Privacy Guard)這樣的加密功能支持的非常好。在Mutt工程的站點(diǎn)[http://www.mutt.org]上,可以找到可用的源代碼和可執(zhí)行二進(jìn)制文件。

             

            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文檔轉(zhuǎn)換成不同的格式,包括HTML、文本文件以及PostScript。在xmlto工程站點(diǎn)上可以找到源代碼和文檔[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.

            為了盡量減少需要讀者去讀的代碼以及去理解的例子的數(shù)量,我們嘗試去挑選可以反復(fù)使用的例子來研究,以求完美地說明那幾個(gè)不同的設(shè)計(jì)原則和慣例。出于同樣的原因,許多例子來自我的工程。這并非暗示它們是最好的,只不過我覺得我對它們很熟悉,這會(huì)對各種目的的解釋有幫助。

             

            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)為這本書增添了許多有價(jià)值的文章。特別是Doug McIlroy,他深刻的批評和極具深度的文章,遠(yuǎn)遠(yuǎn)超出了我邀請他時(shí)給出的任務(wù),象三十年前管理最初的Unix研發(fā)組那樣,他給予了同樣的關(guān)注和奉獻(xiàn)。

             

            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,他們均對本書的原稿逐行閱讀,并做出了深入的評價(jià)。Rob深刻且專注的評論比這最終手稿的一整章更令人激動(dòng),他在全文表述的組織和范圍方面作了大量的工作,如果所有推動(dòng)我改進(jìn)的文字全由他來撰寫,那我就不得不稱他為合著者。Cathy是我的試驗(yàn)聽眾,代表了非技術(shù)讀者。為了拓展這本書的范圍,讓那些還不是程序員的人接受,有大量的工作要她去做。

             

            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啟發(fā)了我對線程的領(lǐng)悟。John Cowan對接口設(shè)計(jì)模式提供了一些見解,并為wilyVM/CMS的學(xué)習(xí)提供了實(shí)例。Jef Raskin向我說明了最小詫異原理是從哪里來的。UIUC系統(tǒng)架構(gòu)小組對最初章節(jié)提供了有用的反饋。像“Unix之過”和“深入理解適應(yīng)性”這樣的章節(jié),其靈感就直接來源于他們的審閱。Russell J. Nelson為第7章的伯恩斯坦鏈表提供了材料。Jay Maynard為第3章中MVS的學(xué)習(xí)實(shí)例提供了大量的材料。在“語言”一章中,Les Hatton提供了許多有幫助的注解,并且促成了第4章關(guān)于最佳模塊尺寸的那部分。David A. Wheeler提供了許多有見地的批評和學(xué)習(xí)實(shí)例的資料,特別是在“設(shè)計(jì)”這部分。Russ Cox審定了本書第9次修改的計(jì)劃。Dennis Ritchie糾正了我在C的歷史上的一些觀點(diǎn)。

             

            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程序員提供了建議和注解,很遺憾這里不能一一列出。像往常一樣,我發(fā)現(xiàn)這種在Web上公開的同行審閱充滿了有趣的挑戰(zhàn)和獎(jiǎng)賞。也是像往常一樣,最終著作中出現(xiàn)任何錯(cuò)誤的責(zé)任都留給了我。

             

            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.

            本書的說明風(fēng)格以及關(guān)注點(diǎn)都受到了設(shè)計(jì)模式運(yùn)動(dòng)的影響。實(shí)際上,我曾經(jīng)賣弄的想把這本書命名為“Unix設(shè)計(jì)模式”。最終我沒有如此做,因?yàn)閷@場運(yùn)動(dòng)中的某些隱含的中心教義,我并不茍同。我并不覺得所有都需要使用它的索引形式,也不準(zhǔn)備承擔(dān)這種文化帶來的負(fù)累。然而,我的方式當(dāng)然受到了Christopher Alexander著作[3]的影響(尤其是《建筑的永恒之道》和《模式語言》,在此我要感謝“四人幫”和他們學(xué)派的其他成員,感謝他們向我展示了如何用Alexander的觀點(diǎn),在相當(dāng)高的層次上討論軟件設(shè)計(jì)的可能性,而且沒有含混不請的言語和無用的概括。感興趣的讀者若想了解設(shè)計(jì)模式,應(yīng)該看看《設(shè)計(jì)模式——可復(fù)用的面向?qū)ο筌浖A(chǔ)》[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.

            當(dāng)然,本書的書名借鑒了Donald Knuth的《計(jì)算機(jī)編程藝術(shù)》。雖然它和Unix傳統(tǒng)無明顯的關(guān)聯(lián),但Knuth的確已經(jīng)影響了我們每個(gè)人。

             

            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就是這樣一個(gè)人。他看到了一個(gè)停工項(xiàng)目的價(jià)值,并且巧妙的推動(dòng)我去完成它。文字編輯應(yīng)該極不平常,他要能夠欣賞散文風(fēng)格,并有足夠的能力去改善那些文字,也許他們看起來并不象,但Mary Lou Nohr做到了這種水平。對于封面,Jerry Votta領(lǐng)會(huì)了我的想法,并且做的比我想象的要好。在使這本書盡可能毫無痛楚的編寫和出版的過程中,Prentice出版社的全體人員做的很好。他們很愉快的接納了我古怪的操控傾向,這些不僅表現(xiàn)在文字上,而且深入到書籍感官上的設(shè)計(jì),藝術(shù),以及市場運(yùn)作。

             

             



            [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年是一個(gè)很長的時(shí)間,這期間,在歷史的大浪中,涌現(xiàn)過多少Unix站點(diǎn),可能在世界范圍內(nèi)差不多已經(jīng)耗費(fèi)了五千萬人年。

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

            這個(gè)特殊的腳注獻(xiàn)給Terry Pratchet,他那腳注的用法實(shí)在是,恩,是太有趣了。

            [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著作的正確評價(jià),以及重要部分的在線版本鏈接,應(yīng)該可以在一些與Christopher Alexander有關(guān)的筆記中找到[http://www.math.utsa.edu/sphere/salingar/Chris.text.html]

            posted on 2007-12-17 23:44 cuigang 閱讀(488) 評論(0)  編輯 收藏 引用 所屬分類: 翻譯


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            91精品国产91热久久久久福利| 国产91久久综合| 天天爽天天狠久久久综合麻豆| 久久精品人人做人人爽电影蜜月| 色综合久久久久网| 中文精品久久久久人妻| 国产美女久久久| 久久精品国产男包| 国产2021久久精品| 久久天天躁狠狠躁夜夜躁2O2O| 国内精品久久久久国产盗摄| 少妇精品久久久一区二区三区| 品成人欧美大片久久国产欧美| 亚洲AV无码一区东京热久久| 久久播电影网| 东京热TOKYO综合久久精品| 亚洲精品无码久久不卡| 亚洲国产精品一区二区久久| 亚洲AV无码久久精品色欲 | 69SEX久久精品国产麻豆| 少妇被又大又粗又爽毛片久久黑人| AV狠狠色丁香婷婷综合久久| 久久久久久久久久久久久久| 人人狠狠综合88综合久久| 国产成人99久久亚洲综合精品| 久久精品人人做人人爽电影蜜月| 久久亚洲AV成人无码| 欧美久久一级内射wwwwww.| 94久久国产乱子伦精品免费| 国产精品免费福利久久| 亚洲精品无码久久久久| 色播久久人人爽人人爽人人片AV| 久久这里只有精品视频99| 精品久久久久久无码人妻热 | 久久亚洲精品人成综合网| 日韩电影久久久被窝网| 99久久精品国产一区二区| 亚洲国产精久久久久久久| 麻豆精品久久久一区二区| 久久婷婷综合中文字幕| 成人妇女免费播放久久久|