0.0.2 第一版前言

Preface to the First Edition

第一版前言

A computer is like a violin. You can imagine a novice trying first a phonograph and then a violin. The latter, he says, sounds terrible. That is the argument we have heard from our humanists and most of our computer scientists. Computer programs are good, they say, for particular purposes, but they aren't flexible. Neither is a violin, or a typewriter, until you learn how to use it.

一台计算机就像是一把小提琴。你可以想象一个新手试了一个音符并丢掉了它。后来他说,听起来真难听。我们已经从大众和我们的大部分计算机科学家那里反复听到这种说法。他们说,计算机程序对个别具体用途而言确实是好东西,但它们太缺乏弹性。一把小提琴或者一台打字机也同样缺乏弹性。那是你学会了如何去使用它们之前。
Marvin Minsky, ``Why Programming Is a Good Medium for Expressing Poorly-Understood and Sloppily-Formulated Ideas''

``The Structure and Interpretation of Computer Programs'' is the entry-level subject in computer science at the Massachusetts Institute of Technology. It is required of all students at MIT who major in electrical engineering or in computer science, as one-fourth of the ``common core curriculum,'' which also includes two subjects on circuits and linear systems and a subject on the design of digital systems. We have been involved in the development of this subject since 1978, and we have taught this material in its present form since the fall of 1980 to between 600 and 700 students each year. Most of these students have had little or no prior formal training in computation, although many have played with computers a bit and a few have had extensive programming or hardware-design experience.

本书是麻省理工学院(MIT)计算机科学的入门教材。在 MIT 主修电子工程或者计算机科学的所有学生都必须学这门课,作为“公共核心课程计划”的四分之一。这里还包含两个关于电路和线性系统的科目,还有一个关于数字系统设计的科目。我们从 1978 年开始涉足这些科目的开发,从 1980 年秋季以后,我们就一直按照现在这种形式教授这个课程,每年 600 到 700 个学生。大部分学生此前没有或者很少有计算方面的正式训练,虽然许多人玩过计算机,也有少数人有许多程序设计或者硬件设计的经验。

Our design of this introductory computer-science subject reflects two major concerns. First, we want to establish the idea that a computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute. Second, we believe that the essential material to be addressed by a subject at this level is not the syntax of particular programming-language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, but rather the techniques used to control the intellectual complexity of large software systems.

我们所设计的这门计算机科学导引课程反映了两方面的主要考虑。首先,我们希望建立起一种看法:一个计算机语言并不仅仅是让计算机去执行操作的一种方式,更重要的,它是一种表述有关方法学的思想的新颖的形式化媒介。因此,程序必须写得能够供人们阅读,偶尔地去供计算机执行。其次,我们相信,在这一层次的课程里,最基本的材料并不是特定程序设计语言的语法,不是有效计算某种功能的巧妙算法,也不是算法的数学分析或者计算的本质基础,而是一些能够用于控制大型软件系统的智力复杂性的技术。

Our goal is that students who complete this subject should have a good feel for the elements of style and the aesthetics of programming. They should have command of the major techniques for controlling complexity in a large system. They should be capable of reading a 50-page-long program, if it is written in an exemplary style. They should know what not to read, and what they need not understand at any moment. They should feel secure about modifying a program, retaining the spirit and style of the original author.

我们的目标是,使完成了这一科目的学生能对程序设计的风格要素和审美观有一种很好的感觉。他们应该掌握了控制大型系统中的复杂性的主要技术。他们应该能够去读 50 页长的程序,只要该程序是以一种值得模仿的形式写出来的。他们应该知道在什么时候哪些东西不需要去读,哪些东西不需要去理解。他们应该很有把握地去修改一个程序,同时又能保持原来作者的精神和风格。

These skills are by no means unique to computer programming. The techniques we teach and draw upon are common to all of engineering design. We control complexity by building abstractions that hide details when appropriate. We control complexity by establishing conventional interfaces that enable us to construct systems by combining standard, well-understood pieces in a ``mix and match'' way. We control complexity by establishing new languages for describing a design, each of which emphasizes particular aspects of the design and deemphasizes others.

这些技能并不仅仅适用于计算机程序设计。我们所教授和提炼出来的这些技术,对于所有的工程设计都是通用的。我们在适当的时候隐藏起一些细节,通过创建抽象支控制复杂性。我们通过建立约定的界面,以便能以一种“混合与匹配”的方式组合起一些标准的、已经很好理解的片段,去控制复杂性。我们通过建立一些新的语言去描述各种设计,每种语言强调设计中的一个特定方面并降低其他方面的重要性,以控制复杂性。

Underlying our approach to this subject is our conviction that ``computer science'' is not a science and that its significance has little to do with computers. The computer revolution is a revolution in the way we think and in the way we express what we think. The essence of this change is the emergence of what might best be called procedural epistemology -- the study of the structure of knowledge from an imperative point of view, as opposed to the more declarative point of view taken by classical mathematical subjects. Mathematics provides a framework for dealing precisely with notions of ``what is.'' Computation provides a framework for dealing precisely with notions of ``how to.''

设计这门课程的基础是我们的一种信念,“计算机科学”并不是一种科学,而且其重要性也与计算机本身并无太大关系。计算机革命是有关我们如何去思考的方式,以及和我们如何去表达自己的思考的一个革命。在这个变化里最基本的东西,就是出现了这样一种或许最好是称为过程性认识论的现象——这就是如何从一种命令式的观点去研究知识的结构,这一观点是与经典数学领域中所采用的更具说明性的观点完全不同的。数学为精确处理“是什么”提供了一种框架,而计算则为精确处理“怎样做”的概念提供了一种框架。

In teaching our material we use a dialect of the programming language Lisp. We never formally teach the language, because we don't have to. We just use it, and students pick it up in a few days. This is one great advantage of Lisp-like languages: They have very few ways of forming compound expressions, and almost no syntactic structure. All of the formal properties can be covered in an hour, like the rules of chess. After a short time we forget about syntactic details of the language (because there are none) and get on with the real issues -- figuring out what we want to compute, how we will decompose problems into manageable parts, and how we will work on the parts. Another advantage of Lisp is that it supports (but does not enforce) more of the large-scale strategies for modular decomposition of programs than any other language we know. We can make procedural and data abstractions, we can use higher-order functions to capture common patterns of usage, we can model local state using assignment and data mutation, we can link parts of a program with streams and delayed evaluation, and we can easily implement embedded languages. All of this is embedded in an interactive environment with excellent support for incremental program design, construction, testing, and debugging. We thank all the generations of Lisp wizards, starting with John McCarthy, who have fashioned a fine tool of unprecedented power and elegance.

在教授这里的材料时,我们采用的是 Lisp 语言的一种方言。我们绝没有形式化地教授这一语言,因为完全不必那样做。我们只是使用它,学生可以在几天之内就学会它。这也是类 Lisp 语言的重要优点:它们只有不多几种构造复合表达式的方式,几乎没有语法结构。所有的形式化性质都可以在一个小时里讲完,就像下象棋的规则似的。在很短时间之后,我们就可以不再去管语言的语法细节(因为这里根本就没有),而进入真正的问题——弄清楚我们需要去计算什么,怎样将问题分解为一组可以控制的部分,如何对这样的部分开展工作。Lisp 的另一优势在于,与我们所知的任何其他语言相比,它可以支持(但并不是强制性的)更多的能用于以模块化的方式分解程序的大规模策略。我们可以做过程性抽象和数据抽象,可以通过高阶函数抓住公共的使用模式,可以用赋值和数据操作去模拟局部状态,可以复用流和延时求值连接起一个程序里的各个部分,可以很容易地实现嵌入性语言。所有这些都融合在一个交互式的环境里,带有对递增式程序设计、构造、测试和排除错误的绝佳支持功能。我们要感谢一代以一代的 Lisp 大师,从 John McCarthy 开始,是他们铸造起了这样一个具有空前威力的如此优美的好工具。

Scheme, the dialect of Lisp that we use, is an attempt to bring together the power and elegance of Lisp and Algol. From Lisp we take the metalinguistic power that derives from the simple syntax, the uniform representation of programs as data objects, and the garbage-collected heap-allocated data. From Algol we take lexical scoping and block structure, which are gifts from the pioneers of programming-language design who were on the Algol committee. We wish to cite John Reynolds and Peter Landin for their insights into the relationship of Church's lambda calculus to the structure of programming languages. We also recognize our debt to the mathematicians who scouted out this territory decades before computers appeared on the scene. These pioneers include Alonzo Church, Barkley Rosser, Stephen Kleene, and Haskell Curry.

作为我们所用的 Lisp 方言,Scheme 试图将 Lisp 和 Algol 的威力和优雅集成到一起。我们从 Lisp 那里取来了元语言的威力,它来自简单的语法形式,程序与数据对象的统一表示,以及带有废料收集的堆分配数据。我们从 Algol 那里取来了词法作用域和块结构,这是当年参加 Algol 委员会的那些程序设计语言先驱都们的礼物。我们想特别提出 John Reynolds 和 Peter Landin,为了他们对丘奇的 lambda 演算与程序设计语言和结构之间关系的真知灼见。我们也认识到应该感谢那些数学家们,他们在计算机出现之前,就已经在这一领域中探索了许多年。这些先驱者包括丘奇(Alonzo Church)、罗塞尔(Barkley Rosser)、克里尼(Stephen Kleene)和库里(Haskell Curry)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值