Introduction to Computer Science and Programming
Lecture 1
Focus on concepts and tools of computational thinking.
Learn how to think like a computer scientist.
Skills:
computational thinking
understand code
understand ability & limits
map it into computation
课程核心内容是计算思维的概念和工具,学习如何像一个计算机科学家一样思考。
掌握的技巧:学会计算思维,能读别人的源码(非常有用),了解计算的局限性和代价,用计算来描述其他领域的问题。
Not be handing out class notes. Students learn best when they take notes even if they never look at them. The process of writing is exercising both halves of your brain and
本课程不分发课堂笔记。最好的学习方式是记笔记,尽管很多人过后从来都不看。
但记笔记的过程能够同时锻炼左右脑。
Think like a computer scientist
-What is computation? Separate out which is computer from computational thinking.
-What is knowledge? Two categories:
Declarative: √x is y means y²=x, x≥0
Imperative:
start with guess G
if G²≈x stop -> G
otherwise new guess G <- (G + X/G) / 2
repeat
要区分开计算机和计算思维。
陈述性知识和过程性知识。
过程性知识是关于如何推导的过程。一个古老的例子计算根号2,据说是古希腊数学家希罗Heron的贡献。
How do I build a mechanical process to capture that set of computation? A simple way is to build a little circuit to do this. That is actually an example of the earliest computers.
Fixed-program computers
-calculator
-Atanasoff, 1941 -> solved linear equations
-Alan Turing bombe -> used during WWII to break German Enigma codes
如何建立机械工艺来实现这种计算。简单的方法是建立一个小电路来实现,有存储的部件,加减法部件以及判断的部件。这其实就是最早的计算机,称作“
固定程序计算机”。
例如只能做计算的计算器,解线性方程组的阿塔那索夫,二战中用于德国恩格玛密码的图灵。
Suppose you could build a circuit with the following property: the input to this circuit would be any other circuit diagram. That circuit would wonderfully reconfigure itself to act like the circuits diagram.
It's going to change how it does the computation. That would be cool and that exists. It's called an interpreter. It is the basic heart of every computer. What it is doing, is saying, change the game. This is now an example of a stored-program computer.
假设一种电路可以接收任意其他电路图作为输入,对它输入某特定用途的电路图,该电路就会奇妙地重组自身,让自己按照输入电路图进行工作。可以想象很多微小的机器人四处运动,插拔电线和元件进行重组,这有点挑战性。
它能够改变自己进行计算的方式。这确实存在,称作“解释器”。它是所有电脑的基础和核心,其作用是改变规则。这就是所谓的“
存储程序计算机”。
A traditional recipe actually is based on a small set of primitives, a good chef with that set of primitives, can create an unbounded number of great dishes. Same thing holds true in programming. Given a fixed set of primitives, a good programmer can program anything.
In 1936, Alan Turing showed that with six simp