Reading 'The Art of UNIX Programming'.

The Art of Unix Programming Eric Steven Raymond著 立即下载

‘The Art of UNIX Programming'原版,人民邮电出版社 2006年8月第1版,本篇页码对照此版书籍

以下为阅读笔记,转载请注明出处

颜色说明:

黑色 -- Summary of the book

红色 -- Crob's comment

蓝色 -- Important summary

 

Chapter 1   Philosophy Matters

P13

More of the Unix philosophy was implied not by what these elders said
but by what they did and the example Unix itself set. Looking at the
whole, we can abstract the following ideas:

   1.Rule of Modularity: Write simple parts connected by clean interfaces.
   2.Rule of Clarity: Clarity is better than cleverness.
   3.Rule of Composition: Design programs to be connected to other programs.
   4.Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
   5.Rule of Simplicity: Design for simplicity; add complexity only where you must.
   6.Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will      7.Rule of Transparency: Design for visibility to make inspection and debugging easier.
   8.Rule of Robustness: Robustness is the child of transparency and simplicity.
   9.Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  10.Rule of Least Surprise: In interface design, always do the least surprising thing.
  11.Rule of Silence: When a program has nothing surprising to say, it should say nothing.
  12.Rule of Repair: When you must fail, fail noisily and as soon as possible.
  13.Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
  14.Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
  15.Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
  16.Rule of Diversity: Distrust all claims for “one true way”.
  17.Rule of Extensibility: Design for the future, because it will be here sooner than you think.

 

P14

Controlling complexity is the essense of computer programming.

 

P17

About excessive complexity comes from project requirements.......

Either way, everybody loses in the end.

The only way to avoid these traps is to encourage a software culture that knows that small is beautiful, that actively resists bloat and complexity: an engineering tradition that puts a high value on simple solutions, that looks for ways to break program systems up into small cooperatingpieces, and that reflexively fights attempts to gussy up programs with a lot of chrome (or even worse, to design programs around the chrome)

I think that's really a hard job to make chinese native customer knows 'the simple/small is beautiful'. But we have to do.  On the other hand, some pressure come from sales dept's requirements.

 

Chapter 2  History:A Tale of Two Cultures

 

Chapter  3 Contrasts:Compare the UNIX Philosophy with Others

P54

Multitasking Capability

1, Cooperative multitasking

2, Preemptive multitasking (UNIX)

 

Cooperating Process

Inexpensive process-spawning and easy inter-process communication(IPC) makes a whole ecology of small tools, pipes, and filters possible.

A subtle but important property of pipes and the other classic Unix IPC methods is that thay require communication between programs to be held down to a level of simplicity that encourages separationn of function. Conversely the result of having no equivalent of the pipe is that programs can only be designed to cooperate by build in full knowledge of each other's internals.

In the next piece of writing, the author figures the Microsoft programs do the converse way of UNIX.

 

P58

To design the perfect anti-Unix, make all file formats binary and opaque, and require heavyweight tools to read and edit them.

 

P61

Casual programming makes lower entry barrier to users/developers.

Operating system Comparisons

NT’s internal boundaries are extremely porous.

NT's CLI has become more and more neglected because the environment there is so sparse.

BeOS has astute design as UNIX but weak business strategy.

Linux does not include any code from the original Unix source tree, but it was designed from Unix standards to behave like a Unix.

The long-term goal of Linux is subsumption (emulating and absorbing)

 

Chapter 4 Modularity, Keep it Clean, Keep it Simple

P94

The Value of Detachment.

To design for compactness and orthogonality, start from zero.

It is well worth the mental effort to see how many preconceptions you can throw away, and whether the design becomes more compact and orthogonal as you do that. Possibilities for code reuse often result.

 

P99

Perfection is attained not when there is nothing more to add, but when there is nothing more to remove.

 

P103

Unix programmers know when not to use OO; and when they do use OO languages, they spend more effort on trying to keep their object designs uncluttered. As the author of The Elements of Networking Stype once observed in a slightly different context[Padlipsky]: “If you know what you're doing, three layers is enough; if you don't seventeen levels won't help".

 

Some questions to ask about any code you work on that might help you improve its modularity:

    How many global variables does it have? Global variables are modularity poison.......

    Is the size of your individual modules in Hatton's sweet spot? If no you may have a long-tern maintenance.

    Are the individual functions in your modules too large? If you can't describe a function's contract with its callers in one line, the function is probably too large.

   

P107

The Importance of Being Textual... there are good reasons the examples we'll see in Chapter7 are textual: reasons that hark back to Doug McIlroy's advice quoted in Chapter 1. Text streams are a valuable universal format because they're easy for human beings to read,write , and edit without specialized tools.

P109

Textual formats don't necessarily have much lower bit density than binary formats.

 

Chapter 5 Textuality

P120

Some rules about Unix textual file format conventions.

 

P131

Elegant code does much with little. Elegant code is not only correct but visibly, transparently correct.

Writing the code both transparency and discoverability will be hard to achieve.

 

Chapter 6 Transparency

P148

To design for transparency and discoverability, you need to apply every tactic for keeping your code simple, and also concentrate on the ways in which your code is a communication to other human beings.

......

These qualities in the human reaction to software are essential for reducing its bugginess and increasing its long-term maintainability.

 

Chapter 7 Multiprogramming

About IPC, IPC is attained through Pipeline, Wrappers, Slave Processes, Tempfiles, Signals, Sockets, Shared Memory

P180

Threads -- Thread or Menace ?

Why Threads Are a Bad Idea [Ousterhout96]

 

Chapter 8 Minilanguages

There are lots of bad reasons not to piggyback your imperative minilanguages on an existing scripting language. One of the few good ones is that you actually want to implement your own custom grammar for error checking...

These are reasons to use macro expansion with extreme caution. One of the long-term lessons of the Unix experience is that macros tend to create more problems than they solve. Modern languages and minilanguages designs have moved away from them.

 

Chapter 9 Generation

Data is more tractable than program logic.

It's good practice to move as much of the complexity in your design as possible away from procedural code and into data.

Data-Driven Programming...

 

Chapter 10 Configuration

.netrc, This kind of transprancy is important--much more important, actually, than the time economy of faster interpretion or the spce economy of a more compact and cryptic file format.

 

 

Chapter 11 Interface

The Rule of Least Surprise is a general principle in the design of all kinds of interfaces, not just software:"Do the least surprising thing". It's a consequence of the fact that human beings can only pay attention to one thing at one time(see The Humane Interface).)

P264

Unix programmers default toward making interfaces expressive and transparent, and are more willing to sacrifice ease to get these qualities.

P284

If your CLI program emits status messages to standard output, then programs that try to interpret that output will be put to the trouble of interpreting or discarding those messages. Better to send only real errors to standard error and not to emit unrequested data at all.

 

The user's vertical screen space is precious.

 

Junk messages are a careless waste of the human user's bandwidth.

 

In general, it's a bad style to tell the user things he already knows("Program is starting up...", or "Program is exiting" are two classic offenders).

 

If you want chatty progress messages for debugging purpose, disable them by default with a varbosity switch.


Chapter 12 Optimization

Premature optimization is the root of all evil.

Don't just do something, stand there!

But we always have to do optimization immidiately because of some pressure from picky customer.

 

When you have real-word evidence that your application is too slow, then (and only than) is the time to think about optimizing the code. Bet before you do more than think about optiomizing, measure.

Intuition is a poor guide to where the bottlenecks are.

 


Chapter 13 Languages

P323

C memory management is an enoumous source of complication and error. One study(cited in [Boehm]) estimates that 30% or 40% of development time is devoted to storage management for programs that manipulate complex data structure.  This did not even include the impact on debugging cost. While hard figures are lacking, many experienced programmers believe that memory-management bugs are the single largest source of persistent errors in real-world code.


Chapter 19 Open SOurce

P439

The rules of open-source development are simple.

1. Let the source be open.

2. Release early, release often.

3. Reward contribution with praise.


 

 


The Art of UNIX Programming-Addison-Wesley Professional (2003)Eric S. Raymond The Art of UNIX Programming-Addison-Wesley Professional (2003)作者Eric S. Raymond,epub电子书版 立即下载

相关推荐

The Art Of Unix Programming

The Art Of Unix Programming

The Art Of Unix Programming ---part 1

(i) Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features. (ii) Expect the output of every program to become the input to anot

learnboy007的专栏 766

The art of unix programming

从文化, 传统和设计的角度, 讲述unix和黑客的发展和设计思想

探索智慧的艺术:TAOUP——一个UNIX编程的灵感源泉

探索智慧的艺术:TAOUP——一个UNIX编程的灵感源泉 项目介绍 TAOUP(The Art of Unix Programming)是一个由Ruby驱动的程序,它将ANSI彩色的文字艺术带入你的终端,为你在登录时提供适时的智慧启示。这个项目不仅是一个个人收藏的智慧宝库,也欢迎社区的贡献和分享。 项目技术分析 该项目基于Ruby语言开发,利用ansi gem来实现终端中的颜色效果。通过简单的命令...

gitblog_00077的博客 567

UNIX编程艺术(The.Art.of.Unix.Programming)中英版

Unix编程艺术(The.Art.of.Unix.Programming)

pytorchDataLoader中调整数据长度不一致问题(lstm等)

数据长度不一致 用pytorch做rnn的时候,如果输入数据不一样长,可以用两种方式解决。 一种是自定义collate方法, #自定义collate_fn dataloader.DataLoader(dataset,4,True,collate_fn=my_collate) 然后里面写数据和标签载入方式即可 def my_collate(batch): data = [item[0] for item in batch] target = [item[1] for item in batc

weixin_48174100的博客 7776

好书推荐 The Art of Unix Programming

好书推荐 The Art of Unix Programming Eric Steven Raymond       esr@thyrsus.com 全文浏览:     http://www.faqs.org/docs/artu/index.html Preface Unix is not so much an operating system as an oral history.-- Neal

He Hao 的部落格 1227

01 AUTOSAR CP标准文档阅读指南

01 AUTOSAR CP标准文档阅读指南

汽车软件工程师 | 好奇博主 | 处女座 1142

摘自 unix编程艺术 《the art of unix programming》

这些富有哲理的原则决不是模糊笼统的泛泛之谈。 1,只要可行,一切都应该做成与来源和目标无关的过滤器。 2,数据流应尽可能文本化(这样可以使用标准工具来查看和过滤)。 3,数据库部署和应用协议应尽可能文本化(让人可以阅读和编辑)。 4,复杂的前端(用户界面)和后端应该泾渭分明。 5,如果可能,用c 编写前,先用解释性语言搭建原型。 6,当且仅当只用一门语言编程会提高程序复杂度时,混用语言

one shot,one kill. 712

(详细教程)opencv+pycharm+笔记本摄像头 做一个人脸识别

文章目录 前言 一、pandas是什么? 二、使用步骤 1.引入库 2.读入数据 总结 一、安装opencv-python 这里推荐使用pycharm直接安装opencv-python 打开文件——设置——python解释器——点击+号 搜索opencv-python,点击安装包,等待片刻即可安装好 检查是否安装好,新建一个项目输入以下代码,若无报错则安装好 import cv2 二、准备分类器 咱们使用opencv官方提供的分类器,包括面部识别,侧...

qq_52852432的博客 1万+

电机控制框架选型指南:从TI MotorWare到ST MC SDK,5种架构优缺点对比

本文深入对比了TI MotorWare、ST MC SDK、AUTOSAR、FPGA+ARM及集成方案等五种主流电机控制软件框架的架构特点、实时性、开发效率与硬件兼容性。通过工业伺服和消费电子的实战案例分析,为工程师提供了清晰的选型逻辑与决策清单,旨在帮助规避技术债务,选择最适合项目需求的电机控制框架。

rnn9storyteller的博客 1183

程序员必读书籍及导读指南

目录(?)[+] 注:本文转载自:http://blog.csdn.net/jackfrued/article/details/44456495 最近在网上看了一个非常好的帖子《程序员一生必读的书》(我的腾讯微博上有分享该贴子链接,有兴趣就点击进去看看吧),该贴的第一个张图片是一个雷达图, 这张图是由ThoughtWorks(全球软件设计与定制领域的领袖级

阿良的专栏 1948

Tesla v100 4张显卡组装机安装vllm和ollama在Ubuntu系统上的安装---AI大模型系统从零开始0032

本文提供Ubuntu22.04系统下vLLM的完整安装指南,适配4×32G Tesla显卡的单机4卡张量并行部署。教程包含:1)硬件要求(Ubuntu22.04、NVIDIA驱动≥535、CUDA12.1+);2)NVIDIA驱动自动安装方法;3)Python3.10虚拟环境配置;4)vLLM官方预编译包一键安装;5)单机4卡启动Qwen3.6-27B模型的完整参数说明(含FP8量化、多进程并行等关键配置)。文末附分布式部署的Ray集群方案参考链接,适用于多机8卡场景。

添柴程序猿的专栏 203

【书籍推荐】UNIX编程艺术 The Art of UNIX Programming

[美]Eric S. Raymond 著 姜宏、何源、蔡晓骏 译 2006年1月出版 ISBN 7-121-02116-1 59.00元 560页   01.jpg (7.25 KB, 下载次数: 3) 下载附件 保存到相册 UNIX编程艺术 昨天 23:51 上传   本书主要介绍了UNIX系统Linux入门培训领域中的设计和开发哲学、思想文化体系、

u010926630的专栏 863

YOLOv10改进 | 代码逐行解析(三) | YOLO中的Mosaic增强详解(新手入门必读系列)

本文给大家带来的是YOLOv10中的Mosaic增强代码的详解,可能有部分人对于这一部分比较陌生,有的读者可能知道Mosaic增强但是不知道其工作原理,具体来说Mosaic增强就是指我们的数据集中的图片在输入给模型之前的一个处理过程(我们的图片并不是直接就输入给模型了,大家的训练结果中的结果检测图片大家可以看到数据集中多个图片会组合在一起这就是简单的Mosaic增强),下面我就来讲解一下其在YOLOv10中工作原理和代码定义,下面图片为一个Mosaic增强后的图片。​。

Snu77的博客 2079

【WRF-Urban数据集】 WRF 模型城市冠层参数 GloUCP 的使用

【数据集】 WRF 模型城市冠层参数 GloUCP 的使用

WW、forever的博客 487

《Unix高级环境编程》 读书笔记(1)(ch0~ch2)

《Unix高级环境编程》 读书笔记 Reading Notes (使用的是2005年的英文第二版) "One of the essential classics of UNIX programming." —Eric S. Raymond, author of The Art of UNIX Programming Forward by Dennis Ritchie:

vingstar的专栏 1557

华为OD新系统机试真题 - API请求日志去重分析

华为OD新系统机试真题【API请求日志去重分析】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD4月15号机试真题【API请求日志去重分析】

qq_45776114的博客 927

山外看山 —— 评The Art of Unix Programming

山外看山评The Art of Unix Programming作者:涩涩 http://blog.csdn.net/sese 声明:本文发表于程序员杂志今年第9期,略有删节,非经杂志社和作者书面许可,请勿擅自转载部分或全部内容。 上世纪初,英国记者斯文顿天才地将内燃机、履带、武器和装甲这些风马牛不相及的东西结合,发明出了坦克——可以边移动边攻击的钢铁堡垒。在法国战场上,德军士兵被这看似笨

涩涩的专栏 5798

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

the art of unix programming--笔记(chap4)

chap4 modularity:keeping it clean,keep it simple这一章我理解就是对于“人通过电脑编程来解决问题”这一编程实质的扩展。如何通过有限的脑力来一步步的创建出可以解决问题的程序?而且这种解决要求过程要比较快,这一章我的理解如下:编程的实质可以描述为:人通过电脑编程来解决问题。而其中一个天然限制就是人脑的处理能力有限。那么在设计以及实现的速度质量方面,

安柏霖的专栏 1582

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

The Art of Unix Programming之文化

本书在第一章第一段讲述了什么是文化 Those who do not understand Unix are condemned to reinvent it,poorly --Henry Spencer 不懂Unix的人注定最终还要重复发明一个蹩脚的Unix 开篇的名言告诫我们,请先了解Unix,理解器背后的文化后,再来谈重新发明。这句话的当代解释为...

iCloudEnd的博客 500

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

计算机编程的艺术:The Art of Computer Programming

The Art of Computer Programming (TAOCP) TheArtofComputerProgramming 第一卷基本算法原文pdf:http://broiler.astrometry.net/~kilian/The_Art_of_Computer_Programming%20-%20Vol%201.pdf 以下为微信公众号InfoQ内容...

RToax 1万+

the art of unix programming--笔记(chap1)

大部分做笔记的目的是“取其精华”,以后复习重用的时候依照笔记就可以得到所需全部,原书大可废之。但是对于《the art of unix programming》这样的书不敢如此,拜读之际,尽量多多思考,以求指导自己编程实践。chap1 Basics of the Unix Philosophyfirst part:----rules---------------------------------

安柏霖的专栏 1601
上一篇: 让RTL8187无线网卡在linux 2.6.28内核支持aircrack-ng注入。
下一篇: Unix Lovers To Party Like It’s 1234567890
Crob
博客等级 码龄27年 54粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值