国栋

## 计算机科学与计算机无关

And it's not about computers in the same sense that physics is not really about particle accelerators,

and biology is not really about microscopes and petri dishes.

And it's not about computers in the same sense that geometry is not really about using surveying instruments.

## 到底是个啥？

geometry comes from Gaia, meaning the Earth, and metron, meaning to measure.

geometry 来自 Gaia（希腊神话中的土地神），意思为土地（地球），metron 则意为测量。

it's very easy to confuse the essence of what you're doing with the tools that you use.

### 几何学的本质（essence of geometry）

formalize notions about space and time

to start a way of talking about mathematical truths formally

That led to the axiomatic method.That led to sort of all of modern mathematics,

figuring out a way to talk precisely about so-called declarative knowledge, what is true.

### 计算机科学的本质（essence of computer science）

but really what they were doing is starting to learn how to formalize intuitions about process, how to do things

starting to develop a way to talk precisely about how-to knowledge, as opposed to geometry that talks about what is true.

## what is true VS how-to，一个具体例子

what is true 与 how-to 的具体区别，我们来看一个具体的例子，关于“根号X（√X）”的例子。

### imperative knowledge（过程性知识），how to

1. 先猜测一个值 G（guess）.
2. 通过求 G 和 X/G 的平均值来改进猜测，即(G+X/G)/2.
3. 不断重复改进猜测的过程直到达到所要求的精度。
4. 把 1 作为最初的猜测值。

### how to 求根号的一个具体例子

1. 1 作为最初的猜测值，但1^2=1，比 2 小太多，显然不满足；
2. 然后在 1 的基础上改进猜测， (1+2/1)/2，也即是 1.5 去做第二次猜测。1.5^2=2.25，又太大了；
3. 继续在 1.5 的基础上改进猜测，(1.5+2/1.5)/2，也即是 1.4166 去做第三次猜测。1.4166^2=2.0067，稍大了点，但已经很接近 2 了；
4. ……
5. 定义一个截止的精度，比如 0.001，当与 2 的差值在这个精度以内就结束猜测。

``````package org.jcc.core.cs;

public class Sqrt {
public static void main(String[] args) {
System.out.println(sqrt(2));
}

public static double sqrt(double x) {
return tryGuess(x, 1);
}

private static double tryGuess(double x, double guess) {
if (goodEnough(x, guess)) {
return guess;
} else {
return tryGuess(x, improveGuess(x, guess));
}
}

private static double improveGuess(double x, double guess) {
return (guess + x / guess) / 2;
}

private static boolean goodEnough(double x, double guess) {
return Math.abs(guess * guess - x) < 0.001;
}
}
``````

## 控制复杂性的技术（techniques for controlling the complexity）

The real problems come when we try to build very, very large systems,
computer programs that are thousands of pages long, so long that nobody can really hold them in their heads all at once.

And the only reason that that's possible is because there are techniques for controlling the complexity of these large systems.

And these techniques that are controlling complexity are what this course is really about. And in some sense, that's really what computer science is about.

## 抽象形式的工程学（abstract form of engeneering）

And that means that, in building a large program, there's not all that much difference between what I can build and what I can imagine,

the constraints imposed in building large software systems are the limitations of our own minds.

computer science is like an abstract form of engineering

## 控制复杂性的三大技术

### 国栋

UNIX网络编程卷2进程间通信读书笔记汇总

UNIX网络编程卷2进程间通信读书笔记（一）—概述 http://blog.chinaunix.net/u/22935/article_52711_2.html UNIX网络编程卷2进程间通信读书笔记（二）—管道 （1） http://blog.chinaunix.ne...

2012/09/03
211
0
2018开始读书吧——关于读书的思考

1．封目序尾 所谓的封目序尾就是：读书前要先看封面、目录、序言、结尾。 封面：题目是作者花了很长的时间才总结出的，是对这本书的一句话概括，是这本书的核心价值。 目录：是对这本书的梳理...

2018/01/03
0
0

——半研墨拆书2《如何阅读1本书》 作为运营来讲，除了在实操中学习，还要扩充视角，开阔思维，建立更多解决问题的思考框架，这就要求我们，要多读书，还要会读书。就是说，我们在快速阅读的...

pmcaff2008
2017/12/15
0
0

modernizr
2014/05/30
773
13

Wilson's Blog
2016/08/26
0
0

6分钟前
0
0

internetafei
15分钟前
0
0
Docker搭建Mysql集群、主从同步复制

1、创建数据挂载点： mkdir /opt/mysql-master/mysql、/opt/mysql-master/conf.d、/opt/mysql-slave/mysql、/opt/mysql-slave/conf.d 2、分别在master、slave节点文件目录conf.d下创建touch......

WALK_MAN
38分钟前
8
0

y123456yz
39分钟前
2
0
Spring-boot单元测试（私有方法测试）

Spring-boot的单元测试网上有了很多，当项目是可以使用spring-boot正常运行时，只要在测试类上添加如下配置就使用@Autowired的方式进行单元测试 @RunWith(SpringJUnit4ClassRunner.class)@...

2
0