Библиотека сайта rus-linux.net
Copyright ╘ 2003 Eric S. Raymond
This book and its on-line version are distributed under the terms of the Creative Commons Attribution-NoDerivs 1.0 license, with the additional proviso that the right to publish it on paper for sale or other for-profit use is reserved to Pearson Education, Inc. A reference copy of this license may be found at http://creativecommons.org/licenses/by-nd/1.0/legalcode.
The photograph of Ken and Dennis in Chapter═2 appears courtesy of Bell Labs/Lucent Technologies.
The epigraph on the Portability chapter is from the Bell System Technical Journal, v57 #6 part 2 (July-Aug. 1978) pp. 2021-2048 and is reproduced with the permission of Bell Labs/Lucent Technologies.
|Revision 0.95||5 August 2003||esr|
|Revision 0.94||31 July 2003||esr|
|Incorporates proofreader fixes.|
|Revision 0.93||29 July 2003||esr|
|More minor corrections and typo fixes.|
|Revision 0.92||21 July 2003||esr|
|Minor corrections and typo fixes.|
|Revision 0.91||17 July 2003||esr|
|Factual correction about VM/CMS; a bit more about C++.|
|Revision 0.91||14 July 2003||esr|
|Reformat displays to fit 70-character width.|
|Revision 0.90||7 July 2003||esr|
|Freeze for production.|
|Revision 0.87||30 June 2003||esr|
|Kirk McKusick contributed a summation of the BSD lawsuit.|
|Revision 0.86||26 June 2003||esr|
|Revision 0.85||24 June 2003||esr|
|Review and cameos from Ken Thompson.|
|Revision 0.84||17 June 2003||esr|
|Final stuff from Steve Johnson. Fold in 0.83 copy edits.|
|Revision 0.83||15 June 2003||esr|
|Minor changes from work on Teaching Guide. Be systematic about compactness versus semi-compactness.|
|Revision 0.82||11 June 2003||esr|
|Steve Johnson's contributions.|
|Revision 0.81||6 June 2003||esr|
|Cross-reference and attribution markup fixes.|
|Revision 0.80||5 June 2003||esr|
|Merged in Chapter 7-20 copy edits.|
|Revision 0.74||30 May 2003||esr|
|Merged in Chapter 1-6 copy edits.|
|Revision 0.73||28 May 2003||esr|
|Added discussion of Plan 9 in the Futures chapter.|
|Revision 0.72||26 May 2003||esr|
|Revision 0.71||19 May 2003||esr|
|Cathy is up to Chapter 5, Henry Spencer to Chapter 11.|
|Revision 0.70||17 May 2003||esr|
|Two new diagrams in Contrasts and Complexity. Rob Landley's review pass is done. Contributions by Stuart Feldman and Mike Lesk. Bibliography has been consistency-checked.|
|Revision 0.67||12 May 2003||esr|
|WWW is an example of New Jersey thinking applied to hypertext. Revisions to Languages chapter.|
|Revision 0.66||11 May 2003||esr|
|Cameo quote from Brian Kernighan. Various minor corrections.|
|Revision 0.65||9 May 2003||esr|
|New section on `Worse is Better' in the compexity chapter. Henry Spencer's review pass is up to Chapter 8.|
|Revision 0.64||8 May 2003||esr|
|Folded in suggestions from Brian Kernighan.|
|Revision 0.63||7 May 2003||esr|
|Typo fixes. Fold in Chapter 1 through 8 comments from Ken Arnold,|
|Revision 0.62||1 May 2003||esr|
|Fold in Chapter 1 and 2 comments from Henry Spencer.|
|Revision 0.61||29 Apr 2003||esr|
|Added reference for claim about DARPA valuing BSD open source in History chapter. Minor corrections to Complexity chapter.|
|Revision 0.60||28 Apr 2003||esr|
|Regexp discussion moves to Minilanguages; Yacc and Lex moved to Tools. Added case study on statistical spam filtering. More on strategies for reducing latency in the Optimization chapter.|
|Revision 0.58||25 Apr 2003||esr|
|End of second editing pass.|
|Revision 0.57||21 Apr 2003||esr|
|Replaced httpget case study with blq. Folded in review comments and quotes by David Korn.|
|Revision 0.56||20 Apr 2003||esr|
|Fold in Ken Arnold's comments. New section (inspired by Doug McIlroy) in the Modularity chapter, "Compactness and the strong single center".|
|Revision 0.55||17 Apr 2003||esr|
|Slim down the Context section. Some corrections to C history from dmr. Quotes from Keith Packard and Jim Gettys. OpenOffice.org uses zip(1), not gzip(1). More on the Rule of Extensibility.|
|Revision 0.54||10 Apr 2003||esr|
|Better description of common vs. def-ref linkage in C. Incorporated Doug McIlroy's second round of comments. Added case study of VM/CMS to Contrasts.|
|Revision 0.53||7 Apr 2003||esr|
|Note on the Javs CLASSPATH problem. URLs are derivative of Unix filenames. Scotch an urban legend about C's ++. Added case study of Wily and more analysis to the Complexity chapter.|
|Revision 0.52||3 Apr 2003||esr|
|Correction from Dennis Ritchie for the Portability epigraph. Various typo fixes.|
|Revision 0.51||2 Apr 2003||esr|
|Dates and attributions for most of the epigraphs added. Typo fixes.|
|Revision 0.5||2 Apr 2003||esr|
|New chapter on Complexity, after Interface; expands on and replaces the Tools chapter discussion of whether Emacs is an argument against the Unix philosophy. Fetchmail as a study in why pipelines aren't enough. SVr4 IPC is obsolete, but it turns out SVr4 shared memory is not.|
|Revision 0.46||30 Mar 2003||esr|
|Folded in advice and quotes from Doug McIlroy.|
|Revision 0.45||18 Mar 2003||esr|
|More typo fixes. Note that documentation-format problems are on their way to being solved at the user-presentation level by "everything is HTML, every reference is a URL". Substantially rewritten and expanded material on user environment variables. More on the implicit sociology of version-control systems. Chapters on Transparency and Multiprogramming swapped.|
|Revision 0.44||11 Mar 2003||esr|
|More on multitasking in the Contrasts chapter. Many typo fixes.|
|Revision 0.43||6 Mar 2003||esr|
|Added MVS case study to Contrasts chapter. "No junk, no confusion." in the Modularity chapter. New section on the pros and cons of compression in Textuality.|
|Revision 0.42||12 February 2003||esr|
|Add fcntl/ioctl to things Unix got wrong.|
|Revision 0.41||11 February 2003||esr|
|Corrections and additions to MacOS case study. A bit more about binary files as caches. Added cite of Butler Lampson. Additions to history chapter. Note in futures chapter about C and exceptions. Many typo fixes.|
|Revision 0.4||5 February 2003||esr|
|Release for public review.|
|Revision 0.3||22 January 2003||esr|
|First eighteen-chapter draft. Manuscript walkthrough at Chapter 12. Limited release for early reviewers.|
|Revision 0.2||2 January 2003||esr|
|First manuscript walkthrough at Chapter 7. Released to Dmitry Kirsanov at AW production.|
|Revision 0.1||16 November 2002||esr|
|First DocBook draft, fifteen chapters. Languages rewritten to incorporate lots of feedback. Transparency, Modularity, Multiprogramming, Configuration, Interfaces, Documentation, and Open Source chapters released. Shipped to Mark Taub at AW.|
|Public HTML draft, first four chapters only.|
To Ken Thompson and Dennis Ritchie, because you inspired me.
Table of Contents
- I. Context
- 1. Philosophy
- Culture? What Culture?
- The Durability of Unix
- The Case against Learning Unix Culture
- What Unix Gets Wrong
- What Unix Gets Right
- Basics of the Unix Philosophy
- Rule of Modularity: Write simple parts connected by clean interfaces.
- Rule of Clarity: Clarity is better than cleverness.
- Rule of Composition: Design programs to be connected with other programs.
- Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
- Rule of Simplicity: Design for simplicity; add complexity only where you must.
- Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
- Rule of Transparency: Design for visibility to make inspection and debugging easier.
- Rule of Robustness: Robustness is the child of═transparency and simplicity.
- Rule of Representation: Fold knowledge into data, so═program logic can be stupid and robust.
- Rule of Least Surprise: In interface design, always do the═least surprising thing.
- Rule of Silence: When a program has nothing surprising to say, it should say nothing.
- Rule of Repair: Repair what you can — but when you must fail, fail noisily and as soon as possible.
- Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
- Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
- Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
- Rule of Diversity: Distrust all claims for one true way.
- Rule of Extensibility: Design for the future, because it will be here sooner than you think.
- The Unix Philosophy in One Lesson
- Applying the Unix Philosophy
- Attitude Matters Too
- 2. History
- Origins and History of Unix, 1969-1995
- Origins and History of the Hackers, 1961-1995
- The Open-Source Movement: 1998 and Onward
- The Lessons of Unix History
- 3. Contrasts
- The Elements of Operating-System Style
- Operating-System Comparisons
- What Goes Around, Comes Around
- II. Design
- 4. Modularity
- Encapsulation and Optimal Module Size
- Compactness and Orthogonality
- Software Is a Many-Layered Thing
- Unix and Object-Oriented Languages
- Coding for Modularity
- 5. Textuality
- The Importance of Being Textual
- Data File Metaformats
- Application Protocol Design
- Application Protocol Metaformats
- 6. Transparency
- Studying Cases
- Designing for Transparency and Discoverability
- Designing for Maintainability
- 7. Multiprogramming
- Separating Complexity Control from Performance Tuning
- Taxonomy of Unix IPC Methods
- Problems and Methods to Avoid
- Process Partitioning at the Design Level
- 8. Minilanguages
- Understanding the Taxonomy of Languages
- Applying Minilanguages
- Designing Minilanguages
- 9. Generation
- 10. Configuration
- What Should Be Configurable?
- Where Configurations Live
- Run-Control Files
- Environment Variables
- Command-Line Options
- How to Choose among the Methods
- On Breaking These Rules
- 11. Interfaces
- Applying the Rule of Least Surprise
- History of Interface Design on Unix
- Evaluating Interface Designs
- Tradeoffs between CLI and Visual Interfaces
- Transparency, Expressiveness, and Configurability
- Unix Interface Design Patterns
- Applying Unix Interface-Design Patterns
- The Web Browser as a Universal Front End
- Silence Is Golden
- 12. Optimization
- 13. Complexity
- Speaking of Complexity
- A Tale of Five Editors
- The Right Size for an Editor
- The Right Size of Software
- III. Implementation
- 14. Languages
- 15. Tools
- A Developer-Friendly Operating System
- Choosing an Editor
- Special-Purpose Code Generators
- make: Automating Your Recipes
- Version-Control Systems
- Runtime Debugging
- Combining Tools with Emacs
- 16. Reuse
- IV. Community
- 17. Portability
- Evolution of C
- Unix Standards
- IETF and the RFC Standards Process
- Specifications as DNA, Code as RNA
- Programming for Portability
- Portability, Open Standards, and Open Source
- 18. Documentation
- Documentation Concepts
- The Unix Style
- The Zoo of Unix Documentation Formats
- The Present Chaos and a Possible Way Out
- Best Practices for Writing Unix Documentation
- 19. Open Source
- Unix and Open Source
- Best Practices for Working with Open-Source Developers
- The Logic of Licenses: How to Pick One
- Why You Should Use a Standard License
- Varieties of Open-Source Licensing
- 20. Futures
- Essence and Accident in Unix Tradition
- Plan 9: The Way the Future Was
- Problems in the Design of Unix
- A Unix File Is Just a Big Bag of Bytes
- Unix Support for GUIs Is Weak
- File Deletion Is Forever
- Unix Assumes a Static File System
- The Design of Job Control Was Badly Botched
- The Unix API Doesn't Use Exceptions
- ioctl2 and fcntl2 Are an Embarrassment
- The Unix Security Model May Be Too Primitive
- Unix Has Too Many Different Kinds of Names
- File Systems Might Be Considered Harmful
- Towards a Global Internet Address Space
- Problems in the Environment of Unix
- Problems in the Culture of Unix
- Reasons to Believe
- A. Glossary of Abbreviations
- B. References
- C. Contributors
- D. Rootless Root
- Editor's Introduction
- Master Foo and the Ten Thousand Lines
- Master Foo and the Script Kiddie
- Master Foo Discourses on the Two Paths
- Master Foo and the Methodologist
- Master Foo Discourses on the Graphical User Interface
- Master Foo and the Unix Zealot
- Master Foo Discourses on the Unix-Nature
- Master Foo and the End User
List of Figures
- 2.1. The PDP-7.
- 3.1. Schematic history of timesharing.
- 4.1. Qualitative plot of defect count and density vs. module size.
- 4.2. Caller/callee relationships in GIMP with a plugin loaded.
- 6.1. Screen shot of audacity.
- 6.2. Screen shot of kmail.
- 6.3. Main window of a Freeciv game.
- 8.1. Taxonomy of languages.
- 11.1. The xcalc GUI.
- 11.2. Screen shot of the original Rogue game.
- 11.3. The Xcdroast GUI.
- 11.4. Caller/callee relationships in a polyvalent program.
- 13.1. Sources and kinds of complexity.
- 18.1. Processing structural documents.
- 18.2. Present-day XML-DocBook toolchain.
- 18.3. Future XML-DocBook toolchain with FOP.
List of Tables
List of Examples
- 5.1. Password file example.
- 5.2. A .newsrc example.
- 5.3. A fortune file example.
- 5.4. Basic data for three planets in a record-jar format.
- 5.5. An XML example.
- 5.6. A .INI file example.
- 5.7. An SMTP session example.
- 5.8. A POP3 example session.
- 5.9. An IMAP session example.
- 6.1. An example fetchmail -v transcript.
- 6.2. An SNG Example.
- 7.1. The pic2graph pipeline.
- 8.1. Glade Hello, World.
- 8.2. A sample m4 macro.
- 8.3. A sample XSLT program.
- 8.4. Taxonomy of languages — the pic source.
- 8.5. Synthetic example of a fetchmailrc.
- 8.6. RSA implementation using dc.
- 9.1. Example of fetchmailrc syntax.
- 9.2. Python structure dump of a fetchmail configuration.
- 9.3. copy_instance metaclass code.
- 9.4. Calling context for copy_instance.
- 9.5. ascii usage screen.
- 9.6. Desired output format for the star table.
- 9.7. Master form of the star table.
- 10.1. A .netrc example.
- 10.2. X configuration example.
- 18.1. groff1 markup example.
- 18.2. man markup example.
- 19.1. tar archive maker production.