第一章 焦油坑(The Tar Pit)

史前史中,没有比巨兽在焦油坑中垂死挣扎的场面更令人震撼的了。上帝见证着恐龙、猛犸象、剑齿虎在焦油中挣扎。它们挣扎得越是猛烈,焦油纠缠得越紧,没有任何猛兽足够强壮或具有足够的技巧,能够挣脱束缚,它们最后都沉到了坑底。

No scene from prehistory is quite so vivid as that of the mortal struggles of great beasts in the tar pits. In the mind's eye one sees dinosaurs, mammoths, and sabertoothed tigers struggling against the grip of the tar. The fiercer (猛烈)the struggle, the more entangling the tar, and no beast is so strong or so skillful but that he ultimately sinks.

过去几十年的大型系统开发就犹如这样一个焦油坑,很多大型和强壮的动物在其中剧烈地挣扎。他们中大多数开发出了可运行的系统——不过,其中只有非常少数的项目满足了目标、时间进度和预算的要求。各种团队,大型的和小型的,庞杂的和精干的(wiry),一个接一个淹没在了焦油坑中。表面上看起来好像没有任何一个单独的问题会导致困难,每个都能被解决,但是当它们相互纠缠和累积在一起的时候,团队的行动就会变得越来越慢。对问题的麻烦程度,每个人似乎都会感到惊讶,并且很难看清问题的本质。不过,如果我们想解决问题,就必须试图先去理解它。

Large-system programming has over the past decade been such a tar pit, and many great and powerful beasts have thrashed (挣扎)violently in it. Most have emerged with running systems—few have met goals, schedules, and budgets. Large and small, massive or wiry, team after team has become entangled in the tar. No one thing seems to cause the difficulty—any particular paw can be pulled away. But the accumulation of simultaneous and interacting factors brings slower and slower motion. Everyone seems to have been surprised by the stickiness of the problem, and it is hard to discern the nature of it. But we must try to understand it if we are to solve it.

因此,首先让我们来认识一下软件开发这个职业,以及充满在这个职业中的乐趣和苦恼吧。

Therefore let us begin by identifying the craft of system programming and the joys and woes inherent in it.

编程的乐趣(The Joys of the Craft)

编程为什么有趣?作为回报,它的从业者(practitioner)期望得到什么样的快乐?

Why is programming fun? What delights may its practitioner expect as his reward?

首先是一种创建事物的纯粹快乐。如同小孩在玩泥巴时感到愉快一样,成年人喜欢创建事物,特别是自己进行设计。我想这种快乐是上帝创造世界的折射,一种呈现在每片独特、崭新的树叶和雪花上的喜悦 。

First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.

其次,快乐来自于开发对其他人有用的东西。内心深处,我们期望其他人使用我们的劳动成果,并能对他们有所帮助。从这个方面,这同小孩用粘土为“爸爸办公室”捏制铅笔盒没有本质的区别。

Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child's first clay pencil holder "for Daddy's office."

第三是整个过程体现出魔术般的力量——将相互啮合的零部件组装在一起,看到它们精妙地运行,得到预先所希望的结果。比起弹珠游戏或点唱机所具有的迷人魅力,程序化的计算机毫不逊色。

Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine or the jukebox mechanism, carried to the ultimate.

第四是学习的乐趣,来自于这项工作的非重复特性。人们所面临的问题,在某个或其它方面总有些不同。因而解决问题的人可以从中学习新的事物:有时是实践上的,有时是理论上的,或者兼而有之。

Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. In one way or another the problem is ever new, and its solver learns something: sometimes practical, sometimes theoretical, and sometimes both.

最后,乐趣还来自于工作在如此易于驾驭的介质(tractable medium)上。程序员,就像诗人一样,几乎仅仅工作在单纯的思考中。程序员凭空地运用自己的想象,来建造自己的“城堡”(castle)。很少有这样的介质——创造的方式如此得灵活,如此得易于精炼和重建,如此得容易实现概念上的设想。(不过我们将会看到,容易驾驭的特性也有它自己的问题。)

Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. (As we shall see later, this very tractability has its own problems.)

然而程序毕竟同诗歌不同,它是实实在在的东西;可以移动和运行,能独立产生可见的输出;能打印结果,绘制图形,发出声音,移动支架。神话和传说中的魔术在我们的时代已变成了现实。在键盘上键入正确的咒语,屏幕会活动、变幻,显示出前所未有的或是已经存在的事物。

Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.

编程非常有趣,在于它不仅满足了我们内心深处进行创造的渴望,而且还愉悦了每个人内在的情感。

Programming then is fun because it gratifies creative longings built deep within us and delights sensibilities we have in common with all men.

职业的苦恼(The Woes of the Craft)

然而这个过程并不全都是喜悦。我们只有事先了解一些编程固有的烦恼,这样,当它们真的出现时,才能更加坦然地面对。

Not all is delight, however, and knowing the inherent woes makes it easier to bear them when they appear.

首先,必须追求完美。因为计算机也是以这样的方式来变戏法:如果咒语中的一个字符、一个停顿,没有与正确的形式一致,魔术就不会出现。(现实中,很少的人类活动要求完美,所以人类对它本来就不习惯。)实际上,我认为学习编程的最困难部分,是将做事的方式往追求完美的方向调整。

First, one must perform perfectly. The computer resembles the magic of legend in this respect, too. If one character, one pause, of the incantation is not strictly in proper form, the magic doesn't work. Human beings are not accustomed to being perfect, and few areas of human activity demand it. Adjusting to the requirement for perfection is, I think, the most difficult part of learning to program.

其次,是由他人来设定目标,供给资源,提供信息。编程人员很少能控制工作环境和工作目标。用管理的术语来说,个人的权威和他所承担的责任是不相配的。不过,似乎在所有的领域中,对要完成的工作,很少能提供与责任相一致的正式权威。而现实情况中,实际(相对于正式)的权威来自于每次任务的完成。

Next, other people set one's objectives, provide one's resources, and furnish one's information. One rarely controls the circumstances of his work, or even its goal. In management terms, one's authority is not sufficient for his responsibility. It seems that in all fields, however, the jobs where things get done never have formal authority commensurate with responsibility. In practice, actual (as opposed to formal) authority is acquired from the very momentum of accomplishment.

对于系统编程人员而言,对其他人的依赖是一件非常痛苦的事情。他依靠其他人的程序,而往往这些程序设计得并不合理,实现拙劣,发布不完整(没有源代码或测试用例),或者文档记录得很糟。所以,系统编程人员不得不花费时间去研究和修改,而它们在理想情况下本应该是可靠完整的。

The dependence upon others has a particular case that is especially painful for the system programmer. He depends upon other people's programs. These are often maldesigned, poorly implemented, incompletely delivered (no source code or test cases), and poorly documented. So he must spend hours studying and fixing things that in an ideal world would be complete, available, and usable.

下一个烦恼——概念性设计是有趣的,但寻找琐碎的 bug 却只是一项重复性的活动。伴随着创造性活动的,往往是枯燥沉闷的时间和艰苦的劳动。程序编制工作也不例外。

另外,人们发现调试和查错往往是线性收敛的,或者更糟糕的是,具有二次方的复杂度。结果,测试一拖再拖,寻找最后一个错误比第一个错误将花费更多的时间。

The next woe is that designing grand concepts is fun; finding nitty little bugs is just work. With any creative activity come dreary hours of tedious, painstaking labor, and programming is no exception.

Next, one finds that debugging has a linear convergence, or worse, where one somehow expects a quadratic sort of approach to the end. So testing drags on and on, the last difficult bugs taking more time to find than the first.

最后一个苦恼,有时也是一种无奈——当投入了大量辛苦的劳动,产品在即将完成或者终于完成的时候,却已显得陈旧过时。可能是同事和竞争对手已在追逐新的、更好的构思;也许替代方案不仅仅是在构思,而且已经在安排了。

现实情况比上面所说的通常要好一些。当产品开发完成时,更优秀的新产品通常还不能投入使用,而仅仅是为大家谈论而已。另外,它同样需要数月的开发时间。事实上,只有实际需要时,才会用到最新的设想,因为所实现的系统已经能满足要求,体现了回报。

The last woe, and sometimes the last straw, is that the product over which one has labored so long appears to be obsolete upon (or before) completion. Already colleagues and competitors are in hot pursuit of new and better ideas. Already the displacement of one's thought-child is not only conceived, but scheduled.

This always seems worse than it really is. The new and better product is generally not available when one completes his own; it is only talked about. It, too, will require months of development. The real tiger is never a match for the paper one, unless actual use is wanted. Then the virtues of reality have a satisfaction all their own.

诚然,产品开发所基于的技术在不断地进步。一旦设计被冻结,在概念上就已经开始陈旧了。不过,实际产品需要一步一步按阶段实现。实现落后与否的判断应根据其它已有的系统,而不是未实现的概念。因此,我们所面临的挑战和任务是在现有的时间和有效的资源范围内,寻找解决实际问题的切实可行方案。

Of course the technological base on which one builds is always advancing. As soon as one freezes a design, it becomes obsolete in terms of its concepts. But implementation of real products demands phasing and quantizing. The obsolescence of an implementation must be measured against other existing implementations, not against unrealized concepts. The challenge and the mission are to find real solutions to real problems on actual schedules with available resources.

这,就是编程。一个许多人痛苦挣扎的焦油坑以及一种乐趣和苦恼共存的创造性活动。对于许多人而言,其中的乐趣远大于苦恼。而本书的剩余部分将试图搭建一些桥梁,为通过这样的焦油坑提供一些指导。

This then is programming, both a tar pit in which many efforts have floundered and a creative activity with joys and woes all its own. For many, the joys far outweigh the woes, and for them the remainder of this book will attempt to lay some boardwalks across the tar.

编程系统产品的演进(The Programming Systems Product)

程序(Program)。它本身是完整的,可以由作者在所开发的系统平台上运行。

水平边界以下,程序变成编程产品(Programming Product),测试、修复和扩展的程序。它可以运行在多种操作系统平台上,供多套数据使用。要成为通用的编程产品,程序必须按照普遍认可的风格来编写,特别是输入的范围和形式必须扩展,以适用于所有可以合理使用的基本算法。接着,对程序进行彻底测试,确保它的稳定性和可靠性,使其值得信赖。这就意味着必须准备、运行和记录详尽的测试用例库,用来检查输入的边界和范围。此外,要将程序提升为程序产品,还需要有完备的文档,每个人都可以加以使用、修复和扩展。经验数据表明,相同功能的编程产品的成本,至少是已经过测试的程序的三倍。

回到图中,垂直边界的右边,程序变成编程系统(Programming System)中的一个构件单元。它是在功能上能相互协作的程序集合,具有规范的格式,可以进行交互,并可以用来组装和搭建整个系统。要成为系统构件,程序必须按照一定的要求编制,使输入和输出在语法和语义上与精确定义的接口一致。同时程序还要符合预先定义的资源限制——内存空间、输入输出设备、计算机时间。最后,程序必须同其它系统构件单元一道,以任何能想象到的组合进行测试。由于测试用例会随着组合不断增加,所以测试的范围非常广。因为一些意想不到的交互会产生许多不易察觉的 bug,测试工作将会非常耗时,因此相同功能的编程系统构件的成本至少是独立程序的三倍。如果系统有大量的组成单元,成本还会更高。

图 1.1 的右下部分代表编程系统产品(Programming Systems Product)。情况不同的是,它的成本高达九倍。然而,只有它才是真正有用的产品,是大多数系统开发的目标。


【更多阅读】

  • 【架构师必知必会系列】系统架构设计需要知道的5大精要(5 System Design fundamentals)

  • 《人月神话》8 胸有成竹(Chaptor 8.Calling the Shot -The Mythical Man-Month)

  • 《人月神话》7(The Mythical Man-Month)为什么巴比伦塔会失败?

  • 《人月神话》(The Mythical Man-Month)6贯彻执行(Passing the Word)

  • 《人月神话》(The Mythical Man-Month)5画蛇添足(The Second-System Effect)

  • 《人月神话》(The Mythical Man-Month)4概念一致性:专制、民主和系统设计(System Design)

  • 《人月神话》(The Mythical Man-Month)3 外科手术队伍(The Surgical Team)

  • 《人月神话》(The Mythical Man-Month)2人和月可以互换吗?人月神话存在吗?

  • 在平时的工作中如何体现你的技术深度?

  • Redis 作者 Antirez 讲如何实现分布式锁?Redis 实现分布式锁天然的缺陷分析&Redis分布式锁的正确使用姿势!

  • 程序员职业生涯系列:关于技术能力的思考与总结

  • 十年技术进阶路:让我明白了三件要事。关于如何做好技术 Team Leader?如何提升管理业务技术水平?(10000字长文)

  • 当你工作几年就会明白,以下几个任何一个都可以超过90%程序员

  • 编程语言:类型系统的本质

  • 软件架构设计的核心:抽象与模型、“战略编程”

  • 【图文详解】深入理解 Hbase 架构  Deep Into HBase Architecture

  • HBase 架构详解及读写流程原理剖析

  • HDFS 底层交互原理,看这篇就够了!

  • MySQL 体系架构简介

  • 一文看懂MySQL的异步复制、全同步复制与半同步复制

  • 【史上最全】MySQL各种锁详解:一文搞懂MySQL的各种锁

《人月神话》(The Mythical Man-Month)看清问题的本质:如果我们想解决问题,就必须试图先去理解它...相关推荐

  1. 【阅读笔记】《人月神话》思想提炼

    文章目录 前言 1. 衡量工作量 1.1. 单位 1.2. 工作量与人月(人天)的关系 1.2.1 忽略了沟通成本 1.2.2 忽略了需求的特征 2. 外科手术团队 -- 少部分人主导项目 2.1. ...

  2. 人月神话---观点摘录

    <人月神话> 为什么想看这本书呢? 因为以前的公司虽然名气不大, 但是管理流程都挺规范的 , 没有觉察到管理混乱带来的灾难 , 临时到了一家比较有名气的公司 , 但是在开发过程中, 深深感 ...

  3. 《人月神话》(The Mythical Man-Month)1 看清问题的本质:如果我们想解决问题,就必须试图先去理解它...

    第一章 焦油坑(The Tar Pit) 史前史中,没有比巨兽在焦油坑中垂死挣扎的场面更令人震撼的了.上帝见证着恐龙.猛犸象.剑齿虎在焦油中挣扎.它们挣扎得越是猛烈,焦油纠缠得越紧,没有任何猛兽足够强 ...

  4. 《人月神话(The Mythical Man-Month)》2人和月可以互换吗?人月神话存在吗?

    美酒的酿造需要年头,美食的烹调需要时间: 片刻等待,更多美味,更多享受. --新奥尔良 Antoine 餐厅的菜单 Good cooking fakes time. If you are made t ...

  5. 《人月神话》(The Mythical Man-Month)2人和月可以互换吗?人月神话存在吗?

    美酒的酿造需要年头,美食的烹调需要时间: 片刻等待,更多美味,更多享受. --新奥尔良 Antoine 餐厅的菜单 Good cooking fakes time. If you are made t ...

  6. 《人月神话》8 胸有成竹(Chaptor 8.Calling the Shot -The Mythical Man-Month)

    实践是最好的老师. - PUBILIUS 实践是最好的老师,但是,如果不能从中学习,再多的实践也没有用. - <穷理查年鉴> Practice is the best of all ins ...

  7. 《人月神话》(The Mythical Man-Month)3 外科手术队伍(The Surgical Team)

    研究表明,效率高和效率低的实施者之间具体差别非常大,经常达到了数量级的水平.These studies revealed large individual differences between hi ...

  8. 悼念《人月神话》(The Mythical Man-Month)作者 Fred Brooks

    Fred Brooks 于 11 月 17 日去世.他是计算机科学领域的巨人,鼓舞了我们许多人. Fred Brooks passed away on November 17. He was a gi ...

  9. 读《人月神话》(The Mythical Man-Month)

    花了几天时间略读完了<人月神话>(The Mythical Man-Month),并没有什么很深的体会,这有可能是并没有接触太多关于软件工程学方面的东西吧.总的收获就是,知道了优秀程序员和 ...

  10. 《人月神话》(The Mythical Man-Month)5画蛇添足(The Second-System Effect)

    聚沙成塔,集腋成裘. - 奥维德 Adde parvum parvo magnus acervus erit. [Add little to little and there will be a bi ...

最新文章

  1. 访问HTML标签的属性1
  2. 监控服务器怎么增加碟机,微服务业务监控方法及服务器专利_专利申请于2017-12-15_专利查询 - 天眼查...
  3. spring boot + vue + element-ui全栈开发入门——项目部署
  4. ACL Beginner Contest 总结——F多项式待补
  5. WIN10找不到服务器共享文件,win10没有共享选项怎么办_win10文件属性没有共享选项的解决方法...
  6. 深度优先搜索(DFS)递归形式改为非递归形式
  7. 985 211 PHP,你们要的985、211高校官方报录比汇总来了
  8. 困兽之斗!使用JavaScript执行客户端的exe文件(excute the .exe file on client-side machine by JavaScript)...
  9. java 微软雅黑_网站能使用微软雅黑字体吗?是否会构成侵权?微软雅黑有版本吗? - 飞天奔月的java博客 - ITeye博客...
  10. 遥感图像场景分类数据集
  11. UIView Animation 动画学习总结
  12. 数据分析基础——基本运算
  13. vue移动端用什么数据可视化插件_前端必看的数据可视化入门指南
  14. 河北科技大学电子商务马志伟
  15. python -itchat实现把文件传输助手当作linux的shell
  16. Multi-instance Multi-label Learning for Relation Extraction-2012
  17. 凉了7年的快播,登上排行榜第一 (重新排版)
  18. 如何用思维导图软件做进度计划?
  19. CAD转Excel该如何转换呢?
  20. 转型产品经理需要考NPDP吗?

热门文章

  1. 13_大数据之数据可视化_note
  2. ubuntu + windows双系统默认启动项修改方法
  3. 2022-2027年中国环保领域集团级sis系统行业市场调研及未来发展趋势预测报告
  4. 2018俄罗斯世界杯亚洲区12强赛记录
  5. stm32f103r8t6的晶振频率_STM32F103R8T6 中文资料
  6. java版12306抢票_GitHub - a1647517212/J12306: 12306抢票程序JAVA版
  7. port bridge enable命令导致的环路
  8. 最快零基础上手——latex文档标题、一级标题、二级标题、内容搭建
  9. windows如何导出组策略结果集 (RSOP)
  10. java 不登录购物车_java-没有用户登录时存储购物车(playframework疑问)