第 109 期·中文精读

布莱恩·克尼汉:UNIX、C、AWK、AMPL 与 Go 编程

Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming

亲历者讲述 UNIX 与 C 语言的诞生,以及 AWK、AMPL 和 Go 背后的设计思想与工程文化。

官方音频00:00 / --:--
中文精读由 AI 基于原始访谈改写,非官方翻译,可能存在偏差或错误;表述以原音频与官方文稿为准。说明

1969 年,Ken Thompson 的妻子带着一岁的儿子去加州探亲,为期三周。他独自留在新泽西,用这三周写下了一个操作系统。

五十年后,世界上绝大多数计算机运行的都是它的后代。

这个系统叫 Unix。

布莱恩·克尼汉(Brian Kernighan)就在现场。他在贝尔实验室待了很多年,和 Ken Thompson、Dennis Ritchie 是同事,与 Ritchie 合著了《C 程序设计语言》,还共同创造了文本处理语言 AWK 和代数建模语言 AMPL。Lex Fridman 在节目开头说他是"我在这个播客里聊过的最谦逊、最友善的人之一"。而克尼汉整场对话反复说的一句话是:我不行,那主要是别人的功劳。

这种谦逊是真的。可他参与创造的东西,构成了今天几乎所有软件开发的地基。他自己在节目里开玩笑说,AWK 现在还有数百万人在用,所以"你的愚蠢错误也摆在他们面前让人看"。这句话其实才是这篇文章的入口:一个站在技术史关键节点上的人,怎么看待自己参与缔造的世界。

三周,一个操作系统

要理解 Unix 为什么会出现,得先回到没有它的年代。

1950 年代到 1960 年代初,大多数计算在物理上巨大的机器上完成,体积大,按今天的标准却一点都不快,被安放在专门的机房里。你写程序用打孔卡,把一叠卡片写好,交给柜台,柜台转给操作员,过一阵子回来的答复往往是"你这里写错了",然后你回去改,重来。整个循环非常慢。

分时系统的想法是:还是那台机器,但用类似电动打字机的终端接上去,让每个人轮流用一小片时间。你敲一个键,操作系统醒来,记下这个字符,然后回去处理别人的事。它绕着所有人转圈,给每个人一小块时间,制造出一种"这台机器基本是我一个人的"错觉。

这种错觉是好东西。它比打孔卡模式好太多,而且它催生了整个交互式计算的传统。

第一个比较像样的分时系统叫 CTSS,兼容分时系统。1966 年夏天,克尼汉作为实习生用过它,主持者是 Fernando Corbató,一位刚在这年去世的图灵奖得主。CTSS 跑在一台 IBM 7094 上,内存被扩到常规的两倍:两组 32K 字,每字 36 位,换算下来一次大概 150KB 乘二。今天这点内存在噪声里都找不到,当年却是一笔巨款。

CTSS 之后是 Multics。名字是 Multiplexed Information and Computing Service,多重信息与计算服务。它的野心是做一个"信息公用事业",可以让计算像墙上的插座一样即插即用。你听这个概念会觉得很熟,因为这基本就是今天云计算的描述,只是早了五十年。

Multics 由 MIT、贝尔实验室和通用电气三家一起做,通用电气提供硬件。麻烦在于它太贵,承诺的东西交付得太晚。1969 年初,贝尔实验室决定退出。

这一退,留下了一批已经尝过好环境滋味、现在却无环境可用的人。他们开始做纸面设计,想一个新的操作系统该长什么样。同时 Ken Thompson 找到一台使用不多的 PDP-7,开始拿它做文件系统的实验,琢磨信息该怎么高效地存到计算机里。然后他妻子去了加州,他坐下来,把它写成了一套操作系统。

克尼汉对这段有个明确的纠正。很多人以为他也是 Unix 的作者之一,他本人说:"我和它没有任何关系,我从没写过操作系统代码。"他说得很清楚,真正的作者是 Ken Thompson,加上 Dennis Ritchie 和周围一批人的巨大贡献。

"Ken Thompson 是我见过的程序员里的一种奇异点。没有对你不敬的意思,也没有对我自己,但他现在已经在好几个量级之外了。"(Brian Kernighan)

三周写一个操作系统,听起来像神话。这里面确实有运气成分,有那种"某个人在某个时间点恰好出现"的时机问题。但克尼汉也提醒,那时候的系统按今天的标准并不大。早期的 Unix 就是一段代码,让你能运行进程,能存文件,能加载可执行代码到内存,交给它控制权,跑完再收回来。再加上一个汇编器、一个文本编辑器、一套文件系统,核心就齐了。这些在 1973 到 1974 年之前,全是用 PDP-7 汇编语言写的。

用汇编写复杂系统难到什么程度?克尼汉说,在这种语言里你犯了错没人会告诉你,没有辅助轮。你只能靠某种看全局的能力,把东西一点点拼起来。他自己已经很久没写过汇编了,但那种"没有训练轮"的感觉他记得很清楚。

贝尔实验室:传奇是怎么被养出来的

贝尔实验室当时在新泽西有好几处,主址在 Murray Hill,跨在两个小镇的边界上,从纽约市往西大约十五到二十英里。那里有三四千人,很多是博士,主要做物理科学,化学、物理、材料,数学也很强,同时对计算的兴趣越来越大,因为人们发现可以用计算机去建模、去替代一部分实验室工作。

它隶属于 AT&T。AT&T 提供的是全美的电话服务,贝尔实验室的目标就是让这个服务不断变好。这个目标听起来平淡,但它决定了一切:为了改进电话服务,你需要做晶体管,需要做光纤,需要做微波系统,需要研究材料、器件和数学。指标看起来是服务,实际落到研究上,就是有大量基础问题可以啃。

克尼汉强调那个环境非常开放、非常合作,友好到有点不像大公司。你有问题就去找人,对方可能就帮你解决。人们会干一些奇怪的事,时不时地戳一戳官僚体系,带点反叛的意味。

他特别提到物理上的接近:贝尔实验室本质上是一栋巨大的楼,做相关工作的人挤在两三个楼区里,还有一个五十英尺乘五十英尺左右的公共空间,放着咖啡机,人们在那里闲逛。反馈循环非常短。你早上有个想法,晚上或者第二天就有一个能跑的东西,别人会来试,会说"这很棒,但你这里搞砸了"。

这是不是独一无二?克尼汉立刻用了"幸存者偏差"这个词来打自己。他说,如果这事没发生在贝尔实验室,别的地方也在做同样有意思的工作。施乐帕克研究中心(Xerox PARC)就是最明显的例子,贡献了多得惊人的东西,很多我们今天习以为常的技术都出自那里。只不过帕克的母公司可能没那么幸运,没有把这些成果好好变现。

回到编程本身。克尼汉说,早年编程的乐趣之一是有大量的低垂果实,前人没做过,环境又是新的,工具好用,系统响应快,同事极强。他把这种体验总结成一件事:编程本身是解谜,是好玩,但真正让好玩变得更好的,是你做的东西有人用。哪怕他们在抱怨它坏了,他们用了,这件事本身就是奖励。

Unix 的设计哲学:为程序员服务

Unix 的根本目标,按克尼汉的说法,是提供一个让人容易写程序、写程序高产的环境。它的定位就是为程序员服务的环境,别的用途都是顺带。

这一点值得细读。它被大量用于文字处理,但它不是作为文字处理系统设计的;被大量用于实验室控制,但它不是为此设计的;被大量用作大型系统的前端,也不是为此设计的。它就是让写程序变得容易。相应地,写出来的程序也常常是给别的程序员用的,于是形成了一个正循环:环境越好写程序,就有人写越多有用的程序,越多有用的程序又让环境更有价值。

Dennis Ritchie 在书末有个观察,说从他的角度看,真正的目标其实是创造一个社群,一群人可以在这个系统上作为程序员一起工作。这个说法比任何技术描述都更贴近 Unix 的本质。

Unix 的效率和健壮性从哪里来?克尼汉给的理由很朴素:它从极其简陋的硬件上开始,处理器速度和内存都非常有限,这逼着你不能乱来。没有资源去堆复杂的东西,于是你被迫去找一个机制通吃许多场景,而不是写一堆特殊分支。

文件系统是最好的例子。Unix 的文件接口极其直接,这让围绕它写代码非常高效。然后有人发现,这个接口不只能管磁盘文件,还能管设备:对设备读写和对文件读写是一回事。

这个泛化思路后来被推得更远。Plan 9 操作系统在 1980 年代末出现,尝试把更多资源都塞进同一个接口,进程、网络、各种文件系统,全部共享那套统一的抽象。每种资源用同一把钥匙去开,用的人就不用每次都重新想一遍。

这里藏着一条可以带走的规律:找到正确的模型,能让很多事同时变简单。省下来的认知成本,会转化成人人都能多做一些有用的事。

一个"开源"的误会

Lex 问到一个很常见的印象:Unix 后来成了开源系统,因为 AT&T 受各种约束,没法自己做计算机生意。

克尼汉直接纠正了这个说法。Unix 从来不是开源的,它是明确的专有许可(proprietary)。只是它以源代码形式,长期免费授权给大学。正是这一点,让一代代学生和老师看着 Unix 长大,也让社区里积累起足够的专业能力,人们才有可能各自分头去搭一个"长得像 Unix"的东西。

伯克利版的 Unix 从这个许可代码起步,逐渐加入自己的贡献,尤其来自 Bill Joy 等人的代码。加得足够多之后,它最终能完全摆脱 AT&T 的代码。1980 年代末到 1990 年代初,围绕这件事打了大量法律官司。

开源运动这个说法,大致可以从 Richard Stallman 在 1980 年代末的想法算起。到 1991 年 Linus Torvalds 决定写一个类 Unix 操作系统时,社区里已经有足够多的知识存量。他能看见目标,因为 Unix 的系统调用接口、工具集早就在那里摆着。于是他搭出的是一个到今天说起"Unix",你脑子里其实想的是 Linux 的东西。

所以那句"技术上不开放,技术上属于 AT&T,但在实践中相当开放",是对这件事最准确的概括。

AWK 与 grep:一行代码的威力

AWK 是克尼汉和 Al Aho、Peter Weinberger 在 1970 年代末做的,名字来自三个人姓氏的首字母。它的定位是让"又快又脏"的任务变得容易:数个数、从文本里挑出有意思的信息、换个方式重排、总结一下、对每一行跑一条命令。

它到今天仍然被广泛使用,已经四十多年了。克尼汉说,他们当初没意识到,这个模型其实对很多数据处理任务都很好用,所以它能活这么久。他半开玩笑地给了个建议:如果按"投入产出比"来算,学 AWK 大概是学一门编程语言里性价比最高的。它撑不起大项目,但在那些"我就想看看这里面所有的某某东西"的小事上,表现相当好。

AWK 之所以顺手,很大程度上在于它的默认行为设计得好。它自动逐文件、逐行读,每一行上你用一组模式和动作来写程序:如果某个模式匹配,就执行对应的动作。相当于一个四层嵌套循环,全部自动完成,你只要写模式和动作。它还自动把行切成字段,自动收集信息,比如这是第几行、这行有几个字段。

结果是,在别的语言里要五到二十行的东西,在 AWK 里一两行就够。因为只有一两行,你可以直接在命令行里做,不用另开一个环境。

grep 更简单。它搜输入里符合某个正则表达式的行,模式匹配就打印。它和 AWK 是同一种范式,只是模式只有一个、动作也固定成"打印"。克尼汉说自己现在可能用 grep 比用任何别的东西都多,因为太方便、太自然。

为什么 Windows 一直没有原生的 grep?克尼汉的猜测是历史包袱加设计取向。MS-DOS 是个相当糟糕的操作系统,1990 年代某个时候 Windows 变成图形系统,微软把能量都投在这个图形界面上。那是一种面向非程序员的计算模型:点、点、点,试菜单。对只想把事做完的人,这个模型其实挺好用,反而是把命令行教给非程序员常常是一场艰难的 uphill battle。

"从微软的角度,他们做的大概是对的。"克尼汉说。长期以来的替代方案是 Cygwin 这类东西,把 Unix 和 Linux 上你喜欢的工具全部搬过去,让它们在 Windows 上正常工作,这套东西已经存在至少二十年。今天还有 WSL,能让你在 Windows 里写 Bash 脚本。Lex 说自己用过之后"生活都变了"。

编辑器考古:从纸张到 vi

克尼汉平时用什么编辑器?Sam,Rob Pike 很久以前在贝尔实验室写的。它的年代晚于 vi 和 Emacs,源头可以追溯到最初的 Unix 编辑器 ed。

这段历史挺有意思,因为它解释了今天的编辑器为什么长成这样。最早的分时系统上有编辑器,完全基于命令。那时候没有鼠标,甚至没有光标,因为终端是把字打在纸上的。Ken Thompson 写过 QED,功能非常强。Unix 出现后,他把 QED 大幅削减,变成了 ed:一个行编辑器。你可以加载文件,然后按行操作,打印某几行,加文本、删文本、改文本,或者用替换命令改行内的内容。它的界面完全基于命令行,输出打在真纸上。你改一行,就得把那一行重新打印出来,用掉另一行纸,才能看到改成了什么。

CRT 显示器出现以后,才有可能用光标控制,才能在屏幕上移动位置而不用重新打印一切。那个年代出现了好几个编辑器,克尼汉最熟悉、至今偶尔还在用的是 Bill Joy 写的 vi,大概出自 1970 年代末,充分利用了光标控制。Emacs 大约同时,但克尼汉说自己从来没把 Emacs 内化过。

所以他现在的主力是 Sam,有时用 vi。Sam 在大多数系统上都能弄到,通常要从 Plan 9 发行版里自己下载。

从汇编到 JavaScript:语言的上升史

克尼汉给的编程语言简史,从打孔卡和面板开关开始。最早人们用零和一对机器编程,后来有了汇编器,把 add 这样的助记符翻译成对应的位模式,顺便处理"这个东西在内存哪里"的琐碎工作。

他引用了一个刚过世的例子:Tony Brooker 在曼彻斯特做的 Auto code。它的前身是 Alan Turing 写的一套语言,你得把指令用零和一写进去,而且要倒着写,因为硬件就那么工作的。

汇编时代的特点是每台机器一套汇编语言,IBM 有它的,曼彻斯特有它的,各不相同。汇编指令和机器的指令集基本一一对应。你必须非常了解这台机器才能写程序,而且换一台机器就得从头开始。

1950 年代末,人们意识到可以把这套游戏再升一级,造出更接近人类思考方式的语言。那几年出现了 FORTRAN,来自 IBM,是 Formula Translation,让科学和工程计算变容易;出现了 COBOL,Common Business Oriented Language,Grace Hopper 等人参与,面向商业任务;出现了 ALGOL,主要用来描述算法;Basic 稍微晚一点。

这次升维带来两件事。第一,程序只写一次。不同的编译器可以为不同硬件编译,程序不再绑死在一种机器上。第二,写代码这件事被民主化了。一个物理学家或工程师,自己就能把程序写出来,不必去请专业程序员。写出来的质量可能不如专业程序员的,但已经够用。

1970 年代出现系统编程语言,C 是唯一的幸存者。这类语言要能干系统程序的事,比如文本编辑器、汇编器、编译器,甚至操作系统本身,所以它得能管内存、能访问进程,和机器打交道的程度更高,但方式更可控。之后是面向对象,C 写到一定规模就撑不住了,太多碎片没法追踪,C++ 从那条传统里长出来。再然后就是语言的爆炸,Java、JavaScript,一路到今天。

C 的甜蜜点

为什么 C 能活下来,影响这么深?克尼汉的说法是它卡在了一个甜蜜点上:表达能力足够让你自然地重写东西,同时效率也够高。在高效率尤其重要的年代,这两点很关键。把时间倒回五十年前,那就是四五代摩尔定律之前,机器的能力差得远。

还有一个因素是环境。C 和 Unix 绑在一起,写出来的程序可以在所有跑 Unix 的机器上用,而所有这些机器又都是用 C 写的。操作系统本身可移植,工具也可移植,它们互相喂养,形成正循环。

《C 程序设计语言》这本书 1977 年开始写。当时的时机很好:Unix 正在扩散,从几十个系统涨到几百个,C 也在和 Unix 无关的机器上出现。市场上没有别的 C 书,贝尔实验室是唯一权威来源。Dennis Ritchie 本人就是权威,因为他设计了这门语言,还写过一份极其出色的参考手册。克尼汉说他"拧着 Dennis 的胳膊",直到他同意一起写书。

书里最有名的遗产大概是 Hello World。克尼汉对"好例子"的看法很具体:一个好的例子会告诉你如何做一件事,而且它代表的东西,你未必想原样照做,但你多半想做同一类的事。他花了很多时间找那种能连成一串、能告诉读者"你需要知道什么、以及什么时候会需要"的例子。

他对很多编程书的抱怨是:不给现实的、你可能会真的想做的例子,只给纯语法。"这里怎么把三个数加起来,得了吧,这个我自己能想出来。告诉我这三个数怎么进到计算机里,做完有用的事以后,怎么又整整齐齐地输出回来。"

这句话背后是一种很朴素的教学观:人是从能用的东西里学的,不是从语法清单里学的。

Go:为 21 世纪准备的 C

Go 有两个源头。一半是贝尔实验室的传统,三位创造者里的 Ken Thompson 和 Rob Pike 都是那里的人。另一半来自欧洲学派,经由 Robert Griesemer 传过来,他算是第二代下传的学生。这个组合挺有意思。

在克尼汉看来,Go 抓住了 C 里好的那部分:表面上看非常像 C,有人干脆把它叫做"21 世纪的 C"。同时它又引入了不错的数据结构能力。他自己不是 Go 专家,虽然合著了那本 Go 的书,但他说那本书 90% 的工作是另一位作者、真正的 Go 专家 Alan Donovan 做的。

他认为 Go 特别有用的地方是并发模型。它基于 Tony Hoare 四十多年前提出的"通信顺序进程"(CSP)。goroutine 在他看来是描述并行计算非常自然的方式,写起来容易,通常能正常工作,效率也不错。

顺带问一句,早期 Unix 的人有没有预见到线程和并行计算?克尼汉猜没有。也许有人看到了,但很长时间里,这不是一件你必须去处理的事。处理器越来越快,然后因为功耗和散热这类问题,不再变快,于是转向往一颗芯片上放更多处理器。并行的东西就是在这种背景下变得重要的。

用 20 种语言写同一个程序

克尼汉有个习惯:课堂上他会拿一个小例子,尽可能用不同的语言写一遍。现在手上有二十个版本。

这个例子本身很无聊:读入长度不一的文本行,把每行重新折成不超过 60 个字符。在一门语言里大概十五行,别的地方也差不多。他关心的三件事是:代码多长,跑多快,学起来多痛苦。

这当然是极窄的样本,但他有他的道理。"一门语言最难的一步,大概就是第一步。"他用这个小程序去迈那第一步,然后看自己经历了什么。

结果差异很大。在 Lua 里,他下载了 Lua 环境,一个小时就做出来了,之前一辈子没写过 Lua。Scala 同样简单,他试了,却花了几个星期,而且跑得像乌龟。FORTRAN 90 很痛苦,但能跑。Rust 花了几天,内存管理的模型对他有点陌生。他当时遇到的最大问题是找不到一致可用的文档,感觉手册里的一切都在快速变化,看起来能跑的示例,在他的语言版本上跑不起来。这件事发生在几年前,他说现在应该稳定多了。

他的总结落到实处:你得有一件想做的事,还得有足够可支配的时间,两件都满足,才值得去学一门新语言。光为了学而学,这事永远不会发生。

那 JavaScript 呢?当年它被公认为最丑的语言之一,学术界提起它会嘲笑你,说它不配被学术研究。克尼汉认为相当一部分已经变了:语言本身在演进,编译技术更是好得不可思议,所以前后端都已经是可行的方案。他自己写过一些,也玩过一些翻译器,但不是专家,这里变化太多,他也跟不上。

库的甜蜜负担

Lex 问了一个很敏锐的问题:今天写 Python 或 JavaScript,很大一部分体验其实是在用别人写好的库,这和当年在 Unix 和 C 上从零开始搭东西,感觉完全不同。

克尼汉承认这是关键差异。旧时代编程之所以好玩,原因之一是你真的在全部自己搭,要处理的库相当少,最多加一个标准库。今天不是这样。

他的描述很具体:这几天的机器学习的尝试里,有东西不工作,你就 pip install 某个包,几百兆的不知道什么东西就下来了,你完全不知道它是什么。运气好它就能用,运气不好你毫无办法,而且你根本没法从这一千个包里找出是哪个出的问题。

他觉得 JavaScript 的 NPM 环境更糟,纪律和管控都更少。这类问题的后果不只是"你不懂它怎么工作",还包括安全问题、健壮性问题。"所以,你不想用 JavaScript 去跑一个核电站,大概。"他说得像是玩笑,但半是玩笑的东西往往最真实。

AMPL:把数学翻译给求解器

AMPL 是克尼汉参与设计的代数建模语言,和 Bob Fourer、Dave Gay 一起做的。这件事在他自己的说法里,主要功劳也归两位搭档:Bob 是西北大学工业工程与管理科学系的教授,Dave 是贝尔实验室的数值分析和优化专家。

线性规划是什么?你有一堆决策变量,它们必须以某种方式组合,满足一组约束,然后你要找到一个取值,让某个目标函数最大或最小。教科书里通常写成:一个大矩阵 A,乘以向量 x,小于等于向量 b,再加一个目标函数,是若干 x 的线性组合。

问题在于真实世界里的 A 非常庞大、非常稀疏、结构非常复杂,各个组件分散在系数里,人几乎没法直接看懂。你在黑板上写的是数学:"这一堆的和大于那一堆的和",而你真正需要的是把黑板上的数学直接写成约束,再交给求解器。

Bob 长期以来对建模语言有兴趣。当时已经有一个叫 GAMS 的通用代数建模系统,但语法像 FORTRAN,很笨重。1984 年,Bob 到贝尔实验室做休假年,办公室就在克尼汉对面,地理上非常近,于是两个人加上 Dave 一起开始谈这件事。

那种语言应该写成什么样子?无非是像黑板上的代数式,用文本写出来。克尼汉写了 AMPL 的第一版,这也是他人生第一个 C++ 程序,大概三千行,不算大,但它证明了这件事可行:人可以自然地写模型,机器能把它转换成求解器能处理的东西。

关键设计是模型和数据分开。同一个模型可以用在完全不同的数据上,就像很多程序那样。求解器负责所有硬活,AMPL 把求解结果转换回你原来的形式,告诉你每样东西该买多少、做多少、运多少。

Lex 提到他自己用 AMPL 时,会把模型发给确定没编程背景的同事看,对方也能大致理解那个优化问题是什么。一个语言能让人读懂问题本身,这件事比它跑得多快重要。

P 等于 NP 吗?

Lex 逼克尼汉下注:你觉得 P 等于 NP 吗?

答案是"不"。他说自己没有直觉,但读到的很多同行都这么下注,这是流行看法。他还转述了一个关于 Jeff Dean 的段子,问他在什么条件下 P 会等于 NP,回答大概是"要么 P=0 要么 P=1 之类",克尼汉说自己记不清了,反正那人比他聪明太多。

克尼汉博士论文写的是关于大 O 符号的东西,1968 年,早于计算复杂性理论的成形。他当时做的是图划分:给定一个有节点有边的图,边有权重,你要把节点分成两堆、大小相等,让跨越两堆的边数尽可能少。这个问题很难。

他和 Shen Lin 在贝尔实验室一起做,始终没能找到任何保证给出正确答案的算法。他们做出了效果相当好的启发式方法,他也为论文挑出了一些特殊情形,但就是难。那个时间点,Steve Cook 正在证明有一类问题看起来真的很难,图划分是其中之一。

这里有个细节值得琢磨。Lex 拿最大割作对比:最大割和图划分是同一个问题,只是不限制两边节点的数量,而一旦加上这个约束,它就变难了。约束的存在与否,把一个容易问题变成了难问题。

AI 的夏天、冬天和新夏天

1964 年,克尼汉在多伦多读本科,毕业论文是一篇关于人工智能的文献综述。那正好是 AI 的夏天,人们以为计算机什么都能干:机器翻译、下棋、证明几何定理,样样都能。他读了《计算机与思维》那本论文集,某种程度也算喝了一点 Kool-Aid,人非常乐观。

后来大家都知道了,当时以为几年就能实现的东西,花了几十年。下棋和下围棋现在确实比人强了,机器翻译也好了很多,但这背后是五六十年的进步、硬件的演进,以及大量可以用来学习的数据,再加上互联网和开源让开发者协作的基础设施。

从这里能抽出什么教训?克尼汉引用了科幻作家 Arthur Clarke 的一句话:一位德高望重的老人说某件事可能,他多半是对的;说某件事不可能,他几乎肯定是错的。但没人知道时间尺度。

谈到今天这波机器学习和神经网络,他说自己离专家非常远,大部分是从学生那里学的,学生们大概会对他学得这么少感到失望。但他认为潜力很大,游戏领域已经看到效果。同时他有一个实实在在的担心:机器学习从我们给它的数据里学,数据有问题,学到的东西就有问题。最明显的例子就是偏见,如果数据因为历史的对待方式而包含"某些人不如另一些人"这种明摆着错误的东西,机器学习就会把它传播出去。

而这个担心还有光明的一面。机器学习做的事,是把数据里的偏见暴露出来,像一面镜子照向我们自己的社会,从而帮我们去修正它。克尼汉说,如果它真的是这样运作的,那会很棒。但他不知道它到底是不是这样运作,或者反过来说,机器学习的机制会不会反而强化和放大过去就错的东西。这件事必须严肃对待,不能含糊过去。

至于"造出人类水平的智能需要什么",他的回答非常干脆:我完全不知道。

摩尔定律撞上原子

指数增长能永远持续吗?克尼汉给了个俏皮的回答:没有哪个指数能永远持续,总会在某处耗尽。但如果它持续得足够久,那可能就是我们需要的全部了,反正跟我们没关系了。

他注意到摩尔定律已经在变。处理器不再变快,于是人们把"同样面积塞更多东西"的能力用在横向增长上:一颗芯片上放更多处理器、更多内存。这会撞到限制吗?大概会,因为总有一天你会逼近单个原子,得另想办法绕过去。会不会找到绕过去的办法?不知道。他说这话时还补了一句:"我刚说过,如果我说不会,我肯定会错,所以也许我们会找到。"

那编程语言会怎么变?他的判断是,会延续一些领域已经出现的趋势:更多编程由程序完成,更少由人完成;更多是声明式,过程式的成分越来越少。你只需要说我想要这件事发生,由别的东西去搞清楚怎么做。今天这在许多垂直领域已经是常态,领域特定语言的天下。可以想象这个范围会变宽,你不需要写那么多细节,某个软件集合会弄清怎么做你想做的事。

一句话概括:抽象层次会继续升高。高到某一天,也许就到了能用自然语言描述意图的地方。

计算机如何改变了人与人

克尼汉在普林斯顿教一门叫"计算机与我们世界"的课,面向非技术学生,典型的是历史系或英语系的人。他要讲计算机如何工作、编程是什么、计算机之间如何通信、通信的时候在干什么。

这门课里有个设计很有意思:他会带学生看一台玩具机器,指令集很小,让学生写几行汇编,理解最底层是什么样,计算机是如何用一小撮非常简单的指令(加减、跳转之类)把事做完的。然后往上走到 FORTRAN、C 这样的高层语言,看抽象层次如何让人更容易写代码、更不依赖具体架构。最后再讲他们天天在用的那些程序:手机上的操作系统、下载的 App,全都是我们刚说过的这类东西,只是规模巨大。

他承认这是要求学生从五行汇编跳到一个手机浏览器,概念跨度巨大。但本质上,它们是一回事。

那么计算机到底怎么改变了世界?克尼汉抓了一个角度:人与人之间的互动方式。

他小时候,打一个电话到某个地方是件大事,因为要花不少钱,那是 1960 年代。今天人们不打电话了,发短信。人们觉得和世界任何角落的朋友、家人定期通信、开视频会议,是理所当然的。

这对人是好是坏?他给了个两面兼有的答案。他自己和加拿大的兄弟姐妹发电邮,比二十年前打电话频繁得多,大概每两三天就会收到或发出一封,这在某种意义上把他们拉得更近了,是好事。但他看着校园里的孩子,大多低着头盯着手机走,他得躲着走。社会学研究里有人指出,人们实际上反而不如以前亲近了。他不知道这是不是真的,但他能看见潜在的下行面。

更宏观的一层,他看到的是双面性。计算机给了人们改善生活的可能,这是好的。同时短期内也能看到大量坏的一面:人变得更部落化、更狭隘,而且数量庞大。人们用计算机去误导、歪曲,或者干脆对正在发生的事撒谎,这件事正在影响各地的政治。

Lex 补了一句:现在每个人都有了发声的渠道,被压迫的人有了声音,这是强大的事。但每个人都有了声音,随之而来的混乱,看着既迷人又可怕。

大多数人不该学编程,但该懂编程

回到那个最普通的问题:所有人都该学编程吗?

克尼汉的回答很克制,也很明确:大概不该。但每个人都应该至少理解编程是什么。这样当有人对你说"我是程序员",你脑子里有个大致的概念;当有人说"这是由计算机运行的程序决定的",你对那意味着什么有一个模糊但准确的直觉。

他的这门课就是干这个的,讲计算机怎么工作,讲程序怎么写,讲计算机之间怎么对话。他坦白说,这门课上极少有人后来成为严肃的程序员。但至少他们对这一整套东西有了更好的认识,而且不只是编程,还包括背后的技术和通信。

课程里学生要写一点程序,很少。他带他们看清机器在高层语言之下是怎么运作的。虽然严格说没有"最低层",你总能再往下走,但他说,他在那里画了一条线。

那些真正开心的时刻

Lex 最后问,如果能回到过去重活一个瞬间,那个让你真正快乐、或者深刻改变你的瞬间是哪一个?

克尼汉没有给出某个具体时刻。他给出的是一类时刻,和地点绑定:在贝尔实验室,你做出一件东西,它工作了,有人用了,说"这挺酷"。这种事在 1970 年代那个黄金时代发生得挺频繁,Unix 还年轻,低垂果实遍地都是,一群人在一起,你做点东西,他们就会来试。

AWK 就是这样一个例子。他做出的东西,全世界几百万人天天在用。他也因此把自己所有的愚蠢错误都摆在这些人眼前让人看。他说这事既好又可怕。

Lex 把这一点说得很漂亮:它让人脆弱,也美,因为它实实在在地影响了很多人。

克尼汉自己留在节目最后的那句话,只有七个字:"不要注释糟糕的代码。重写它。"

这句话可以当成他整场对话的一个总结。他不相信复杂的补救,不相信在坏东西上叠加解释,不相信绕弯子。他相信的是把机制找对、把模型找对,然后让一切自然地变简单。这既是他参与缔造 Unix 的方式,也是他看待编程、语言、工具、乃至技术与社会关系的方式。

如果你读到这里想做点什么,下面这些是从这场对话里能直接拿走的:

  • 花一个下午学会 AWK 和 grep。克尼汉说,按投入产出比算,它们大概是最值得学的工具。你不需要精通,会写一行"从一堆文本里挑出某个东西并数一数",就足够在日常里反复省时间。
  • 学一门新语言时,别从语法开始,从一件你想做的小事开始。读入若干行、重新折行、输出,这种十五行左右的程序,一小时能跑通的语言,往往在默认行为设计上做得好。
  • 写代码之前先问清楚"这个问题真正要想清楚的是什么"。克尼汉把这一步归为艺术,把"怎么做才做好"归为科学。多数人跳过前者,直接进入后者,然后在错的路上狂奔。
  • 接受"找到一个好模型"的价值。Unix 的文件接口之所以强,是因为一个机制通吃了很多场景。你手上的系统如果能找到一把这样的钥匙,后面会省下大量重复解释和重复实现。
  • 对库保持敬畏,别一 install 就当它没有。知道自己在依赖什么,尤其是在安全敏感的场合。几十兆你不认识的代码进到系统里,这件事值得停一下想想。
  • 把数据当成一面镜子。如果模型学到了奇怪的东西,先回去看数据里有什么,而不是先调模型。偏见在数据里,它就会在学习结果里。
  • 别给糟糕的代码写注释,重写它。这一条适用面比编程宽得多。任何靠解释维持的东西,都值得先问一句,能不能换一个模型让它不需要解释。
文稿由本站用语音识别模型(基于官方发布音频)机器转写,可能有识别错误,人名与数字请以音频为准。
[00:00:00] The following is a conversation with Brian Kernahan, a professor of computer science at Princeton University. He was a key figure in the computer science community in the early days, alongside Unix creators Ken Thompson and Dennis Ritchie. He co-authored the C programming language with Dennis Ritchie, the creator of C, and has written a lot of books on programming, computers and life, including the practice of programming, the go programming language and his latest Unix A History and a memoir. [00:00:34] He co created the text processing language used by Linux folks like myself. He co designed ample and algebraic modeling language that I personally love and have used a lot in my life for large scale optimization. [00:00:49] I think I can keep going for a long time with his creations and accomplishments, which is funny because given all that, he's one of the most humble and kind people I've spoken to on this podcast. Quick summary of the ads to new sponsors, the amazing self cooling ET Sleep Mattress and Rakan earbuds. Please consider supporting the podcast by going to a sleep dotcom slash leks and going to buy recontact leks click the links by the stuff. It really is the best way to support this podcast and the journey I'm on. [00:01:29] If you enjoy this thing, subscribe on YouTube. Review Five thousand app, a podcast supported on Patrón or connect with me on Twitter. Àlex Friedemann. As usual, I'll do a few minutes of ads now and never any ads in the middle that can break the flow of the conversation. This show is sponsored by a sleep and it's incredible pod pro mattress that you can check out at 8:00, sleep dot com slash legs to get two hundred dollars off the mattress, controls temperature with an app and can cool down to as low as 55 degrees. [00:02:03] Research shows the temperature has a big impact on the quality of our sleep. Anecdotally has been a game changer for me. I love it. The PaPeRo is packed with sensors that track heart rate, heart rate variability and respiratory rate, showing it all on their app once you wake up. Plus, if you have a partner, you can control the temperature of each side of the bed. I don't happen to have one, but the sleep app reminds me I should probably get on that. [00:02:31] So, ladies, if a temperature controlled mattress isn't a good reason to apply, I don't know what is the apps health metrics are amazing, but the cooling alone is honestly worth the money. As some of you know, I don't always sleep, but when I do, I choose for a sleep pod prone mattress. Check it out, a sleep dotcom flex to get two hundred dollars off. This show is also sponsored by Rakan Earbuds, Get them at by Rakan Dotcom's Leks. [00:03:05] They have quickly become a main method of listening to podcasts, audio books and music, when I run, do the push ups and pull ups that I've begun to hate at this point or just living life, in fact, I often listen to brown noise with these. When I'm thinking deeply about something, it helps me focus the mind. They're super comfortable pair easily great sound, great bass, six hours of play time in fact, for fun. I have one of the earbuds in now and I'm listening to Europa by Santana, probably one of my favorite guitar songs. [00:03:39] It kind of makes me feel like I'm in a music video, so they told me to say that a bunch of celebrities use these like Snoop Dogg, Melissa Etheridge and Khateeb. I don't even know Khateeb is. But her earbud game is on point to mention celebrities actually care about, I'm sure of Richard Feynman was still with us. He'd be listening to the Joe Rogan experience with Rick Ear Buds. Get them at Byrock on dotcom slash Lex, it's how they know I sent you and increases the chance they'll support this podcast in the future. [00:04:14] So for all of the sponsors, click all of the links. It really helps this podcast. And now here's my conversation with Brian again. [00:04:42] Eunuchs started being developed 50 years ago and more than 50 years ago. Can you tell the story like you describe in your book of how the universe was created? [00:04:52] Huh? If I can remember that far back, it was some while ago. [00:04:57] So I think the gist of it is that at Bell Labs in 1969, there were a group of people who had just finished working on the MultiChoice project, which was itself a follow on to success so we can go back sort of an infinite regress in time. But the success was a very, very, very nice time. Sharing system was very nice to use. I actually used it that summer. I spent in Cambridge in 1966. What was the hardware there? [00:05:25] So what's the operating system? Was the hardware there? What's the CTS look like? [00:05:29] So Seijas has looked like kind of like a standard timesharing system. Certainly at the time it was the only timesharing of no. [00:05:36] Let's go back to the basic what's the time for. OK, in the beginning was the word and the word and there was timesharing systems. Yeah. [00:05:44] If we go back into, let's call it the 1950s and early 1960s, most computing was done on very big computers, physically big, although not terribly powerful by today's standards that were maintained in very large rooms. [00:05:59] And you used things like punch cards to write programs on talk to them so you would take a deck of cards, write you program on it, send it over a counter, read it to an operator, and some while later back would come something that said, oh, you made a mistake and then you'd recycle. And so it's very, very slow. So the idea of time sharing was that you take basically that same computer, but connect to it with something that looked like an electric typewriter that could be a long distance away. [00:06:28] It could be close. But fundamentally, what the operating system did was to give each person who was connected to it and wanting to do something, a small slice of time on to do a particular job. [00:06:42] So I might be editing a file. So I would be typing. And every time I had a keystroke, the operating system would wake up and said, oh, he typed character, let me remember that. [00:06:50] Then he'd go back to doing something else would be going around and around a group of people who were trying to get something done, giving each a small slice of time and giving them each the illusion that they pretty much had the whole machine to themselves and hence time sharing that is, sharing the computing time resource of the computer among a number of people who are doing it without the individual people being aware that there's others. [00:07:15] In a sense, the illusion, the feeling is that the machine is your own. [00:07:19] Pretty much that was the idea. Yes. You had if it were well done and if it were fast enough and other people were doing too much, you did have the illusion that you had the whole machine to yourself and it was very much better than the punch card model. And so access the compatable timesharing system was, I think arguably the first of these it was done and I guess technically 64 or something like that. It ran an IBM 1794, slightly modified to have twice as much memory as the norm. [00:07:49] It had two banks of 32 words instead of one. [00:07:54] So two words each word was thirty six bits of call it about 150 kilobytes times two. So by today's standards, that's down in the noise. At the time that was a lot of memory and memory was expensive. [00:08:10] So ZZZZZ was just a wonderful environment to work on. It was done by people that Mittie, led by Fernando CAPATO Korby, who died just earlier this year, and a bunch of other folks. [00:08:24] So I spent the summer of 66 working on that, had a great time, meant a lot of really nice people. [00:08:29] And indirectly, I knew of people at Bell Labs who were also working on a follow on to success that was called MultiChoice. [00:08:41] The MultiChoice was meant to be the system that would do everything that access did, but do it better for a larger population, all the usual stuff. [00:08:48] Now, the actual time sharing, the scheduling, how much what's the algorithm that performs the scheduling? What's that look like? How much magic is there? What are the metrics? How does it all work in the beginning? [00:09:01] So the answer is, I don't have a clue. I think the basic idea is nothing more than who all wants to get something done. Suppose that things are very quiet in the middle of the night, then I get all the time that I want. Suppose that you and I are contending at high noon for something like that. Then probably the simplest algorithm is Round-Robin one that gives you a bit of time, gives me a bit of time and then we could adapt to that, like what are you trying to do? [00:09:25] Or you text editing or are you compiling or something? And we might adjust the schedule according to things like that. [00:09:32] Okay, so MultiChoice was trying to just do some of the cleaning it up a little bit. [00:09:37] What was it was meant to be much more than that. So MultiChoice was the multiplexed information and. Puting service, and it was meant to be a very large thing that would provide computing utility, something that where you could actually think of it as just a plug in the wall service, sort of like cloud computing today. Yeah, same idea, but 50 odd years earlier. And so what MultiChoice offered was a richer operating system, environment, piece of hardware that was better designed for doing the kind of sharing of resources and presumably lots of other things. [00:10:13] Do you think people at that time had the dream of what cloud computing is starting to become now, which is computing is everywhere that you can just plug in almost, you know, and you never know how the magic works. You just kind of plug in and your little computation needs to perform and it does it. Was that the dream? [00:10:32] I don't know whether that was the dream. I wasn't part of it at that point. Remember, I was an intern for summer. [00:10:36] But my sense is, given that it was over 50 years ago. Yeah. They had that idea that it was an information utility, that it was something where if you had a computing task to do, you could just go and do it. Now, I'm betting that they didn't have the same view of computing for the masses. [00:10:55] Let's call it the idea that, you know, your grandmother would be shopping on Amazon. I don't think that was part of it. But if your grandmother were a programmer, it might be very easy for her to go and use this kind of utility. [00:11:08] What was your dream of computers at that time? What did you see as the future of computers? Could you have predicted what computers are today, Essence? [00:11:16] Oh, short answer. Absolutely not. I have no clue. I'm not sure I had a dream. It was a dream job in the sense that I really enjoyed what I was doing. I was surrounded by really, really nice people. Cambridge, a very fine city, living in the summer, less so in the winter when it snows. But in the summer it was a delightful time. And so I really enjoyed all of that stuff. And I learned things. [00:11:37] And I think the good fortune of being there for summer led me then to get a summer job at Bell Labs the following summer. [00:11:45] And that was kind of useful for the future. [00:11:48] So there's Bell Labs is this magical, legendary place. So first of all, whereas Bell Labs and. Can you start talking about that journey towards Eunuch's and Bell Labs? Yeah, so Bell Labs is physically scattered around at the time, scattered around New Jersey. The primary location was in a town called Murray Hill, or a location called Murray Hill is actually that across the boundary between two small towns in New Jersey called New Providence and Berkeley Heights. Think of it as about 15, 20 miles straight west of New York City and therefore about an hour north of here in Princeton. [00:12:28] And at that time, it had a up a number three or four thousand people there, many of whom had PhDs and mostly doing physical sciences, chemistry, physics, materials, kinds of things, but very strong math. And it rapidly growing interest in computing as people realized you could do things with computers that you might not have been able to do before you could replace labs with computers that had worked on models of what was going on. [00:12:58] So that that was the essence of Bell Labs. And again, I wasn't a permanent employee there. I was that was another internship. I got lucky. [00:13:05] And internships, I mean, if you could just lingering a little bit, what was the what was in the air there? Because some of the the number of Nobel Prizes, the number of Turing Awards and just the legendary computer scientist that come from their inventions, including developments, including Unix, is just as unbelievable. So was there something special about that place? [00:13:28] Well, I think there was very definitely something special I mentioned. [00:13:32] The number of people is a very large number of people, very highly skilled and working in an environment where there was always something interesting to work on because the goal of Bell Labs, which was a small part of AT&T, which provided basically the country's phone service, the goal of AT&T was to provide service for everybody. [00:13:50] And the goal of Bell Labs was to try and make that service keep getting better. So improving service. And that meant doing research on a lot of different things, physical devices like the transistor or fiber optic cables or microwave systems, all of these things the labs worked on. [00:14:10] And it was kind of just the beginning of real boom times in computing as well as when I was there. [00:14:16] I went there first in 66. So computing was at that point fairly young. And so people were discovering that you could do lots of things with computers. [00:14:25] So how was Unix born? So MultiChoice, in spite of having an enormous number of really good ideas, lots of good people working on it, fundamentally didn't live up, at least in the short run. And I think ultimately really ever to its goal of being this information utility, it was too expensive. And certainly what was promised was delivered much too late. [00:14:48] And so in roughly the beginning of 1969, Bell Labs pulled out of the project. [00:14:54] The project at that point had included MIT Bell Labs and General Electric. General Electric made computers of General Electric was the hardware operation. [00:15:05] So Bell Labs realizing this wasn't going anywhere on a time scale they cared about, pulled out of the project. And this left several people with an acquired taste for really, really nice computing environments, but no computing environment. [00:15:20] And so they started thinking about what could you do if you were going to design a new operating system that would provide the same kind of comfortable computing access had, but also the facilities of something like MultiChoice sort of brought forward. [00:15:36] And so they did a lot of paper design stuff. And at the same time, Ken Thompson found what is characterized as a little used PDP seven, where he started to do experiments with filesystems. Just how do you store information on a computer? An efficient way. And then this famous story that his wife went away to California for three weeks, taking their one year old son and three weeks, and he sat down and wrote an operating system which ultimately became Unix. [00:16:04] So software productivity was good in those days as a PDP was the PDP seven cents a piece of hardware? [00:16:10] Yeah, it's a piece of hardware. It was one of the early machines made by Digital Equipment Corporation deck, and it was a mini computer so called it had I would have to look up the numbers. [00:16:24] Exactly, but it had a very small amount of memory, maybe sixteen k sixteen bit words or something like that. [00:16:30] Relatively slow, probably not super expensive. Maybe again making this up I'd have to look it up 100000 dollars or something like that, which is not super expensive enough. [00:16:40] That's right. It was expensive. [00:16:42] It was enough that you and I probably wouldn't be able to buy one, but a modest group of people could get together. But in any case, in it came out, if I recall, in 1964. So by 1969, it was getting a little obsolete and that's why it was little use. If you can sort of comment, what do you think it's like to write an operating system like that so that process that can run through in three weeks because you are I mean, you're part of that process. [00:17:09] You contributed a lot to this early development. So what do you think it takes to do that first step, that first kind of from design to reality and the PDB? [00:17:22] Well, let me correct one thing. I had nothing to do with it, so I did not write it. I have never written operating system code. [00:17:30] And so I don't know. No operating system is simply code. And this first one wasn't very big, but it's something that lets you run processes of some. But you execute some kind of code that has been written that lets you store information for periods of time so that it doesn't go away when you turn the power off or reboot or something like that. [00:17:53] And there's a kind of a core set of tools that are technically not part of an operating system, but you probably need them in this case. Ken wrote in an assembler for the PDP seven that worked. He did a text editor so that you could actually create text. He had the file system stuff that he had been working on. [00:18:09] And then the rest of it was just a way to load things, executable code from the file system into the memory, give it control and then recover control when it was finished or in some other way. [00:18:21] What was the code written in the primarily the programming language? [00:18:25] Was it in Assembly PDP seven assembly that Ken created? [00:18:30] These things were assembly language until probably the call it 1973 or 74, something like that. [00:18:38] Forgive me if it's a dumb question, but it feels like a daunting task to write any kind of complex system in assembly. Absolutely. [00:18:48] It feels like impossible to do any kind of what we think of as software engineering the assembly, because to work on a big picture, sort of. I think it's hard. [00:18:58] It's been a long time since I wrote assembly language. It is absolutely true that in some language, if you make a mistake, nobody tells you there are no training wheels whatsoever. [00:19:06] And so stuff doesn't work now and you're not ebookers. Well, there could be debuggers, but that's the same problem, right? How do you actually get something that will help you debug it? So part of it is, is an ability to see the big picture. [00:19:22] Now, these systems were not big in the sense of today's picture. [00:19:25] I see the big picture was in some sense more manageable. I mean, then realistically, there's an enormous variation in the capabilities of programmers. And Ken Thompson, who did that. First one is kind of the singularity, in my experience of programmers. With no disrespect to you or even to me, he's he's into now several leagues removed. [00:19:48] I know there's levels. Yes. It's a it's a fascinating thing that there are unique stars in particular in the programming space and in a particular time, you know, at the time, matters to the timing of when that person comes along and the a wife does have to leave. Like there's this weird timing that happens and then all of a sudden something beautiful is created. I mean, how does it make you feel that there's a system that was created in three weeks or maybe you can even say on a whim, but not really. [00:20:19] And of course, quickly, that is now you could think of most of the computers in the world run on a Unix like system, right? [00:20:28] What what how do you like if you kind of assume from the alien perspective, if you're just observing Earth, that also in these computers took over the world and they started from this little initial seed of Unix, how does that make you feel? [00:20:43] It's quite surprising. And you asked earlier about prediction. The answer's no. There's no way you could predict that kind of evolution. And I don't know whether it was inevitable or just a whole sequence of blind luck. [00:20:56] I suspect more of the latter. [00:20:58] And so I look at it and think, gee, that's kind of neat. [00:21:04] I think the real question is what they can think about that, because he's the guy arguably from whom it really came, you know, tremendous contributions from Dennis Ritchie and then others around in that Bell Labs environment. But, you know, if you had to pick a single person, that would be Ken. [00:21:21] You've written in your book, UNIX, The History and the memoir. Are there some memorable human stories, funny or profound from that on that just kind of stand out? [00:21:31] Oh, there's a lot of them, in a sense. And again, it's a question of can you resurrect them in this memory fails. [00:21:38] But I think part of it was that Bell Labs at the time was a very special kind of place to work because there were a lot of interesting people and the environment was very, very open and free was a very cooperative environment, very friendly environment. And so if you had an interesting problem, you go and talk to somebody and they might help you with the solution. [00:21:57] And and it was a kind of a fun environment to in which people did strange things and often tweaking the bureaucracy in one way or another, rebellious and put in some kinds of ways. [00:22:12] In some ways, yeah, absolutely. I think most people didn't take too kindly to the bureaucracy. And I'm sure the bureaucracy put up with an enormous amount that they didn't really want to. [00:22:23] So maybe to linger on that a little bit, do you have a sense of what the philosophy that characterizes Unix is the design, not just the initial, but just carried through the years, just being there, being around? What's the fundamental philosophy behind the system? [00:22:40] I think one aspect, the fundamental philosophy was to provide an environment that made it easy to write or easier, productive to write programs. So it was meant as a programmer environment. [00:22:50] It wasn't meant specifically as something to do some other kind of job. For example, it was used extensively for word processing, but it wasn't designed as a word processing system. It was used extensively for lab control, but it wasn't designed for that. It was used extensively as a front end for big other systems, big dumb systems. But it wasn't designed for that. It was meant to be an environment where it was really easy to write programs a which could be highly productive. [00:23:17] And part of that was to be a community. And there's some observation from Dennis Ritchie, I think, at the end of the book that says that that from his standpoint, the real goal was to create a community where people could work as programmers on a system. [00:23:34] And I think in that sense, certainly for many, many years, it succeeded quite well at that. And part of that is the technical aspects of because it made it really easy to write programs. People did write interesting programs. Those programs tended to be used by other programmers. And so it was kind of a virtuous circle are of more and more stuff coming up that was really good for programmers. [00:23:56] And you were part of that community of programmers. So what was it like writing programs in that early universe? It was a blast. [00:24:03] It really was like, you know, I like the program. I'm not a terribly good person. But it was a lot of fun to write code. And in the early days, there was an enormous amount of what you would today, I suppose, call low hanging fruit. People hadn't done things before. And this was this new environment and the the whole combination of nice tools and very responsive system and tremendous colleagues made it possible to write code. You could have an idea in the morning. [00:24:33] You could do it, you know, and experiment with it. You could have something limping along that night or the next day. And people would react to it and they would say, oh, that's wonderful, but you're really screwed up here. [00:24:44] And and the feedback loop was then very, very short and tight. And so a lot of things got developed fairly quickly that. [00:24:54] In many cases still exist today, and I think that was part of what made it fun because programming itself is fun, it's puzzle solving and a variety of ways. But I think it's even more fun when you do something that somebody else then uses, even if they whine about it not working. The fact that they used it is is part of the reward mechanism. [00:25:15] And what was the method of interaction, the communication with that feedback loop? [00:25:20] I mean, this is before the Internet, certainly before the Internet. It was mostly physical right there. [00:25:28] You know, somebody come into your office and say something. So these places are all closed, but like offices are nearby, really lively and interaction. Yeah. [00:25:36] Yeah, no, Bell Labs was fundamentally one giant building and most of the people were involved in this unique stuff in two or three quarters and there wasn't room. Oh. [00:25:45] How big was it. [00:25:46] Probably call it 50 feet by 50 feet, make up a number of that and which had some access to computers there as well as in offices. And people hung out there and had a coffee machine. [00:26:00] And so there was it was mostly very physical. [00:26:03] We did use email, of course, and but it was fundamentally all for a long time, all on one machine. [00:26:11] So there was no need for Internet. It's fascinating to think about what computing would be today with our Bell Labs. It seems so many people being in the vicinity of each other, it's sort of getting that quick feedback working together since so many brilliant people. I don't know where else that could have existed in the world. And given how that came together. Yeah. How does that make you feel that that's that little element of history? [00:26:40] Well, I think that's very nice, but in a sense, it's survivor bias. And if it hadn't happened at Bell Labs, there were other places that were doing really interesting work as well. Xerox PARC is perhaps the most obvious one. Xerox PARC contribute an enormous amount of good material. And many of the things we take for granted today in the same way came from Xerox PARC experience. I don't think they capitalized in the long run as much. Their parent company was perhaps not as lucky in capitalizing on this whoknows, but that would. [00:27:10] That's certainly another place where there was a tremendous amount of influence. There were a lot of good university activities and it was obviously no slouch in this kind of thing and others as well. [00:27:24] So Unix turned out to be open source because of the various ways that AT&T operated and sort of had to. It was the focus was on telephones. So I think that's a mischaracterization in the sense it absolutely was not open source. [00:27:40] It was very definitely proprietary licensed, but it was licensed freely to universities in source code form for many years. And because of that, generations of university students and their faculty people grew up knowing about Unix and that there was enough expertise in the community, that it then became possible for people to kind of go off in their own direction and build something that looked Unix like. [00:28:08] The Berkeley version of Unix started with that license code and gradually picked up enough of its own code contributions, notably from people like Bill Joy, that eventually it was able to become completely free of any AT&T code. [00:28:27] And there was an enormous amount of legal jockeying around this, that in the late, early to late 80s, early 90s, something like that. [00:28:36] And then not, I guess the open source movement might have started when Richard Stallman started to think about this in the late 80s. [00:28:46] And by 1991, when Torvalds decided he was going to do a Unix like operating system, there was enough expertise that in the community that first he had a target. [00:28:59] He could see what to do because the kind of Unix system call interface and the tools and so on were there. [00:29:07] And so he was able to build an operating system that at this point, when you say Unix, in many cases what you're really thinking is Linux. [00:29:15] Linux. [00:29:15] Yeah, but it's funny that from my distant perception, I felt that Unix was open source. Without actually knowing it, but what you're really saying, it was just freely licensed, so it's freely licensed, so it felt open source and because universities are not trying to make money. So there it felt open source in the sense that you can get access if you want it right. [00:29:37] And a very, very, very large number of universities had the license and they were able to talk to all the other universities who had the license. [00:29:44] And so technically not open, technically belonging to anti pragmatically pretty open. [00:29:51] And so there's a ripple effect that all the faculty and students can go up and they're the one throughout the world and permitting that kind of way. So what kind of features do you think makes for good operating system? If you take the lessons of Unix, you said, you know, make it easy for programmers like that seems to be an important one. But also Unix turned out to be exceptionally robust and efficient. Right. So is that an accident when you focus on the programmer or is that a natural outcome? [00:30:31] I think part of the reason for efficiency was that it began on extremely modest hardware, very, very, very tiny. And so you couldn't get carried away. [00:30:41] You couldn't do a lot of complicated things because you just didn't have the resources, i.e. the processor speed or memory. [00:30:49] And so that enforced a certain minimal of mechanisms and maybe a search for generalizations so that you would find one mechanism that served for a lot of different things rather than having lots of different special cases. I think the file system in Unix is a good example of that file system interface in its fundamental form is extremely straightforward, and that means that you can write code very, very effectively for the file system. [00:31:16] And then one of those ideas, one those generalisations, is that, gee, that file system interface works for all kinds of other things as well. [00:31:23] And so in particular, the idea of reading and writing to devices is the same as reading and writing to a disk that has a file system and then that gets carried further in other parts of the world, processes become. [00:31:38] In effect, files in a file system in the Plan nine operating system, which came along, I guess in the late 80s or something like that, took a lot of those ideas from the original Unix and tried to push the generalization even further so that in planning a lot of different resources or file systems, they all share that interface. So that would be one example where finding the right model of how to do something means that an awful lot of things become simpler. [00:32:05] And it means, therefore, that more people can do useful, interesting things with them without having to think as hard about it. So you said you're not a very good programmer. You're the most modest human being, OK, but you'll continue saying that I understand how this works, but you do radiate a sort of love for programming. So let me ask, do you think programming is more an art or science is a creativity or kind of rigour? [00:32:33] I think it's some of each. It's some combination of some of the art is figuring out what it is that you really want to do. What should that program be? What what would make a good program? And that's some understanding of what the task is, what the people who might use this program want. [00:32:50] And I think that's that's art in many respects. The science part is trying to figure out how to do it well. [00:32:57] And some of that is a real computer science stuff, like what algorithm should we use at some point? Mostly in the sense of being careful to use algorithms that will actually work properly or scale properly, avoiding quadratic algorithms when a linear algorithm should be the right thing. [00:33:18] That kind of more formal view of it. [00:33:21] Same thing for data structures, but also it's, I think, an engineering field as well. And engineering is not quite the same as science because engineering, you're working with constraints. [00:33:32] You have to figure out not only so what is a good algorithm for this kind of thing, but what's the most appropriate algorithm given the amount of time we have to compute, the amount of time we have to program, what's likely to happen in the future with maintenance? Who's going to pick this up in the future? All of those kind of things that if you're an engineer, you get to worry about, whereas if you think of yourself as a scientist, well, you can maybe push them over the horizon in a way. [00:33:59] And if you're an artist, what's that? [00:34:02] So just on your own personal level, what's your process like writing a program, say, a small and large sort of tinkering with stuff and you just start coding right away and just kind of evolve iteratively with a loose notion? [00:34:20] Or do you plan on a sheet of paper first and then kind of design in what they teach you in the kind of software engineering course as an undergrad or something like that? What's your process like? [00:34:31] It's certainly much more the informal incremental. First, I don't write big programs at this point. It's been a long time since I wrote a program that was more than I call it, a few hundred or more lines, something like that. Many of the programs are right are experiments for either something I'm curious about or often for something that I want to talk about in a class. And so those necessarily tend to be relatively small. [00:34:56] A lot of the kind of code I write these days tends to be for sort of exploratory data analysis where I've got some collection of data and I want to try and figure out what on earth is going on in it. And for that, those programs tend to be very small. Sometimes you're not even programming, you're just using existing tools like counting things, or sometimes you're writing OK scripts, because two or three lines will tell you something about a piece of data. [00:35:21] And then when it gets bigger, well, then I will probably write something in Python because that scales better up to call it a few hundred lines or something like that has been a long time since I wrote programs that were much more than that. [00:35:35] Speaking of data exploration and OK, first, what is OK, so AKA's a scripting language that was done by myself, El Eho and Peter Weinberger. [00:35:47] We did that originally in the late 70s was a language that was meant to make it really easy to do quick and dirty tasks like counting things or selecting interesting information from basically all text files, rearranging it in some way or summarizing it runs a command on each line of file. [00:36:08] And there's it's still exceptionally widely used today. Oh, absolutely. Yeah. [00:36:13] It's so simple and elegant, sort of the way to explore data. Turns out you can just write a script that does something seemingly trivial in a single line and that giving you that slice of the data somehow reveals something fundamental about the data. And that keeps that seems to work still. [00:36:34] Yeah, it's very good for that kind of thing. That's sort of what it was meant for. I think what we didn't appreciate was that the model was actually quite good for a lot of data processing kinds of tasks and that it's kept going as long as it has, because at this point it's over 40 years old and it's still, I think, a useful tool. [00:36:53] And well, this is paternal interest, I guess. But I think in terms of programming languages, you get the most bang for the buck by learning, OK? [00:37:01] And it doesn't scale the big programs, but it does pretty, pretty darn well on these little things where you just want to see all the somethings in something. [00:37:11] So, yeah, I find I probably write more than anything else at this point. [00:37:15] So what kind of stuff do you love about, OK, like is there if you can comment on sort of things that give you joy when you can in a simple program, reveal something about that, it is something that stands out particular features. [00:37:31] I think it's mostly the selection of default behaviors that you sort of hinted at it a moment ago. [00:37:38] What Arktos is to read through a set of files and then within each file it reads through a each of the lines and then on each of the lines. It has a set of patterns that it looks for. That's your program. And if one of the patterns matches there is a corresponding action that you might perform. And so it's kind of a quadruply nested loop or something like that. [00:38:02] And that's all completely automatic. You don't have to say anything about it. You just write the pattern in the action and then run the data by it. And so that paradigm for programming is very natural and effective one. And I think we captured that reasonably well. [00:38:17] And it does other things for free as well. It splits the data into fields so that on each line there's fields separated by white space or something. And so it does that for free. You don't have to say anything about it and it collects information as it goes along, like what line are we on? How many fields are there on this line? [00:38:35] So lots of things that just make it so that a program which in another language, let's say Python, would be five, 10, 20 lines in alkies, one or two lines. [00:38:45] And so because it's one or two lines, you can do it on the shell. You don't have to open up another whole thing. You can just do it right there. And the interaction with the is just directly. Yeah. [00:38:56] Is there other shell commands that you love? Over the years, like you really enjoy using oh, crap, that's the only one, yeah, grifter's everything. So grap is kind of what is that a simpler version of OK, I would say in some some sense. Yeah. Right. Because what is grap so grippe is it basically searches the input for particular patterns, regular expressions, technically a certain class and it has that same paradigm that Arktos. [00:39:25] It's a pattern action thing, it reads through all the files and then all the lines in each file, but it has a single pattern which is the regular expression you're looking for and a single action print it if it matches. [00:39:37] So it's in that sense it's a much simpler version. [00:39:39] And you could write crap in ORCA's as a one liner and I use grep probably more than anything else at this point just because it's so convenient and natural. [00:39:52] Why do you think it's such a powerful tool? Grap not. Why do you think operating systems like Windows, for example, don't. [00:40:00] Have it sort of you can, of course, I use, which is amazing, now there's Windows for Linux so like that which you could basically use all the fun stuff like I can grab inside of windows, but windows naturally, sort of as part of the graphical interface, the simplicity of grep, sort of searching through a bunch of files and just popping up naturally. Why don't you think that why you think that's unique to the Unix and Linux environment? [00:40:28] I don't know. [00:40:29] It's not strictly unique, but it's certainly focused there. [00:40:33] And I think some of it's the weight of history that Windows came from. Ms. Dos, Ms. Dos was a pretty pathetic operating system, although Kaminen and, you know, undoubtedly large number machines. But somewhere in roughly the 90s, Windows became a graphical system. And I think Microsoft spent a lot of their energy on making that graphical interface, what it is. And that's a different model of computing to model of computing that where you point and click and sort of experiment with menus. [00:41:06] It's a model. [00:41:07] Computing works right rather well for people who are not programmers, just want to get something done, whereas teaching something like the command line to non programmers turns out to sometimes be an uphill struggle. [00:41:19] And so I think Microsoft probably was right and what they did. Now, you mentioned whistle or whatever it's called. [00:41:25] The next question I wonder, what's is that? I've never actually pronounced the whistle. I like it. I have no idea. [00:41:33] But there have been things like that for a long cygwin, for example, which is a wonderful collection of take all your favorite tools from Unix and Linux and just make them work perfectly on Windows. And so that's something that's been going on for at least 20 years, if not longer. [00:41:47] And I use that on my one remaining Windows machine routinely because it's for if you're doing something that is batch computing command suitable for command line, that's the right way to do it, because the Windows equivalents are, if nothing else, not familiar to me. [00:42:04] But I should I would definitely recommend to people to if they don't use segment to try whistle. Yes. As a I've been so excited that I could use Barthélémy Bash write scripts quickly in windows. It's changed my life. [00:42:20] OK, what's your perfect programming setup. What computer. What operating system. What keyboard. What. Ed. Yeah, perfect is too strong a word. [00:42:30] It's way too strong a word of what I use by default. I have a at this point a 13 inch MacBook Air which I used because it's kind of a reasonable balance of the various things I need. I can carry it around. It's got enough computing horsepower screens, big enough keyboards, OK? And so I basically do most of my computing on that. I have a big iMac in my office that I use from time to time as well, especially when I need a big screen, but otherwise tends not to be used at much higher ed. [00:43:05] I use mostly Sam, which is an Ed that Rob Pich wrote long ago at Bell Labs and that sorry to interrupt. [00:43:14] Does that proceed? Why post it? Post dates both V.I. and Emacs. It is derived from Rob's experience with Eddie EnVie de. That's the original Eunuch's Ed. Oh, wow. Dated probably before you were born. So what's that actually what's the history of Ed? Can you briefly? Because I used Emax. I'm sorry to say so. Sorry to come up with that. But what's what's the kind of interplay there? So, yeah. [00:43:52] So in ancient ancient times, like call it the first time sharing systems, going back to what you're talking about, there were editors, there was an editor on this that I don't even remember what it was called. [00:44:03] It might have been edit where you could type text program text and it would do something or document text. [00:44:10] You would save the text, save it, you could edit it. [00:44:13] You know, the usual thing that you would get in an editor and Ken Thompson wrote an editor called QED, which was very, very powerful, but these were all totally a command based. They were not most or cursor based because it was before mice and even before cursors, because they were running on terminals that printed on paper. [00:44:33] OK, no, no CRT type displays, Lavonia LEDs. [00:44:38] And so then when Unix came along, Kinderhook took QED and stripped way, way, way down. [00:44:45] And that became an editor that he called it. And it was very simple, but it was a line oriented editor. And so you could load a file and then you could talk about the lines one through the last line and you could, you know, print ranges and lines. You could add text, you could delete text, you could change text, or you could do a substitute command that would change things within a line or within groups of lines. [00:45:06] They can work on a parts of a file. [00:45:07] Essentially, you could work on any part of it, the whole thing or whatever, but it was entirely command line based and it was entirely on paper. [00:45:17] My paper, and that meant that. Yeah, right, real paper. And so if you change the line, you had to print that line using up another line of paper to see what change caused. [00:45:28] OK, yeah. So, Wensing, when CRT displays came along. Yeah. Then you could start to use cursor control and you could sort of move where you where on the screen in without reprinting everything printing. [00:45:44] And one of there were a number of editors there, the one that I was most familiar with and still use is V.I., which was done by Bill Choi. And so that dates from probably the late 70s as a guess, and it took it full advantage of the cursor controls. [00:46:02] I suspected Emax was roughly at the same time, but I don't know. I've never internalized IMEX. [00:46:08] So so I use at this point I stopped using idealized can I use VI sometimes and I use Sam when I can. [00:46:17] And Sam is available on most systems. It was it is available. You have to download it yourself from typically the plan nine operating system distribution. It's been maintained by people there. And so I get home tonight. [00:46:30] I'll try it. It's the S. S fascinating, although my love is with Lisburn Emacs of went into that happy world of stuff. [00:46:42] I think it's of things. [00:46:43] What religion. Where you brought up. Yeah that's true. [00:46:45] That's right. Most of the actual programming I do is C, C++ and Python. But my weird sort of Yeah. My religious upbringing is inless. [00:46:55] So can you take on the impossible task and give a brief history of programming languages from your perspective. [00:47:03] So I guess you could say programming languages started probably in what, the late 40s or something like that. People used to program computers by basically putting in zeros and ones using something like switches on a console and then or maybe calls and paper tapes, something like that. [00:47:22] So extremely tedious, awful, whatever. And so I think the first programming languages were. [00:47:29] Relatively crude assembly languages where people would basically write a program that would convert mnemonics like add add into whatever the bit pattern was that corresponded to an ad instruction, and they would do the clerical work of figuring out where things were so you could put a name on a location in a program and the assembler would figure out where that corresponded to when the thing was all put together and dropped into memory. [00:47:57] And early on, and this would be the late 40s and very early 50s, there were assemblers written for the various machines that people used. You may have seen in the paper just a couple of days ago, Tony Birchard died. He did this thing in Manchester called the called auto code, a language which I knew only by name. But it sounds like it was a flavor of assembly language, sort of a little higher in some ways. [00:48:23] And it replaced a language that Alan Turing wrote, which you put in zeros and ones, but you put it in backwards order because that was hardware worked very hard. [00:48:31] That's right. Yeah, that's right. Backwards. [00:48:35] So assembly language is then let's call that the early 1950s. And so every different flavor of computer has its own assembly language. So the Ed Sacket, it's in a Manchester had it and the IBM whatever, 1790 or 704 or whatever hit it and so on. [00:48:51] So everybody had their own assembly line and assembly languages have a few commands, additions, traction, then branching of some kind if then type of situation. Right. [00:49:00] They have exactly in their simplest form at least one instruction per or one assembly language instruction per instruction in the machine's repertoire. And so you have to know the machine intimately to be able to write programs in it. And if you write an assembly language program for one kind of machine and then you say, gee, that's nice, I'd like a different machine, start over. OK, so very bad. [00:49:23] And so what happened in the late 50s was people realized you could play this game again and you could move up a level in writing or creating languages that were closer to the way the real people might think about how to write code. [00:49:37] And there were, I guess, arguably three or four at that time period. There was Fortran, which came from IBM, which was formula translation meant to make it easy to do scientific and engineering computation is to know that formula. [00:49:51] Translation That's what I stood for. I was COBOL, which is the common business oriented language that Grace Hopper and others worked on, which was aimed at business kinds of tasks. [00:50:01] There was ALGOL, which was mostly meant to describe algorithmic computations. I guess you could argue Basic was in there somewhere. I think it's just a little later. [00:50:11] And so all of those moved the level up. [00:50:13] And so they were closer to what you and I might think of as we were trying to write a program and they were focused on different domains, Fortran for formula, translation, engineering computations, let's say COBOL for business, that kind of thing. [00:50:28] I'm still used today as Fortran probably. Oh yeah, COBOL too. But the deal was that once you moved up that level, then you let's call it Faulknerian. You had a language that was not tied to a particular kind of hardware because different compiler would compile for different kind of hardware. And that meant two things. It meant you only had to write program once, which was very important. And it meant that you could in fact, if you were a random engineer, physicist, whatever, you could write that program yourself, you didn't have to hire a programmer to do it for you might not be as good as you'd get through a programmer, but it was pretty good. [00:51:03] And so it democratized and made much more broadly available the ability to write code. [00:51:08] So it puts the power of programming into the hands of people like you. Yeah, anybody who wants who is willing to invest some time in learning a programming language and is not then tied to a particular kind of computer. [00:51:20] And then in the 70s you get system programming languages of which C is the survivor and what what a system programming language learning programs that programming languages that would take on the kinds of things that were necessary to write so-called system programs, things like text editors or assemblers or compilers or operating systems themselves, those kinds of things. [00:51:43] And Fortran feature rich. They have to be able to do a lot of stuff, a lot of memory management, access processes and all that kind of stuff. They have a process and it's a different flavor. [00:51:53] What they're doing. They're much more in touch with the actual machine in it, but in a positive way. That is, you can talk about memory in a more controlled way. You can talk about the different data types that the machine supports in the way and more ways to structure, organize data. And so the system programming languages. There was a lot of effort in that in the call it the late 60s, early 70s iest. [00:52:19] I think the only real survivor of that. [00:52:23] And then what happens after that? You get things like object oriented programming like. [00:52:28] Just because as you write programs in a language like C at some point scale gets to you and it's too hard to keep track of the pieces and there's no guardrails or training wheels or something like that to prevent you from doing bad things. So C++ comes out of that tradition. [00:52:45] And so then it took off from there. I mean, there's also a parallel, slightly parallel track with a little bit of the functional stuff with Lisp and so on. But I guess from that point is just an explosion of languages. The Java story, there's the JavaScript, there is all the stuff that the cookies these days are doing with the rest and all that. Yeah. So what's to use here? You wrote a book C programming language. What in C is probably one of the most. [00:53:12] Important languages in the history of programming languages. If you kind of look at impact, what do you think is the most elegant or powerful part of see, why did it survive? What did it have such a long lasting impact? I think it found a sweet spot that in of expressiveness that you could rewrite things in a pretty natural way and efficiency, which was particularly important when computers were not nearly as powerful as they are today. [00:53:42] Put yourself back 50 years almost in terms of what computers could do. And that's, you know, roughly four or five generations to decades of Moore's Law. Right. [00:53:54] So expressiveness and efficiency and I don't know, perhaps the environment that it came with as well, which was Unix. So it meant if you wrote a program, it could be used on all those computers that ran Unix. And that was all of those computers because they were all written in C and that which was Unix, the operating system itself was portable, as were all the tools. [00:54:15] So it all worked together again in one of these things where things feed on each other in a positive cycle. [00:54:23] What did it take to write sort of a definitive book, probably the definitive book on all of programming, like it's more definitive to a particular language than any other book on any other language, and did two really powerful things, which is popularized the language. [00:54:39] And at least from my perspective, maybe you can correct me in second is create a standard. Of how, you know, the how this language is supposed to be used and applied. So what did it take? Did you have those kinds of ambitions in mind when working on that? [00:54:55] Is some kind of joke? [00:54:58] No, of course not. The next. It's an accident of of timing, skill and just luck. [00:55:05] A lot of it is clearly timing was good. Now, Dennis and I wrote the book in 1977 on this. [00:55:11] Yeah, right. And at that point, Unix was starting to spread. I don't know how many there were, but it would be dozens to hundreds of Unix systems. [00:55:20] And C was also available on other kinds of computers that had nothing to do with Unix. [00:55:25] And so the language had some potential and there were no other books on C and Bell Labs was really the only source for it. [00:55:37] And Dennis, of course, was authoritative because it was his language and he had written the reference manual, which is a marvelous example of how to write a reference manual reading. Very, very well done. So I twisted his arm until he agreed to write a book and then we wrote a book. And the virtue or advantage, at least I guess, of going first is that then other people have to follow you if they're going to do anything. [00:56:01] And I think it worked well because. Dennis was a superb writer, I mean, he really, really did, and the reference manual in that book is his period. I had nothing to do with that at all. [00:56:15] So just crystal clear prose. Very, very well expressed. [00:56:19] And then he and I wrote most of the expository material, and then he and I sort of did the usual ping ponging back and forth of, you know, refining it. [00:56:30] But I spent a lot of time trying to find examples that would sort of hang together and that would tell people what they might need to know. What about the right time that they should be thinking about needing it? And I'm not sure it completely succeeded, but it mostly worked out fairly well. [00:56:45] What do you think is the power of example? [00:56:47] I mean, you're you're the creator, at least one of the first people to do the Hello World Program, just like the example, if aliens discover our civilization hundreds of years from now, it'll probably be hello world programs just to have broken robot communicating with them with the world. [00:57:07] So what? And that's a representative examples of what what do you find powerful about examples? [00:57:13] I think a good example will tell you how to do something and it will be representative of you might not want to do exactly that, but you will want to do something that's at least in that same general vein. [00:57:27] And so a lot of the examples in the book were picked for these very, very simple, straightforward text processing problems that were typical of Unix. I want to read input and write it out again. [00:57:40] There's a copy command. I want to read input and do something to it and write it out again. There's a grip. [00:57:46] And so that kind of find things that are representative of what people want to do and spell those out so that they can then take those and see the the core parts and modify them to their taste. [00:58:02] And I think that a lot of programming books that I do, I don't look at programming books a tremendous amount these days. But when I do, a lot of don't do that. [00:58:11] They don't give you examples that are both realistic and something you might want to do. Some of them are pure syntax. [00:58:20] Here's how you add three numbers will come on. I could figure that out. Tell me how I would get those three numbers into the computer and how he would do something useful with them and then how I put them back out again. [00:58:31] Neatly formatted, and especially if you follow the example, there is something magical of doing something that feels useful. Yeah, right. [00:58:38] And I think it's the attempt is absolutely not perfect. But the attempt in all cases was to get something that was going to be either directly useful or would be very representative of useful things that a programmer might want to do. But within that vein of fundamentally text processing, reading text, doing something, writing text. So you've also written a book on goal language. That admits I worked at Google for a while and I've never used go well, you missed something. [00:59:11] Well, I know I've missed something for sure. I mean, so go and rush the two languages that I hear very spoken very highly of, and I wish I would like to try. Well, there's a lot of them. There's Julia. There's there's all these incredible modern languages. But if you can comment before or maybe comment on what do you find, where does go sit in in this broad spectrum of languages? And also how do you yourself feel about this wide range of powerful, interesting languages that you may never even get to try to explore now because of time? [00:59:48] So I think so. [00:59:49] Go, go first comes from that same Bell Labs tradition in part not exclusively, but two of the three creators, Ken Thompson and Rob Place. Literally the people. Yeah, the people. [01:00:02] And then with this very, very useful influence from the European school in particular, the close influence through Robert Greaseman, who was, I guess, the second generation down student at. And so that's an interesting combination of things. [01:00:20] And so some ways I go captures the good parts of C. It looks sort of like C. It's sometimes characterized as C for the 21st century. [01:00:31] On the surface, it looks very, very much like C. But at the same time, it has some interesting data structuring capabilities. [01:00:38] And then I think the part that I would say is particularly useful and again, I'm not a go expert in spite of coauthoring the book, about 90 percent of the work was done by Alan Donovan, my co-author, who is a go expert. But Go provides a very nice model of concurrency. It basically the cooperating, communicating sequential processes that Tony Hawk set forth. [01:01:06] Jeez, I don't know, 40 plus years ago. [01:01:09] And go routines are, to my mind, a very natural way to talk about parallel computation. And in the few experiments I've done with them, they're easy to write. And typically it's going to work and very efficient as well. [01:01:24] So I think that's one place where go stands out that that model of parallel computation is very, very easy and nice to work with. [01:01:33] Just to comment on that, do you think she foresaw or the early Unix days for sore threads and massively parallel computation? [01:01:42] I would guess not really. I mean, maybe it was seen, but not at the level where it was something you had to do anything about for a long time. [01:01:52] Processor's got faster and then processors stopped getting faster because of things like power consumption and heat generation. [01:02:03] And so what happened instead was that instead of processors just getting faster, there started to be more of them. And that's where that parallel thread stuff comes in. [01:02:14] So if you can comment on the all the other languages that break your heart, then you'll never get to explore them. Or how do you feel? A lot of the full variety? [01:02:24] It's not breaking my heart, but but I would love to be able to try more of these languages. The closest I've come is in class that I often teach in the spring here. It's a programming class and I often give I have one sort of small example that I will write in as many languages as I possibly can. I've got it in 20 languages at this point and and that. [01:02:49] So I do a minimal experiment with a language just to say, OK, I have this trivial task which I understand the task and it should. [01:02:56] It takes fifteen lines, an arc and not much more in a variety of other languages. [01:03:01] So how big is it, how fast does it run and what pain did I go through to learn how to do it? [01:03:08] And that's a it's like Antec data, right? [01:03:12] It's a very, very, very narrowly lead data. I like that. So, yeah, but it's still it's a little sample because you get the I think the hardest step of the programming language is probably the first step. Right. So there you're taking the first step. Yeah. And so my experience with some languages is very positive, like Lua, a scripting language I never used and I took my little program. [01:03:36] The program is a trivial format or it just takes in lines of text of varying lengths and it puts a mote in lines that have no more than 60 characters on each line. So I think it was just kind of the flow process in a browser or something. So it's very short program. And in Lua I downloaded Lewine in an hour. [01:03:57] I had it working, never having written, lured my life, just going with all my documentation. I did the same thing in Skalla, which you can think of as a. Flavor of Java, equally trivial. I did it in high school, it took me several weeks, but it did run like a turtle and and I did it in Fortran 90. [01:04:21] And it was painful, but it worked. And I tried it in Rust and it took me several days to get it working because the model of memory management was just a little unfamiliar to me. And the problem I had with Rust, and it's back to what we were just talking about, I couldn't find good consistent documentation on Rust. [01:04:38] Now, this was several years ago and I'm sure things have stabilized. But at the time, everything in the Restoril seemed to be changing rapidly. And so you would find what looked like a working example and it wouldn't work with the version of the language that I had. [01:04:51] So it took longer than it should have rushed is a language I would like to get back to, but probably won't. I think one of the issues you have to have something you want to do. And if you don't have something that is the right combination, I want to do it. [01:05:05] And yet I have enough disposable time, whatever to make it worth learning a new language at the same time. [01:05:13] It's never going to happen. So what do you think about another language of JavaScript that this. Well, let me just sort of comment on what I said when I was brought up, sort of JavaScript was seen as the probably like the ugliest language possible, and yet it's quite arguably quite possibly taking over not just the front and the back end of the Internet, but possibly in the future, taking over everything because they've now learned to make it very efficient. [01:05:44] Yeah. And so what do you think about this? [01:05:46] Yeah, well, I think you captured a lot of ways when it first came out. JavaScript was deemed to be fairly irregular in an ugly language and certainly in the academy. If you said you were working on JavaScript, people would ridicule you. It was just not fit for academics to work on. [01:06:00] I think a lot of that has evolved. Language itself has evolved, and certainly the technology of compiling it is fantastically better than it was. And so in that sense, it's absolutely a viable solution on backhands as well as the front end used. [01:06:18] Well, I think it's a pretty good language. [01:06:20] I've written a modest amount of it and I've played with JavaScript translators and things like that. I'm not a real expert and it's hard to keep up even there with the new things that come along with it. [01:06:34] So I don't know whether it will ever take over the world, I think not, but it it's certainly an important language and worth knowing more about. There's there's maybe to get your comment on something which JavaScript and actually most languages of Python, such a big part of the experience of programming with those languages includes libraries sort of using building on top of the code that other people have built. I think that's probably different from the experience that we just talked about from Unix and CCDs when you're building stuff from scratch. [01:07:10] What do you think about this world of essentially leveraging, building up libraries on top of each other and leveraging them? [01:07:16] Yeah, that's a very perceptive kind of question. And one of the reasons programming was fun in the old days was that you were really building it all yourself. [01:07:26] The number of libraries you had to deal with was quite small. Maybe it was print out for the standard library or something like that. [01:07:33] And that is not the case today. [01:07:35] And if you want to do something in you mentioned Python and JavaScript and those are the two fine examples, you have to typically download a boatload of other stuff and you have no idea what you're getting. Absolutely nothing. I've been doing some playing with machine learning over the last couple of days. [01:07:52] And gee, something doesn't work. Well, you pip install this and down comes another gazillion megabytes of something and you have no idea what it was. [01:08:03] And if you're lucky, it works. And if it doesn't work, you have no recourse. There's absolutely no way you could figure out which in these thousand different packages. [01:08:12] And I think it's worse in the NPM environment for JavaScript. [01:08:17] I think there's less discipline, less controller. [01:08:20] And there's aspects of not just not understanding how it works, but there are security issues as robustness issues. So you don't want to run a nuclear power plant using JavaScript? [01:08:29] Essentially, I probably not. So its speaking to the variety of languages. Do you think that variety is good or do you hope think that over time we should converge towards one, two or three programming languages that you mentioned to the bell days when people could sort of the community of it and the more languages you have, the more you separate the communities, the Ruby community, there's the Python community, there's C++ community. Do you hope that they'll unite one day to just one or two languages? [01:09:04] I certainly don't hope you're not sure that that's right, because I honestly don't think there is one language that will suffice for all the programming needs of the world. Are there too many at this point? Well, arguably. [01:09:15] But I think if you look at the sort of the distribution of how they are used, there's something called a dozen languages that probably account for 95 percent of all programming at this point. [01:09:28] And that doesn't seem unreasonable. [01:09:30] And then there's another well, two thousand languages that are still in use that nobody uses and or at least don't use in any quantity. [01:09:40] But I think new languages are a good idea in many respects because they're often a chance to explore an idea of how a language might help. [01:09:50] I think that's one of the positive things about functional languages. For example, they're a particularly good place where people have explored ideas that at the time didn't seem feasible, but ultimately have wound up as part of mainstream languages as well. [01:10:07] Let me just go back as early as recursion lisp and and follow forward functions as first class citizens and pattern based languages and I don't know, closures. [01:10:19] And just on and on and on lambdas. Interesting ideas that showed up first in, let's call it broadly the functional programming community and then find their way into mainstream languages. [01:10:30] Yeah, it's a it's a playground for rebels. Yeah, exactly. [01:10:34] And and so I think the languages in the playground themselves are probably not going to be the mainstream, at least for some while. But the ideas that come from there are invaluable. [01:10:47] So let's go to something that when I found out recently. So I know you've done a million things, but one of the things I wasn't aware of that you had a role in ample and before you interrupt me by minimizing your role in it, which you fabulous for minimizing functions. [01:11:03] Yeah. Minimizing functions. [01:11:04] Right, exactly. I can just say that the elegance in abstraction, power of example is incredible. When I first came to it about 10 years ago or so, can you describe what is the ample language. Sure. [01:11:22] So ample is a language for mathematical programming, technical term. Think of it as linear programming that is setting up systems of linear equations that are. Some sort of system of constraints so that you have a bunch of things that have to be less than this, greater than that or whatever, and you're trying to find a set of values for some decision, variables that will maximize or minimize some objective function. So it's a way of solving a particular kind of optimization problem, a very formal sort of optimization problem, but one that's exceptionally useful. [01:11:59] And it specifies that there's objective function constraints and variables that become separate from the data it operates on. [01:12:07] Right. So the that kind of separation allows you to, you know, put on different hats. One, put the hat of an optimization person and then put another hat of a data person and dance back and forth and and also separate the actual solvers, the optimization systems that do the solving. Then you can have other people come to the table and then build their solver, whether it's linear or nonlinear, convex, non convex, that kind of stuff. [01:12:38] So of what is the use? [01:12:44] Maybe he can comment how you got into that world and what is the beautiful or interesting idea to you from the world of optimization? [01:12:52] Sure. So I preface it by saying I'm absolutely not an expert on this. [01:12:57] And most of the important work in Apple comes from my two partners in crime on that, Bob Forer, who was a professor of in the Industrial Engineering and Management Science Department at Northwestern, and my colleague at Bell Labs, Dave Gay, who was a numerical analyst and optimization person. So the deal is linear programming. Preface this by saying, let's stay with linear programming. Linear program is the simplest example of this. So linear programming is taught in school is that you have a big matrix which is always called A and you say X is less than or equal to be so B as a set of constraints, X is the decision variables and as to how the decision very pulls are combined to set up the various constraints. [01:13:41] So as a Matrix and X and B your vectors and then there's an objective function which is just the sum of a bunch of X's and some coefficients on them. And that's the thing you want to optimize. [01:13:54] The problem is that in the real world, that Matrix A. has a very, very, very intricate, very large and very sparse matrix where the various components of the model are distributed among the coefficients in a way that is totally obvious to anybody. [01:14:12] And so what you need is some way to express the original model, which you and I would write. [01:14:18] You know, we'd write mathematics on the board. The sum of this is greater than the sum of that kind of thing. [01:14:23] So you need a language to write those kinds of constraints. And Bob, for for a long time had been interested in modeling languages, languages that made it possible to do this. There was a modeling language around called Gamze, the general algebraic modeling system, but it looked very much like Fortran was kind of clunky. And so Bob spent a sabbatical year at Bell Labs in 1984, and he and I was in the office across from me. [01:14:49] And it's always geography. [01:14:52] And he and Dave and I started talking about this kind of thing, and he wanted to design a language that would make it so that you could take these algebraic specifications, you know, some Asian signs over sets and that you would write on the board and convert them into basically this a matrix and then pass that off to a solver, which is an entirely separate thing. [01:15:18] And so we talked about the design of the language. I don't remember any of the details of this now, but it's kind of an obvious thing. You're just writing a mathematical expressions in a Fortran like an algebraic but textural like language. And I wrote the first version of this AMPOULES program, my first C++ program, and it's written in C++. [01:15:45] And so I did that fairly quickly. We wrote it was, you know, 3000 lines or something. [01:15:50] So it wasn't very big, but it sort of showed the feasibility of it that you could actually do something that was easy for people to specify models and convert it into something the solver could work with. [01:16:01] The same time, as you say, that model and the data are separate things. So one model would then work with all kinds of different data in the same way, lots of programs do the same thing, but with different data. [01:16:11] So one of the really nice things is the the specification of the models human just kind of like, as you say, human readable. Like I literally I'm urban stuff. I work. I, I would send it to colleagues that I'm pretty sure never programmed. [01:16:26] And they're like just just to understand what optimization problem is I think. [01:16:33] How hard is it to convert that you said there's a first prototype in C++ to convert that into something that could actually be used by the solver? [01:16:41] It's not too bad because most of the solvers have some mechanism that lets them import a model in a form. It might be as simple as the matrix itself and just some representation. [01:16:52] Or if you're doing things that are not linear programming, then there may be some mechanism that lets you provide things like functions to be called or other constraints on the model. [01:17:04] So so all Apple does is to generate that kind of thing. And then Solver deals with all the hard work. And then when the solver comes back with numbers, Apple converts those back into your original form. [01:17:17] So you know how much of each thing you should be buying or making or shipping or whatever. [01:17:23] So we did that in 84 and I haven't had a lot to do with it since, except that we wrote a couple of versions of a book on which is one of the greatest books ever written. [01:17:33] I love that book. [01:17:35] I don't know why it's an excellent book, but for most of it. And so it's really, really well done. It must be a dynamite teacher and typeset in latex. No, no, no. [01:17:45] Are you kidding? However, like in the typography. So I don't know. We did it with Dero. I don't even know what that is. Yeah, exactly. Yeah. [01:17:55] I think it's draft is as a predecessor to the tech family of things, it's a formatter that was done that believes in this same period of the very early 70s that predates tech and things like that by five to 10 years. [01:18:12] But it was nevertheless just I'm going by memories. It was I remember it being beautiful. Yeah, it was nicely moving outside of Unix Sea Org going. [01:18:20] All the things you talked about, all the amazing work you've done, you've also done working graph theory. [01:18:29] Let me ask this, this crazy out there question, if you had to make a bet and I had to force you to make a bet, do you think P equals on P? [01:18:40] The answer is no, although I'm told that somebody asked Jeff Dean if that was under what conditions be legal in P, and he said either P zero or in his one or vice versa, I've forgotten is a lot smarter than I. [01:18:54] Yeah. [01:18:57] So but your intuition is I have no I have no intuition, but I read a lot of colleagues who've got intuition that their betting is. [01:19:04] No, that's the popular that's the popular bet. [01:19:08] OK, so what is computational complexity theory and do you think these kinds of complexity classes, especially as you've taught in this modern world, are still useful way to understand the hardness of problems? [01:19:23] I don't do that stuff. [01:19:24] The last time I touched anything to do with that many years ago was before it was invented because it's literally true. I did my Ph.D. thesis on four big notation, you know, absolutely. Before I did this in 1968. [01:19:41] And I worked on graph partitioning, which is this question. You've got a graph that is nodes and edges kind of graph and the edges have weights and you just want to divide the nodes into two piles of equal size so that the number of edges that goes from one side to the other is as small as possible. And we developed. [01:19:59] So that problem is hard. [01:20:03] Well, as it turns out, I worked with Shamblin at Bell Labs on this and we were never able to come up with anything that was guaranteed to give the right answer. [01:20:11] We came up with heuristics that worked pretty darn well and I peeled off some special cases for my thesis, but it was just hard. [01:20:19] And that was just about the time that Steve Cook was showing that there were classes of problems that appeared to be really hard of witchcraft. [01:20:25] Partitioning was one. [01:20:27] But this my expertise, such as it was, totally predates that development. [01:20:33] I think. So the heuristic, which now carries the two years names for the traveling salesman problem for the graph partitioning, that was like how did you you weren't even thinking in terms of classes. You were just trying to find no such idea, a heuristic that kind of does the job pretty well. [01:20:51] You're trying to find eat something that did the job and there was no nothing that you would call that's a closed form or algorithmic thing that would give you a guaranteed right answer. [01:21:01] I mean, compare graph partitioning to Max Flamin Cut or something like that, because that's the same problem, except there's no constraint on the number of nodes on one side or the other of the cut. And that means it's an easy problem, at least as I understand it, whereas the constraint that says the two have to be constrained in size makes it a hard problem. [01:21:22] Yes, the Robert Frost has that poem. We had to choose two paths. So why did you. [01:21:29] Is there another alternate universe in which you pursued the Don Knuth path of, you know, algorithm designs and are not smart enough, smart enough or you're infinitely modest, but so you procedure kind of love of programming. [01:21:48] I mean, when you look back to those, I mean, just looking into that world, does that just seem like a distant world of of theoretical computer science then? Is it fundamentally different from the world of programming? [01:22:01] I don't know. I mean, certainly, in all seriousness, I just didn't have the talent for it. I when I got here as a grad student at Princeton and I started to think about research at the end of my first year or something like that, I worked briefly with John Hopcroft, who is absolutely you know, you mentioned Turing Award winner, etc., a great guy. And it became crystal clear I was not cut out for this stuff, period, OK? [01:22:26] And so I moved into things where I was more cut out for it. [01:22:30] And that tended to be things like writing programs and ultimately writing books. [01:22:37] You've said that in Toronto as an undergrad, you did a senior thesis or literature survey on artificial intelligence. This was 1964, correct. [01:22:49] What was the A.I. landscape ideas, dreams at that time? [01:22:54] I think that was one of the well, you've heard of A.I. Winters. This is whatever the opposite was, a summer or something. [01:23:00] It was one of these things where people thought that, boy, we could do anything with computers, that all these hard problems we could computers will solve them. [01:23:09] They will do machine translation. [01:23:11] They will play games like chess and they will do, you know, prove theorems and geometry. [01:23:19] There are all kinds of examples like that where people thought, boy, we could really do those sorts of things. [01:23:26] And, you know, I read the Koolaid in some sense, a wonderful collection of papers called computers and thought that was published in about that era. And people were very optimistic. And then, of course, it turned out that what people thought was just a few years down the pike, I was more than a few years down the pike. [01:23:48] And some parts of that are more or less now sort of under control. We finally do play games like Go and Chess and so on, better than than people do. But there are others on machine translation is a lot better than it used to be. [01:24:02] But that's, you know, 50 close to 60 years of progress and a lot of evolution in hardware and a tremendous amount more data upon which you can build systems that actually can learn from some of that. [01:24:16] And the the infrastructure to support developers working together like an open source move. The Internet period is also empowering. But what lessons do you draw from that? The opposite of winter, that optimism? [01:24:31] Well, I guess that the lesson is that in the short run, it's pretty easy to be too pessimistic or maybe too optimistic in the long run. You probably shouldn't be too pessimistic. I'm not saying that very well. It reminds me of this remark from Arthur Clarke, science fiction author, who says, you know, when some distinguishment elderly person says that something is erm is possible, he's probably right. [01:24:58] And if he says it's impossible, he's almost surely wrong. But you don't know what the timescale is. Timescales. All right. [01:25:05] So what are your thoughts on this new summer of A.I. now in the work with machine learning in your networks, you've kind of mentioned these studies to try to explore and look into this world that seems fundamentally different from the world of heuristics and algorithms like Search that it's now purely sort of trying to take huge amounts of data and learn learn from that day to write programs from the data. [01:25:31] Yeah, look, I think it's very interesting. I am incredibly far from an expert. [01:25:36] Most of what I know, I've learned from my students and they're probably disappointed in how little I've learned from them. [01:25:43] But I think it has tremendous potential for certain kinds of things. [01:25:47] I mean, games is one where it obviously has had an effect on some of the others as well. [01:25:53] I think there's and this is speaking from definitely not expertise. I think there are serious problems in certain kinds of machine learning, at least because what they're learning from is the data that we give them. And if the data we give them has something wrong with it, then what they learn from it is probably wrong. To the obvious thing is some kind of bias in the data that the data has stuff in it like, I don't know, women aren't as good at men as men. [01:26:21] It's something that's just flat wrong. But if it's in the data because of historical treatment, then that machine learning stuff will propagate that. [01:26:32] And that is a serious worry. And the positive part of that is what machine learning does is reveal the bias in the data and puts a mirror to our own society and in so doing, helps us remove the by. [01:26:48] Helps us work on ourselves. It puts a mirror to ourselves. Yeah, that's an optimistic point of view. And if it works that way, that would be absolutely great. And what I don't know is whether it does work that way or whether the, you know, the mechanisms of machine learning mechanisms reinforce and amplify things that have been wrong in the past. And I don't know. I but I think that's a serious thing that we have to be concerned about. [01:27:15] Let me ask you another question, OK? I know nobody knows, but what do you think it takes to build a system of human level intelligence? That's been the dream from the 60s. We talk about games about. Language about. About image recognition, but really the dream is to create a human level, a superhuman level intelligence. What do you think it takes to do that? And are we close? [01:27:40] I haven't a clue. And I don't know. Roughly speaking, I mean, this was trying to trick you into hypothesising I mean, Turing talked about this in his paper on machine intelligence back, and she's an early 50s or something like that. [01:27:53] And he had the idea of the Turing test. [01:27:55] And I don't know what the Turing test is. It's a good test of and I don't know, it's an interesting test. At least it's in some vague sense objective. Whether you can read anything into the conclusions is a different story. [01:28:07] Do you have worries, concerns, excitement about the future of artificial intelligence? There's a lot of people who are worried and you can speak broadly than just artificial intelligence is basically computing taking over the world in various forms. Are you excited by this future, this possibility of computing being everywhere, or are you worried? [01:28:31] It's some combination of those. [01:28:33] I think almost all technologies over the long run are for good, but there's plenty of examples where they haven't been good either over a long run for some people or over a short run. [01:28:47] And computing is is one of those. And A.I. within it is going to be one of those as well. [01:28:53] But computing broadly, I mean, for just a two day example, there's privacy that the use of things like social media and so on means that and the commercial surveillance means that there's an enormous amount more known about us by people, other, you know, businesses, government, whatever, than perhaps one ought to feel comfortable with. [01:29:16] So that's an example. That's an example of a possible negative negative effect of computing being everywhere. It's it's an interesting one because it could also be a positive coverage correctly. There's a big effort there. [01:29:35] So I, I you know, I've I have a deep interest in human psychology in humans. There seem to be very paranoid about this data thing. [01:29:44] I it but that varies depending on age group. Yes. It seems like the younger folks. So it's exciting to me to see what society looks like 50 years from now, that the concerns about privacy may be flipped on their head based purely on human psychology versus actual concerns or not. [01:30:02] Yeah. What do you think about Moore's Law? Well, you said a lot of stuff. We talked you talked about programming languages in their design and their ideas are coming from the constraints and the systems they operate in. Do you think Moore's Law, the the exponential improvement of systems will continue indefinitely? [01:30:25] There's there's a mix of opinions on that currently. Or do you think. Do you think there will be. Do you think there will be a plateau? [01:30:36] Well, the frivolous answer is no exponential can go on forever. [01:30:41] Run out of something, just as we said, time, scale, matters of if it goes on long enough, that might be all we need. [01:30:48] Right. Won't matter to us. [01:30:50] So I don't know. We've seen places where Moore's Law has changed. For example, I mentioned earlier processor processors don't get faster anymore, but you use that same growth of, you know, ability to put more things in a given area to grow them horizontally instead of vertically, as it were. [01:31:08] So you can get more and more processors or memory or whatever on the same chip. [01:31:12] Is that going to run into a limitation, presumably because, you know, at some point you get down to the individual atoms and so you've got to find some way around that. [01:31:22] Will we find some way around that? [01:31:24] I don't know. I just said that if I say it won't, I'll be wrong. [01:31:27] So perhaps we will. [01:31:29] So I just talked to Jim Keller and he says he actually describes he argues that the Moore's Law will continue for a long, long time because you mentioned the atom. We actually have, I think, a thousand fold increase still decrease and threaten Jazzercise. So possible. Before we get to the Quantum of Solace, there's still a lot of possibilities. He thinks he'll continue indefinitely, which is an interesting, optimistic, optimistic viewpoint. But how do you think the programming languages will change with this increase, whether we hit a wall or not? [01:32:04] What do you think? Do you think there'll be a fundamental change in the way programming languages are designed? I don't know. [01:32:12] But that I think what will happen is continuation of. What we see in some areas, at least, which is that more programming will be done by programs than by people and that more will be done by sort of declarative rather than procedural mechanisms where I say I want this to happen. [01:32:34] You figure out how and that is in many cases, this point domain of specialized languages for narrow domains. [01:32:45] But you can imagine that broadening out. [01:32:48] And so I don't have to say so much in so much detail. [01:32:52] Some collection of software, let's call it languages or reprograms programs or something, will figure out how to do what I want to do. [01:33:02] So increased levels of abstraction. Yeah. And one day, getting to the human level, maybe we can just use that would be possible. So you taught so teach a course computers in our world here at Princeton that introduces computing and programming to non Meijers. What just from that experience? What advice do you have for people who don't know anything about programming but are kind of curious about this world or programming seems to become more and more of a fundamental skill that people need to be at least aware of? [01:33:35] Yeah, well, I could recommend a good book. Was that the book I wrote for the court? [01:33:41] I think this is one of these questions of should everybody know how to program? And I think the answer is probably not. But I think everybody should at least understand sort of what it is so that if you say to somebody, I'm a programmer, they have a notion of what they might be. Or if you say this is a program or this was decided by a computer running a program, that they have some vague, intuitive understanding and accurate understanding of what that might imply. [01:34:09] So part of what I'm doing in this course, which is very definitely for non-technical people, I mean, typical person, and it is a history or English major, try and explain how computers work, how they do their thing, what programming is, how you write a program and how computers talk to each other and what they do when they're talking to each other. [01:34:31] And then I would say nobody very rarely does anybody in that course go on to become a real serious programmer. [01:34:41] But at least they've got a somewhat better idea of what all this stuff is about, not just the programming, but the technology behind computers and communications. [01:34:49] Do they write a do they try and write a program themselves? Oh, yeah. Yeah, very small amount. [01:34:55] I introduce them to how machines work at a level below high level language. [01:35:00] So we have a kind of a toy machine that has a very small repertoire. [01:35:03] It doesn't instructions and they write trivial assembly language programs that wow, that's just if you were to give a flavor of the people of the programming world, of the computing world, what are the examples? Should go with a little bit of assembly to to get a sense at the lowest level of what the program is really doing. [01:35:25] Yeah, I mean, in some sense there's no such thing as the lowest level because you can keep going down. But that's the place where I draw the line. [01:35:32] So the idea that computers have a fairly small repertoire of very simple instructions that they can do like add and subtract and and branch and so on, as you mentioned earlier, and that you can write code at that level and it will get things done. [01:35:50] And then you have the levels of abstraction that we get with higher level languages like Fortran or C or whatever, and that makes it easier to write the code and less dependent on particular architectures. [01:36:03] And then we talk about a lot of the different kinds of programs that they use all the time, that they don't probably realize our programs like they're running Mac OS on their computers or maybe Windows and they're downloading apps on their phones. [01:36:18] And all of those things are programs that are just what we just talked about except at a grand scale. [01:36:25] And it's easy to forget that they're actual programs that people program. There's engineers. I wrote about those things. Yeah, right. [01:36:31] And so in a way, I'm expecting them to make an enormous conceptual leap from their five or ten line toy assembly language thing that adds two or three numbers to, you know, something that is a browser on their phone or whatever. [01:36:48] But but it's really the same thing. [01:36:51] So if you look at the broad in broad strokes of history, what do you think the world like? How do you think the world changed because of computers? It's hard to sometimes see the big picture when you're in it. Yeah, but I guess I'm asking if there's something you've noticed over the years that, uh, like you mentioned, the students are more distracted looking at their now there's a device to look at. Right. Well, I think computing has changed a tremendous amount, obviously. [01:37:19] But I think one aspect of that is the way that people interact with each other, both locally and far away. And when I was, you know, the age of those kids making a phone call to somewhere was a big deal because it cost serious money. And this was in the 60s. Right. [01:37:37] And today, people don't make phone calls. They send text or something like that. So there's a up and down in what people do. [01:37:46] People think nothing of having correspondence, regular meetings, video or whatever with friends or family or whatever in any other part of the world. [01:37:57] And they don't think about that at all. And so that's just the communication aspect of it. And do you think that brings us closer together or does it make us to this, does it take us away from the closeness of human to human contact? [01:38:16] I think it depends a lot on all kinds of things. So I trade mail with my brother and sister in Canada much more often than I used to talk to them on the phone. So probably every two or three days I get something or send something to them. [01:38:31] Whereas 20 years ago I probably wouldn't have talked to them on the phone nearly as much. [01:38:37] So in that sense, I brought my brother and sister and I closer together. That's a good thing. [01:38:42] I watch the kids on campus and they're mostly walking around with their heads down, fooling with their phones to the point where I have to duck them. [01:38:51] Yeah, I don't know that that has brought them closer together. In some ways, there's sociological research that says people are, in fact, not as close together as they used to be. [01:39:03] I don't know whether that's really true, but but I can see potential downsides and kids where you think, come on, wake up and smell the coffee or whatever. [01:39:13] That's right. But if you look at again, nobody can predict the future. But are you excited? Kind of touched just a little bit. They are. But are you excited by the future in the next 10, 20 years that computing will bring. [01:39:28] You were there when there was no computers and now computers are everywhere, all over the world and Africa and Asia and just every every person, almost every person in the world has a device. So are you hopeful, optimistic about their future? I it's mixed if the truth be told. [01:39:49] I mean, I think there are some things about that that are good. I think there's the potential for people to improve their lives all over the place. [01:39:56] And that's obviously good. [01:39:58] And at the same time, at least in the short time, short run, you can see lots and lots bad as people become more tribalistic or parochial in their interests. And it's an enormous amount more of them. And people are using computers and all kinds of ways to mislead or misrepresent or flat out lie about what's going on. And that is affecting politics locally and I think everywhere in the world. [01:40:22] Yeah, the the long term effect on political systems and so on. So who knows. Knows indeed. [01:40:30] Uh, the the the people now have a voice, which is a powerful thing. People who are oppressed have a voice, but also everybody has a voice. And the chaos that emerges from that is fascinating to watch. Yeah. Yeah. It's kind of scary. [01:40:47] If you can go back and relive a moment in your life, one that made you truly happy outside of family or was profoundly transformative. Is there a moment or moments that jump out at you from memory? [01:41:03] I don't think specific moments. I think there were lots and lots and lots of good times at Bell Labs where you would build something and it worked hard at work. [01:41:13] So the moment the work used it. Yeah. And somebody used it and they said, gee, that's neat. [01:41:18] Those kinds of things happened quite often in that sort of golden era in the 70s when Unix was young and it was all this low hanging fruit and interesting things to work on a group of people who kind of we were all together in this. [01:41:34] And if you did something, they would try it out for you. [01:41:37] And I think that was in some sense a really, really good time. [01:41:41] And all. Was Bozak an example of that when you built that and people use that? Yeah, absolutely. [01:41:47] And now millions of people, his and all your stupid mistakes are right there for them to look at. So it's mixed. Yeah, it's terrifying. Vulnerable, but beautiful because it does have a positive impact. And so, so many people. So I think there's no better way to end it. Brian, thank you so much for talking. It was an honor, OK? [01:42:07] My pleasure. Good fun. Thank you for listening to this conversation with Brian Kern and thank you to our sponsors, a sleep mattress and Rickon earbuds. Please consider supporting this podcast by going to a sitcom, Lex and to buy Rakhat dotcom slash. Lex, click the links, buy the stuff. These both are amazing products. It really is the best way to support this podcast and the journey I'm on. It's how they know I sent you and increases the chance that they'll actually support this podcast in the future. [01:42:44] If you enjoy this thing, subscribe on YouTube, review it with five stars, an app, a podcast supported on Patrón or connect with me on Twitter. Àlex Friedman spelled somehow miraculously without the letter E, just F.R. ID man, because when we immigrated to this country we were not so good at spelling. And now let me leave you with some words from Brian Conaghan. [01:43:10] Don't comment. Bad code. Rewrite it. Thank you for listening and hope to see you next time.

本集资源与出处