本集简介
双语字幕
仅展示文本字幕,不包含中文音频;想边听边看,请使用 Bayt 播客 App。
以下是与约翰·卡马克的对话,他被广泛认为是有史以来最伟大的程序员之一。
The following is a conversation with John Carmack, widely considered to be one of the greatest programmers ever.
他是id Software的联合创始人,并作为首席程序员参与开发了多款彻底改变游戏技术、体验及社会地位的游戏,包括《指挥官基恩》、《德军总部3D》、《毁灭战士》和《雷神之锤》。
He was the cofounder of id Software and the lead programmer on several games that revolutionized the technology, the experience, and the role of gaming in our society, including Commander Keen, Wolfenstein three d, Doom, and Quake.
他曾多年担任Oculus VR的首席技术官,协助打造通往虚拟世界的门户,并为Meta规划元宇宙的技术发展路径。
He spent many years as the CTO of Oculus VR, helping to create portals into virtual worlds and to define the technological path to the metaverse at Meta.
而现在,他已将部分注意力转向人工通用智能(AGI)问题的研究。
And now, he has been shifting some of his attention to the problem of artificial general intelligence.
这是本播客时长最久的一次对话,超过五小时,但我仍希望能与约翰进行更多次这样的长谈,我们也正有此计划。
This was the longest conversation on this podcast at over five hours, and still, I could talk to John many many more times, and we hope to do just that.
现在快速花几秒钟介绍一下各位赞助商。
And now a quick few second mention of each sponsor.
详情请查看描述区。
Check them out in the description.
这是支持本播客的最佳方式。
It's the best way to support this podcast.
我们有InsideTracker用于长寿追踪,Indeed用于招聘,Blinkist提供非虚构阅读,Eight Sleep助眠,Athletic Greens提升表现。
We got InsideTracker for longevity, Indeed for hiring, Blinkist for non fiction, Eight Sleep for napping, and Athletic Greens for performance.
明智选择,朋友们。
Choose wisely, my friends.
现在进入完整广告环节。
And now onto the full ad reads.
一如既往,中间不会插播广告。
As always, no ads in the middle.
我尽量让这些内容有趣,但如果你跳过了,还请支持我们的赞助商。
I try to make this interesting, but if you skip them, please still check out our sponsors.
我很喜欢他们的产品。
I enjoy their stuff.
或许你也会喜欢。
Maybe you will too.
本期节目由InsightTracker赞助,这是我用来追踪身体生物数据以指导生活决策的服务。
This show is brought to you by InsightTracker, a service I use to track biological data from my body to make decisions about my life.
顺便说一句,我不是那种试图优化生活中每个细节的人。
By the way, I'm not one of those people that tries to optimize every single aspect of my life.
有些性格类型既被科技吸引,也被这种严苛的优化所吸引——用电子表格追踪生活的每个方面,并认为有可能过上一种最优化的生活。
There are certain personalities that are attracted to tech, are also attracted to this kind of rigorous optimization with, a spreadsheet tracking every single aspects of your life, and you have this notion that it's possible to live an optimal life.
所谓'最优'是由某些可量化的指标定义的。
Optimal defined by some kind of metrics that are measurable.
你知道,就像拥有一个智能家居能自动开关灯那样,有人幻想拥有一个能控制生活方方面面的'智能身体',包括人际关系、饮食、运动、效率等等。
You know, it's like a know, you have a smart home that have lights automatically turn on, in the same way have like a smart body that can control every single aspect of your life, including relationships, diet, exercise, productivity, all that kind of stuff.
我不是那种人。
I am not one of those people.
我几乎不做计划。
I barely make plans.
我不想通过过度计划、过度策略化、过度控制生活的每个细节来破坏生活的浪漫。
I don't really want to ruin the romance of life by over planning, over strategizing, over controlling every single aspect of my life.
我确实尝试让纪律成为生活的一部分,因为这确实很重要。
I do try to have discipline as part of my life because it is true.
我认为Jocko说的有道理,纪律就是自由。
I think that Jocko talks about, you know, discipline is freedom.
当你建立了日常活动的基础,就能在此基础上即兴发挥。
When you have this kind of base of daily activity, you can improvise on top of that.
你可以打破规则,但首先得有规则才能打破。
You can break the rules, but you need to have the rules in order to break them.
所以InsightTracker会收集你身体的数据来辅助决策,但不会强迫你过那种严苛完美的生活。
So, you know, InsightTracker collects data from your body that can help you make decisions about your body, but it doesn't force you to have a kind of very strict, very perfect life.
你依然应该享受生活。
You should still live life.
你依然可以做些傻事,但至少能了解体内状况,并有选择地改善你想提升的方面。
You should still do stupid stuff, but you should have the option to understand what is going on inside your body and how to improve various aspects that you might want to improve.
现在访问insighttracker.com/lex即可享受限时特惠。
Get special savings for a limited time when you go to insighttracker.com/lex.
本期节目由招聘网站Indeed赞助播出。
This show is also brought to you by Indeed, a hiring website.
在我们这短暂的一生中,很少有比我们选择与谁为伴更重要的事情了。
There's very few things as important in this too short life of ours than the people we surround ourselves with.
这意味着家人、朋友,甚至可能是在酒吧偶遇的陌生人,你们畅谈数小时而浑然忘我,很快就能成为挚友。
That means family, friends, maybe even strangers you meet up at a bar and get lost in the conversations with for many hours, and they become fast friends.
生活就是这样运作的。
That's how life works.
总之,你生命中真正花大量时间相处的人,就是与你共事的人。
Anyway, the people you really spend a lot of time with in your life is the people you work with.
我认为对许多人来说,工作不仅仅是金钱的来源。
I think for many of us, work is not just a source of money.
它也是意义和成就感的源泉。
It's also a source of meaning, fulfillment.
因此无论你是员工还是雇主,组建一个值得共同合作的团队是最重要的事情之一,这不仅关乎公司的生产力和成功,更关乎幸福感和成就感。
And so whether you're an employee or an employer, building a team that's worth working together with is one of the most important things you can do, not just for the productivity and success of the company, but just for happiness, fulfillment.
所以你应该为此类目标使用现有的最佳工具。
And so you should use the best tools available for that kind of thing.
Indeed就是这样一个工具。
Indeed is one such tool.
它有一个限时特供的特别优惠。
It has a special offer only available for a limited time.
详情请访问indeed.com/lex。
Check them out at indeed.com/lex.
本期节目还由Blinkist赞助播出,这是我最喜欢的学习新知识的应用。
This show is also brought to you by Blinkist, my favorite app for learning new things.
它收录了史上最伟大的非虚构类书籍的精华摘要,既能帮你筛选未来想读的书,又能重温已读书籍的核心观点。
It has some of the greatest non fiction books ever written on there, summaries of them, and allows you to either pick the books you wanna read in the future or remind yourself the key insights about the books you've already read.
阅读完整书籍是场双重收获的旅程。
Reading a full length book is a journey that has two benefits.
其一是能获取真正深刻的见解,这正是Blinkist能助你一臂之力的地方。
One is you pick up really powerful insights, and that's something that Blinkist can help you with.
在提炼关键见解方面,它比我见过的任何平台都出色。
It's better than any place I've ever seen in terms of distilling the key insights.
但第二个原因——至少我享受阅读非虚构类作品的原因是,它能带你踏上一段旅程,几乎像是穿越时空到另一个地方。
But the second reason, at least I enjoy reading even non fiction, is that it takes you on a journey almost like traveling to another place in time.
你可以真正沉浸其中,想象自己身处那个情境,思考在不同情况下自己会如何应对。
And you get to really sit there in that, and you get to imagine yourself in that, and you get to imagine what would I do in those different situations.
无论是关于生命中最黑暗还是最美好的那些方面,或是历史的片段。
Whether it's some of the darkest or some of the most beautiful aspects of life, of history.
在这些情况下,完整阅读一本书能带来巨大的力量。
And in those cases, there's a lot of power to reading the full book.
但时间有限,所以你应该谨慎选择要完整阅读的书籍。
But time is limited and so you should pick carefully the books that you read fully.
人的一生能读的书终究有限。
You only get so many books in your whole life.
这有点可悲。
It's kind of sad.
就像你一生能交的朋友有限,能去国外或城镇不同区域、不同州、不同国家的旅行次数也有限一样。
Just like you get only so many friends, so many trips you take abroad or to a different part of town, a different part of the state, different part of the country.
你一生能读的书有限,所以要谨慎选择。
You only get a limited number of books, so choose them carefully.
你可以在blinkist.com/lex上获得优惠。
You can get savings at blinkist.com/lex.
本期节目也由Eight Sleep及其Pod Pro床垫赞助播出。
This episode is also brought to you by Eight Sleep, and it's pod pro mattress.
它可以通过应用程序控制温度。
It controls temperature with an app.
内置多种传感器,能分别将床两侧温度最低降至55华氏度。
It has a bunch of sensors, and it can cool you down to as low as 55 degrees on each side of the bed separately.
不必为温度争执不休。
It doesn't have to be a war about temperature.
可以达成妥协,或者其实根本无需妥协。
It can be a compromise or actually doesn't need to be a compromise.
与伴侣同床时,你们可以各自做主,定义属于自己领地的理想温度。
You can live your own sovereign selves and define the temperature that defines your land that belongs to you if you sleep with a partner.
我必须说,人生最愉悦的体验之一就是在凉爽的床上盖着温暖的毯子小憩片刻,让生活的烦恼短暂消失。
I just have to say that I think one of the most pleasant experiences of life is a short nap on a cool bed with a warm blanket when all the concerns of life disappear for just a few minutes.
然后你进入那片梦境,无论它在哪里,无论何时出现,那或许是我们死后会去的地方。
And you go into that dreamland wherever that is, wherever, whenever that is, probably a place we go to after we die.
你能短暂地前往那里一探究竟,然后带着焕然一新的状态回归,继续面对接下来的日子。
You get to go there for a brief moment and see what it's like, and then return refreshed, renewed to take on the rest of the day.
这对我来说就是幸福的源泉。
That's a source of happiness for me.
访问eight sleep.com/lex获取特别优惠。
Check them out for special savings at eight sleep dot com slash lex.
本期节目还由Athletic Greens及其AG1饮品赞助,这是一款全能型日常饮品,助力提升健康和巅峰状态。
This show is also brought to you by Athletic Greens and the a g one drink, which is all in one daily drink to support better health and peak performance.
它取代了我服用的多种维生素,并远远超越之——含有75种维生素和矿物质。
It replaced the multivitamins for me and went far beyond that with seventy five vitamins and minerals.
这是我每天起床后喝的第一样东西。
It's the first thing I drink every day.
我现在每天喝两次。
I drink it twice a day now.
这次对话是与约翰·卡马克进行的。
So this conversation is with John Carmack.
对吧?
Right?
众所周知,他曾经每天只吃一个披萨配一大堆健怡可乐。
And he famously just hate a pizza a day with a bunch of Diet Coke.
他现在仍然喝很多健怡可乐。
He still drinks so much Diet Coke.
我当然也有类似的怪癖,不一定是披萨,但我确实很喜欢健怡可乐。
And I certainly have quirks like that, not pizza necessarily, but I do enjoy diet coke for sure.
我人生中有段时间会喝掉数量惊人的健怡可乐,或者说是零度可乐。
There's been periods in my life where it would just be an embarrassing number of diet cokes or rather coke zeros.
我觉得零度可乐或者百事轻怡要稍微好喝一点。
Those are, I believe a little bit more delicious or Pepsi Max.
那大概是我的最爱。
That's probably my favorite.
总之,百事Max或健怡可乐可以说没什么营养价值。
Anyway, there's arguably not much nutritional value to to a Pepsi Max or diet coke.
所以你应该用维生素、矿物质这类东西来填补营养缺口。
So so you should fill in the nutritional gaps for yourself with vitamins and minerals and all that kind of stuff.
对我来说,Athletic Greens让这件事变得超级简单,因为它为你涵盖了所有基础营养。
To me Athletic Greens just makes that super easy because it covers all the bases for you.
非常重要的一点是,它味道很棒。
And very importantly, it tastes delicious.
再次强调,就像自律带来自由,拥有营养基础是一种自由。
Again, just like discipline is freedom, having a nutritional basis is is is a kind of freedom.
你可以整天禁食,可以吃平时吃的垃圾食品,但至少你获得了身体所需的营养。
You can fast all day, you can eat whatever crap you usually eat, and you're safe.
你可以整天禁食,可以吃平时吃的垃圾食品,但至少你获得了身体所需的营养。
At least you got the stuff that your body needs.
注册athleticgreens.com/lex即可获赠一个月量的鱼油。
They'll give you a one month supply of fish oil when you sign up at athleticgreens.com/lex.
这里是Lex treatment播客。
This is the Lex treatment podcast.
如需支持,请查看简介中的赞助商信息。
To support it, please check out our sponsors in the description.
现在,亲爱的朋友们,有请约翰·卡马克。
And now, dear friends, here's John Carmack.
你写过的第一个程序是什么?
What was the first program you've ever written?
还记得吗?
Do you remember?
嗯。
Yeah.
记得。
I do.
我记得当时在Radio Shack商店里,走到TRS-80电脑前,刚学会用10 print John Carmack这样的基础操作。
So I remember being in a Radio Shack going up to the TRS 80 computers and learning just enough to be able to do 10 print John Carmack.
这其实挺有意思的,虽然我们都知道卡内基和里奇把'hello world'标准化为每种编程语言和每台电脑的第一个程序,但当时我完全没接触过Unix文化或其他标准化体系。
I it's kind of interesting how, of course, I you know, Carnegie and Ritchie kind of standardized hello world as the first thing that you do in every computer programming language and every computer, but not having any interaction with the cultures of Unix or any other standardized things.
那时候就是单纯在想:我该让电脑显示什么呢?
It was just like, well, what am I gonna say?
最后决定显示自己的名字,然后学会了用Go two ten让文字在屏幕上滚动消失。
I'm gonna say my name, and then you learn how to do Go two ten and have it scroll all off the screen.
这确实是我在电脑上完成的第一个操作。
And that was definitely the first thing that I wound up doing on a computer.
我能请教你个编程问题吗?
Can I ask you programming advice?
刚开始学编程时总被告知绝对不能使用goto语句。
I was always told in the beginning that you're not allowed to use go to statements.
说这是非常糟糕的编程习惯。
That's really bad programming.
这是对的还是错的?
Is this correct or not?
在代码中跳转。
Jumping around code.
我们能否探讨一下goto语句看似便利背后的哲学和技术层面,尽管它被认为是不良实践?
Can can we look at the philosophy and the technical aspects of the go to statement that seems so convenient, but it's supposed to be certainly,
在早期的基础编程语言中,并没有真正的循环结构。
back in the day, in basic programming languages, you didn't have proper loops.
那时没有for、while和repeat这些循环语句。
You didn't have four whiles and repeats.
要知道,当时能接触到Pascal语言的人才有这些结构可用。
You know, that was the land of Pascal for people that kind of generally had access to it back then.
所以你只能被迫使用goto语句。
So you had no choice but to use go tos.
当你编写当时所谓的大程序时——比如一千行的BASIC程序就算很大的程序了——这些代码确实容易逐渐变得混乱不堪。
And as you made what were big programs back then, which were a thousand line basic program is a really big program, they did tend to sort of degenerate into madness.
当时没有好的编辑器或代码探索工具,所以你只能在一个地方修修补补。
You didn't have good editors or code exploration tools, so you would wind up fixing things in one place, add a little patch.
结构化编程通常有助于理解是有原因的,但goto语句并非毒药。
And there's reasons why structured programming generally helps understanding, but go tos aren't poisonous.
有时它们是正确的选择。
Sometimes they're the right thing to do.
通常是因为缺少某些语言特性,比如嵌套break之类的功能,有时用goto清理或跳转到错误处理比到处散布多个标志和if语句更好。
Usually, it's because there's a language feature missing, like nested breaks or something where it's it can sometimes be better to do a go to cleanup or go to error rather than having multiple flags, multiple if statements littered throughout things.
但这很罕见。
But but it is rare.
我是说,如果你现在全局搜索我的所有代码,我认为我当前的代码库中应该没有任何goto语句。
I mean, if you grep through all of my code right now, I don't think any of my current code bases would actually have a go to.
但在某些大型游戏引擎的技术底层深处,可能还是会在几个地方用到goto。
But deep within sort of the technical underpinnings of a major game engine, you're gonna have some go tos in a couple places probably.
是啊。
Yeah.
在基础设施层面,越接近机器代码,你就会看到越多goto语句,越多这类hack手段,因为低级编程语言提供的功能集确实有限。
The infrastructure on top of like, the closer you get to machine code, the more go tos you're gonna see, the more of these, like, hacks you're going to see because the set of features available to you in low level programming languages is not is limited.
那么约翰·卡马克,如果我们能聊聊热爱的话,你第一次爱上编程是什么时候?
So print John Carmack, when is the first time, if we could talk about love, that you fell in love with programming?
你说过,这这确实是件特别的事。
You said, like, this this is really something special.
这确实是那种一见钟情的事——从我刚明白计算机是什么开始,我至今记得翻阅百科全书里IBM主机的黑白照片,看着那些盘式磁带机。
It really was something that was one of those love at first sight things where just really from the time that I understood what a computer was, even I mean, I remember looking through old encyclopedias at the black and white photos of the IBM mainframes at the reel to reel tape decks.
对现代人来说可能很难理解那个时代的信息获取方式——我要跑去图书馆,书架上只有几本关于计算机的书,而且内容在当时就已经非常过时。
And for people nowadays, it can be a little hard to understand what the world was like then from information gathering where I would go to the libraries, and there would be a couple books on the shelf about computers, and they would be very out of date even at that point.
信息非常匮乏,但我会抓住能找到的所有资料,如饥似渴地吸收一切。
Just not a lot of information, but I would grab everything that I could find and, you know, devour everything.
每当《时代》或《新闻周刊》有关于计算机的文章,我都会用剪刀剪下来收藏。
Whenever Time or Newsweek had some article about computers, I would, like, cut it out with scissors and put it somewhere.
计算机这个完全按指令行事的概念,对我来说就像魔法般神奇。
It just it felt like this magical thing to me, this idea that the computer would just do exactly what you told it to.
我的意思是,这其中确实有点像神灯猴爪那种问题——你必须对你让它做的事情非常非常小心,但它不会跟你顶嘴。
I mean and there's a little bit of the genie monkey's paw sort of issues there where you'd better be really, really careful with what you're telling it to do, but it wasn't gonna back talk you.
它不会有不同的观点。
It wasn't gonna have a different point of view.
它会执行你让它做的事情。
It was gonna carry out what you told it to do.
如果你掌握了正确的命令,你就能让它做出这些相当神奇的事情。
And if you had the right commands, you could make it do these pretty magical things.
那么你最初写的是什么样的程序呢?
And so what kind of programs did you write at first?
除了打印'约翰·卡马克'之外。
So beyond the print, John Carmack.
我记得在学习过程中,刚开始你只是在学习如何做最基础的事情。
So I can remember as going through the learning process where you find at the start, you're just learning how to do the most basic possible things.
我还记得像RadioShack委托制作的超人漫画那样的东西——故事里超人失去了部分超级大脑,孩子们需要用RadioShack TRS-80电脑进行计算来帮助他完成英雄壮举。
And I can remember stuff like Superman comic that RadioShack commissioned to have it's like Superman had lost some of his super brain, and kids had to use RadioShack TRS 80 computers to do calculations for to help him kind of complete his heroics.
我会找到类似这样的小项目,然后找几本基础书籍来逐步提升自己。
And I'd find little things like that and then get a few basic books to be able to kind of work my way up.
而且,那时候的资源真的非常珍贵。
And, again, it was so precious back then.
我有几本书能教我重要的编程知识。
I had a couple books that would teach me important things about it.
有本书让我开始学习一点汇编语言,还有些BASIC的书籍可以从图书馆借阅。
I had one book that I could start to little learn a little bit of assembly language from, and I'd have a few books on BASIC and some things that I could get from the libraries.
但我早期的目标几乎都是制作各种类型的游戏。
But I my goals in the early days was almost always making games of various kinds.
你知道,我热爱街机游戏和早期的雅达利2600游戏,能在电脑上自己实现这些功能正是我向往的。
You know, I had I loved the arcade games and the early Atari 2,600 games, and being able to do some of those things myself on the computers was very much what I aspired to.
这是个完整的探索过程——如果你只学普通BASIC,就做不出任何动作类游戏。
And it was a whole journey where if you learn normal BASIC, you can't do any kind of an action game.
你只能写文字冒险游戏。
You can write an adventure game.
你可以编写这样的内容:'你在这里要做什么?'
You can write things where you say, what do you do here?
我拿到剑,攻击巨魔,诸如此类。
I get sword, attack, troll, that type of thing.
这些都可以在BASIC环境下实现。
And that can be done in the context of BASIC.
但要实现动态图形效果,只能做到最基础的东西。
But to do things that had moving graphics, they were only the most limited things you could possibly do.
或许可以用低分辨率图形实现《打砖块》或《乒乓球》这类游戏。
You can maybe do Breakout or Pong or that sort of thing in low resolution graphics.
事实上,我最早引以为豪的技术突破之一就是在Apple II电脑上实现的。
And in fact, one of my first sort of major technical hacks that I was kind of fond of was on the Apple two computers.
它有一种低分辨率图形模式——当然那时候所有图形都是低分辨率的——常规模式下是40×40像素的网格,但可以显示16种不同颜色。
They had a had a mode called low resolution graphics where, of course, all graphics were low resolution back then, but, you know, regular low resolution graphics, it was a grid of 40 by 40 pixels normally, but they could have 16 different colors.
我想制作一款类似街机游戏《先锋》的卷轴游戏,让它能垂直向上滚动。
And I wanted to make a game kind of like the the arcade game Vanguard, just a scrolling game, and I wanted to just kind of have it scroll vertically up.
我可以让一艘小飞船四处移动。
And I could move a little ship around.
用BASIC语言勉强能做到这点,但完全重绘整个屏幕是不可能的。
You you could manage to do that in basic, but there's no way you could redraw the whole screen.
我记得当时突然灵光一现——我对硬件控制方式有足够了解,知道文本屏幕和低分辨率图形屏幕本质上是同一个东西。
And I remember at the time just coming up with what felt like a brainstorm to me where I knew enough about the way the hardware was controlled where the text screen and the low resolution graphics screen were basically the same thing.
那些电脑都能流畅地滚动文本屏幕。
And all those computers could scroll their text screen reasonably.
你可以列个清单,它就会把内容往上滚动。
You could do a listing, and it would scroll things up.
我发现只要稍微调整几个我似懂非懂的参数就能切换到图形模式,然后我就能绘制图形了。
And I figured out that I could kind of tweak just a couple things that I barely understood to put it into a graphics mode, and I could draw graphics.
接着我只需在屏幕最底部执行换行操作,系统就会用汇编语言例程(那时我还不会写)把内容整体往上滚动。
And then I could just do a line feed at the very bottom of the screen, and then the system would scroll it all up using an assembly language routine that I didn't know how to write back then.
这可以说是我职业生涯中第一个重要技术突破,后来很多不同领域的工作都与之有相似之处。
So I that was, like, this first great hack that sort of had analogs later on in my career for a lot of different things.
于是我发现自己可以绘制屏幕了。
So I found out that I could draw a screen.
我可以在底部执行换行操作。
I could do a line feed at the bottom.
我们会将它向上滚动一次。
We would scroll it up once.
我可以在底部再画几行内容。
I could draw a couple more lines of stuff at the bottom.
这就是我最初实现屏幕滚动的方式,你知道,这很有趣,因为后来在id software时期这个方法也发挥了重要作用。
And that was my first way to kind of scroll the screen, which I you know, which was interesting in that that played a big part later on in the id software days as well.
所以就是利用硬件设计用于文本输出的特性,实现高效滚动绘制——不必重绘整个屏幕,只需从底部开始绘制。
So do efficient scroll efficient drawing where you don't have to draw the whole screen, but you draw from the bottom using the thing that was designed in the hardware for text output.
对。
Yeah.
直到最近,游戏设计很大程度上都受限于计算机的实际处理能力,很容易就会说'好吧'。
Where so much of until recently, game design was limited by what you could actually get the computer to do, where it's easy to say, like, okay.
我想滚动屏幕。
I wanna scroll the screen.
你只需要以轻微偏移量重绘整个屏幕。
You just redraw the entire screen at a slight offset.
如今这样做完全没问题。
And nowadays, that works just fine.
计算机速度快得离谱。
Computers are ludicrously fast.
但直到大约十年前,人们想做所有这些事情。
But up until a decade ago or so, there were all these things everybody wanted to do.
但如果他们掌握足够编程技能来实现它,运行速度又会太慢而无法提供良好体验,要么慢得离谱,要么刚好慢到让体验失去乐趣。
But if they knew enough programming to be able to make it happen, it would happen too slow to be a good experience, either just ridiculously slow or just slow enough that it wasn't fun to experience it like that.
所以我早期编程工作的主要内容,就是研究如何实现那些大家都知道该怎么运作的功能。
So so much of kind of the first couple decades of the programming work that I did was largely figuring out how to do something that everybody knows how they want it to to happen.
只不过实现速度必须比常规方法快2到10倍。
It just has to happen two to 10 times faster than sort of the straightforward way of doing things would make it happen.
现在情况不同了,因为如今很多事情你只需用最原始的方式处理,结果依然可行。
And it's different now because at this point, lots of things you can just do in the most naive possible way, and it still works out.
你知道吗?
You know?
你几乎不再面临那种需要在该层面进行优化的创意限制或动力。
You don't have nearly the creative limitations or the incentives for optimizing on that level.
这有很多利弊,但总的来说...你知道,我不会像个愤怒的老头对着天空挥拳抱怨'在我们那个年代程序员才叫真编程'。
And there's a lot of pros and cons to that, but I do generally you know, I'm not gonna do the the angry old man shaking my fist at the clouds bit where back in my day, programmers had to do real programming.
这其实很神奇——你现在可以随便选个想法立即实现,不需要成为汇编语言大师或GPU秘术师就能让愿望成真。
You know, it's it's amazing that you can just kind of pick an idea and go do it right now, and you don't have to be some assembly language wizard or deep GPU arcanist to to be able to figure out how to make your wishes happen.
嗯,确实如此。
Well, there's still see, that's true.
但容我戴上'愤怒老头'的帽子...没错。
But let me put on my old man with a fist Yeah.
然后我要说:未来真正具有定义性的东西,仍然需要你在当前系统的极限状态下操作。
Hat and say that probably the thing that will define the future still requires you to operate it at the limits of the current system.
所以我们可能会讨论这个,但如果你谈到构建元宇宙和打造引人入胜的VR体验,这很可能需要你——不是说真的要回到汇编语言层面,而是从精神层面——去突破系统性能的极限。
So we'll probably talk about this, but if you talk about building the metaverse and building a VR experience that's compelling, it probably requires you to not to go to assembly or maybe not literally, but sort of spiritually to go to the limits of what the system is capable of.
是啊。
Yeah.
这也正是虚拟现实特别吸引我的原因,它与早期技术有着千丝万缕的联系——我甚至收藏着些老杂志文章,里面把《毁灭战士》称为虚拟现实体验,要知道在那个年代能看到任何3D画面都算新奇。
And that really was why virtual reality was specifically interesting to me, where it had all the ties to you could say that even back in the early days, I have some old magazine articles that's talking about Doom as a virtual reality experience back when just seeing anything in three d.
可以说我们从最初就一直在尝试构建这类虚拟体验。
So you could say that we've been trying to build those virtual experiences from the very beginning.
在现代虚拟现实时代,尤其是移动端的独立设备上,当你基本上使用手机芯片来产生这些非常沉浸式的体验时,确实需要付出努力。
And in the modern era of virtual reality, especially on the mobile side of things when it's standalone and you're basically using a cell phone chip to be able to produce these very immersive experiences, it does require work.
这还达不到传统主机游戏程序员的操作水平,那种需要查看硬件寄存器并安排所有DMA访问的工作方式。
It's not at the level of what an old school console game programmer would have operated at, where you're looking at hardware registers and you're scheduling all the d n DMA accesses.
但它确实与网页开发者、甚至PC端Steam游戏开发者通常的工作层面有所不同。
But it is still definitely a different level than what a web developer or or even a PC Steam game developer usually has to work at.
而且,再次强调,这很棒。
And, again, it's great.
对于想要在这个光谱两端施展拳脚的人来说,仍有很多机会为世界创造巨大价值。
There's opportunities for people that wanna operate at either end of that spectrum there and still provide a lot of value to the world.
让我问你一个关于偏好的大问题。
Let me ask you sort of a big question about preference.
你认为最好的编程语言是什么?
What would you say is the best programming language?
你最喜欢的,同时也是最优秀的。
Your favorite, but also the best.
纵观你的职业生涯,你被许多人视为有史以来最伟大的程序员。
You've seen throughout your career, you're considered by many to be the greatest programmer ever.
虽然很难给任何人贴上这样的标签,但如果真要选一个人,那非你莫属。
I mean, it's so difficult to place that label on anyone if but if you put it on anyone, it's you.
所以让我问你这些有点荒谬的问题——就像问史上最棒的乐队是哪个——但在你的领域里,最棒的编程语言是什么?
So let me ask you these kind of ridiculous questions of what's the best band of all time, but in your case, what's the best programming language?
任何选择都伴随着各种前提条件。
Everything has all the caveats about it.
所以我现在主要用Python进行AIML相关0类工作。
So what I use so nowadays, I I do program a reasonable amount of Python for AIML sorts of work.
不过我并不是一个地道的Python程序员。
That's I'm not a a native Python programmer.
这是我职业生涯晚期才接触的语言。
It's something I came to very late in my career.
我明白它的优势所在。
I understand what it's good for.
但你不觉得Python是梦语言??
But you don't dream in Python?
我不觉得。
I do not.
它有一些惊人的统计数据,比如当你写一个三重嵌套循环时,Python的执行速度可能比GPU张量运算慢上数千甚至百万倍。。
And it has some of those things where there's some amazing stats when you say, if you just start if you make a loop, you know, a triply nested loop and start doing operations in Python, you can be thousands to potentially a million times slower than a proper GPU tensor operation.
这些数字令人震惊。
And these are staggering numbers.
你知道吗?
You know?
我们几乎在进步速度和其他神奇事物上取得的加速,都可能被这种减速所抵消。
You can be as much slower as we've almost gotten faster in our, you know, our pace of progress and all this other miraculous stuff.
所以你的直觉是关于Python内部的低效问题
So your intuition's about inefficiencies within the Python sort of
它不断给我当头一棒,现在我已经深刻理解了这一点。
It keeps hitting me upside the face where it's gotten to the point now I understand.
这就像是,好吧。
It's like, okay.
如果你在乎Python的性能,就绝对不能写循环。
You just can't do a loop if you care about performance in Python.
你必须想办法将其重新格式化为某种大型向量运算,或者完全在C++库中完成的操作。
You have to figure out how you can reformat this into some big vector operation or something that's going to be done completely within a c plus plus library.
但另一方面,它极其便利,你会看到人们只需导入几个不同的东西,就能拼凑出十年前地球上没人能做到的事情。
But the other hand is it's it's amazingly convenient, and you just see stuff that people are able to cobble together by you just import a few different things, and you can do stuff that nobody on Earth could do ten years ago.
你可以直接从网站上复制粘贴到一个小型教程里完成这件事。
And you can do it in a little cookbook thing that you copy paste it out of a website.
所以这真的很棒。
So that is really great.
当我坐下来进行我认为比较严肃的编程工作时,我仍然使用C++,而且更偏向C风格的C++,我对现代模板元编程这类东西不太感冒。
When I'm sitting down to do what I consider kind of serious programming, it's still in c plus plus, and it's really kind of a c flavored c plus plus at that where I'm not big into the modern template metaprogramming sorts of things.
我看到很多灾难都源于过度抽象。
I see a lot of train wrecks coming from some of that overabstraction.
我花了几年时间深入研究Lisp的历史工作和Haskell,以及函数式编程的某些方面。
I spent a few years really going kinda deep into the kind of the historical Lisp work and and Haskell and some of the functional programming sides of things.
这种思维方式确实很有价值,它彻底改变了我编写C和C++代码的方式——我开始重视避免那些容易失控的随机可变状态。
And there's there is a lot of value there in the way you think about things, and I changed a lot of the way I write my c and c plus plus code based on what I learned about the value that comes out of not having this random mutable state that you kind of lose track of.
因为很多人要经过很长时间才能意识到:问题不在于最初编写程序的时候。
Because something that many people don't really appreciate till they've been at it for a long time is that it's not the writing of the program initially.
而在于程序的整个生命周期——关键不仅在于编写速度或运行速度,更在于它如何能随着情况变化而灵活调整。
It's the whole life span of the program, and that's when it's not necessarily just how fast you wrote it or how fast it operates, but it's how can it bend and adapt as situations change.
我在Meta从事Oculus和VR工作期间真正领悟到的是:代码如何在程序员不断更替的情况下良好交接,如何让新成员快速适应不同领域的工作,以及这其中涉及的其他各种因素。
And then the thing that I've really been learning in my time at Meta with the Oculus and VR work is it's also how well it hands off between a continuous kind of revolving door of programmers taking over maintenance and different things and how you get people up to speed in different areas, and there's all these other different aspects of it.
所以
So
C++是工程师之间交接工作的理想语言吗?
Is c plus plus a good language for handover between engineers?
可能不是最佳选择。
Probably not the best.
这个问题有些非常有趣的方面——有些语言虽然因各种原因不被看好(比如C语言就广受诟病,显然是因为内存安全问题、缓冲区溢出等隐患),
I and there's some really interesting aspects to this where, in some cases, languages that are not that are not generally thought well of for many reasons, like C is derided pretty broadly that, yes, obviously, all of these security flaws that happen with the memory and unsafeness and buffer overruns and the things that you've got there.
但C语言有个被低估的特点:它极其简单。任何人都能快速上手,只要你懂C,基本就能直接参与项目,不需要额外学习各种编程范式——因为C语言本身就没提供多少范式选择。
But there is this underappreciated aspect to the language is so simple, anyone can go and, you know, if you know C, you can generally jump in someplace and not have to learn what paradigms they're using because there just aren't that many available.
而且确实存在一些写得非常出色的C代码。
I think there's, you know and there's some really, really well written C code.
比如在OpenBSD系统里捣鼓时——我甚至能在内核代码里游走,却能完全理解眼前的所有逻辑,这种感觉很棒。
Like, it's I find it great that if I'm messing around with something in OpenBSD, say I mean, I can be walking around in the kernel, and I'm like, I understand everything that's going on here.
对我来说,弄清楚需要做什么来实现所需的修改并不困难。
It's not hard for me to figure out what's you know, what I need to do to to, you know, make whatever change that I need to.
虽然你可以使用更重要的语言,比如Lisp的缺点,但我并不后悔花时间学习Lisp。
While you can have, you know, more significant languages, like, it's a downside of Lisp where I don't regret the time that I spent with Lisp.
我认为它在某种程度上确实帮助了我对编程的思考。
I I think that it I it did help, you know, help my thinking about programming in some ways.
是的。
Yes.
但Lisp最坚定的支持者会说这门语言有多么灵活,如果你写了一个庞大的LISP程序错误,请重新翻译。
But the people that are the biggest defenders of Lisp are saying how malleable of a language it is, that if you write a huge Lisp program, you've basically invented your own kind of language and structure because it's not the primitives of the language you're using very much.
。
It's all of the things you've built on top of that.
。
And then a language like Racket, kind of one of the more modern Lisp versions, it's essentially touted as a language for building other languages.
。
And I understand the value of that for a tiny little project, but the idea of that for one of these long term supported by lots of people kind of horrifies me, where all of those abstractions that you're like, okay.
在你没完全掌握我们构建的这些上层架构之前,别想碰这段代码。
You can't touch this code till you educate yourself on all of these things that we've built on top of that.
有趣的是,当谷歌推出Go语言时,很多批评声音都在说,哇。
And it was interesting to see how, when Google made Go, a lot of the criticisms of that are it's like, wow.
这根本算不上是一门前沿语言。
This is not a state of the art language.
这门语言过于简单甚至原始,你能看到编程语言界的行家们对它嗤之以鼻。
This language is just so simple and almost crude, and you could see the programming language people just looking down at it.
但它似乎确实很受欢迎,基本上是在说:这就是C语言的精华部分。
But it does seem to be quite popular as basically saying, this is the good things about C.
任何人都能快速上手使用它。
Everybody can just jump right in and use it.
你不需要重构思维方式就能用它写出好代码。
You don't need to restructure your brain to write good code in it.
所以我希望自己能有更多机会用Go语言做些项目。
So I I wish that I had more opportunity for doing some work in Go.
Rust是另一个大家都在谈论的现代语言,我不适合对它做出评价。
Rust is the other modern language that everybody talks about that I'm not fit to pass judgment on.
我做过一些比'Hello World'稍微深入一点的尝试。
I've done, you know, a little bit beyond hello world.
我曾在Rust中写过一些视频解压代码作为练习,但那已经是几年前的事了,之后就没怎么用过。
I wrote some, like, video decompression work in Rust just as an exercise, but that was a few years ago, and I haven't really used it since.
要知道,最好的编程语言通常就是你正在使用的那个。
You know, the best programming language is the one that works generally that you're currently using.
因为另一个陷阱是:在我见过的几乎所有案例中,当人们在项目中混用多种语言时,那都是个错误。
Because that's another trap is in almost every case I've seen when people mixed languages on a project, that's a mistake.
我宁愿只使用一种语言,这样每个人都能参与整个项目的工作。
I would rather stay just in one language so that everybody can work across the entire thing.
比如在Meta,我们有很多使用React框架的项目。
And we have like, at Meta, we have a lot of projects that use kind of React frameworks.
所以这里用JavaScript,核心工作用C++,可能还会用Java与Android系统的其他部分交互。
So you've got JavaScript here, and then you have c plus plus for real work, and then you may have Java interfacing with some other part of the Android system.
这些都是相当糟糕的情况。
And those are all kinda horrible things.
我记得曾经和Facebook的Boz讨论过这个问题,当时我说,真希望我们能直接宣布只招聘C++程序员。
And that was, you know, one thing that I've I remember talking with with Boz at Facebook about it where, like, man, I wish we could have just said we're only hiring c plus plus programmers.
但从Facebook/Meta的角度来看,他认为我们根本找不到足够多的C++程序员。
And and he just thought from the from the Facebook meta perspective, well, we just wouldn't be able to find enough.
要知道,他们那里有成千上万的程序员,C++程序员虽然未必濒临绝迹,但确实能找到更多Java或JavaScript程序员。
I you know, with the thousands of programmers they've got there, it is not necessarily a dying breed, but you can sure find a lot more Java or JavaScript programmers.
我有次跟埃隆提到这个,他对此感到非常震惊。
And I I kinda mentioned that to Elon one time, and he was kind of flabbergasted about that.
他的观点是:你就应该出去找那些符合要求的程序员,不要雇佣那些不会用你指定语言的程序员。
It's like, well, you just you go out and you find those programmers, and you don't hire the other programmers that don't do the languages that you wanna use.
不过现在,SpaceX确实在很多UI相关的工作中使用JavaScript。
But right now, guess, yeah, they're using JavaScript on a bunch of the the SpaceX work for the UI side of things.
当你去找UI程序员时,他们基本都是JavaScript程序员。
When you go find UI programmers, they're JavaScript programmers.
我在想这是不是因为JavaScript程序员太多了,因为我确实认为优秀的程序员是稀缺的。
I wonder if that's because there's a lot of JavaScript programmers, because I I do think that great programmers are rare.
这不仅仅是看统计数据就能说明问题的,如果你只看人们使用了多少种不同的编程语言,那并不能告诉你优秀程序员在用些什么。
That it's not you you know, if you just look at statistics of how many people are using different programming languages, that doesn't tell you the story of what the great programmers are using.
所以你必须真正关注你所说的,也就是语言的基本原理。
And so you have to really look at what you were speaking to, which is the fundamentals of a language.
它鼓励什么,如何鼓励你去思考?
What does it encourage how does it encourage you to think?
它鼓励你构建什么样的系统?
What kind of systems does it encourage you to build?
C++语言中有某种东西包含了创造力的元素,但同时也迫使你在编程时像个成年人一样成熟,
There is something about c plus plus that has elements of creativity, but forces you to be an adult about your programming,
它期望你成为一个成熟的成年人。
which It expects you to be an adult.
它要求你
It you to
强迫你这么做。
force you to.
因此它能够吸引那些愿意在构建大型系统和提出创新解决方案方面发挥创造力的人,同时又能遵循良好的软件工程实践,这些实践适用于现实世界的系统。
And so it's a so it brings out people that are willing to be creative in terms of building large systems and coming up with interesting solutions, but at the same time, have the sort of the good software engineering practices that amend themselves to real world systems.
让我问问你关于另一种语言,JavaScript。
Let me ask you about this other language, JavaScript.
所以,如果我们想象一下,几千年后外星人造访地球,人类早已不复存在,我有种预感,他们发现的大部分系统都会运行着JavaScript。
So if we you know, aliens visit in in thousands of years and humans are long gone, something tells me that most of the systems they find will be running JavaScript.
我甚至觉得,如果我们生活在一个模拟世界里,这个模拟很可能就是用JavaScript编写的。
I kind of think that if the simulate if we're living in a simulation, it's written it's written in JavaScript.
你知道,长期以来,甚至到现在,JavaScript都没有得到应有的尊重,然而它却运行着世界上越来越多的系统。
You know, for the longest time, even still, JavaScript didn't get any respect, and yet it runs so much of the world in an increasing number of the world.
有没有可能有一天所有的东西都会用JavaScript编写?
Is it possible that all everything will be written in JavaScript one day?
所以JavaScript背后的工程实践其实相当了不起。
So the engineering under JavaScript is really pretty phenomenal.
让JavaScript运行如此快速的系统,从很多方面来看堪称现代工程学的奇迹。
The the systems that make JavaScript run as fast as it does right now are kind of miracles of modern engineering in many ways.
它确实感觉不是最适合所有应用场景的语言,也不是构建大型应用的最佳分发系统——特别是在缺乏类型系统等支持的情况下。
It does feel like it is not an optimal language for all the things that it's being used for or an optimal distribution system to huge to build huge apps in something like this without type systems and so on.
但我认为对大多数人来说,它基本能完成必要的工作。
But I think for a lot of people, it does reasonably the necessary things.
它仍然是一种C风格的语言。
It's still a c flavored language.
它仍然使用大括号和分号这种语法结构。
It's still a, you know, a braces and semicolon language.
人们接受JavaScript培训后,要理解它的根源并不困难。
It's not hard for people to be trained in JavaScript and then understand the roots of where it came from.
我认为垃圾回收机制对大多数程序来说绝对是件好事。
I think garbage collection is unequivocally a good thing for most programs to be written in.
有趣的是,就在今天早上,我还看到推特上有一群资深游戏开发者在争论垃圾回收机制的优缺点。
It's funny that I still just this morning, I was on I was seeing a Twitter thread of a bunch of really senior game dev people arguing about the the virtues and costs of garbage collection.
你会遇到一些顶尖程序员,他们就是坚决反对。
You will run into some people that are top notch programmers that just say, no.
他们认为这绝对不是什么好事。
This is literally not a good thing.
哦,是因为会让人变懒吗?
Oh, because makes you lazy?
是的。
Yes.
它会让你不去思考问题。
That it makes you not think about things.
但我不同意这个观点。
And I do disagree.
我认为有大量客观数据表明,C和C++程序中出现的漏洞,有些甚至是世界上最优秀的程序员写的。
I think that the there is so much objective data on the the vulnerabilities that have happened in c and c plus plus programs, sometimes written by the best programmers in the world.
就好像没有人能厉害到永远不会在这种语言上栽跟头。
It's like nobody is good enough to avoid ever shooting themselves in the foot with that.
只要你写的C代码足够多,迟早会搬起石头砸自己的脚。
You write enough c code, you're going to shoot yourself in the foot.
对于绝大多数程序来说,垃圾回收机制是非常棒的功能。
And garbage collection is a very great thing for the vast majority of programs.
只有当你处理最严格的实时系统时,才会开始觉得它弊大于利。
It's only when you get into the tightest of real time things that you start saying it's like, no.
在那种场景下,垃圾回收机制的成本确实超过了收益,但这种情况在全球软件中占比不到1%。
The garbage collection has more costs than it has benefits for me there, but that's not 99 plus percent of all the software in the world.
因此JavaScript在这些方面并不糟糕。
So JavaScript is not terrible in those ways.
而且编程的很大一部分其实不在于语言本身。
And and so much of programming is not the language itself.
关键在于围绕它的整个生态系统——各种可调用的库、多样的部署方式、以及它提供的可移植性。
It's the infrastructure around everyone, you know, that surrounds it, all the libraries that you can get and the different stuff that you can ways you can deploy it, the portability that it gives you.
JavaScript在许多方面确实很强大。虽然当我审视时,Web技术栈仍然存在这个问题:即便执行最简单的JavaScript操作,浏览器背后需要经历层层转换才能呈现效果。这个调用栈的深度令人不安,真正能理解所有层级运作原理的人更是凤毛麟角。
And JavaScript is really strong on a lot of those things where for a long time, and it still does if I look at it, the the web stack about everything that has to go when you do something really trivial in JavaScript and it shows up on a web browser to kind of X-ray through that and see everything that has to happen for your one little JavaScript statement to turn into something visible in your web browser, it's very, very disquieting, just the the depth of that stack and the fact that so few people can even comprehend all of the levels that are going on there.
但再次强调,我必须提醒自己不要成为那种沉湎于'美好旧时光'的老顽固,因为显然这里面蕴含着巨大价值。
But it's again, I have to caution myself to not be the in the good old days old man about it because, clearly, there's enormous value here.
这个世界确实在很大程度上依赖着JavaScript运转,而且它并没有分崩离析。
The world does run on JavaScript to a pretty good approximation there, and it's not falling apart.
虽然控制台日志里总能看到各种可怕的问题在发生,但系统仍在勉强运行,几乎没人真正注意到这些。
There's a bunch of scary stuff where you look at console logs and you just see all of these bad things that are happening, but it's still kinda limping along and nobody really notices.
但我的系统设计和系统分析理念始终围绕着——
But so much of my systems design and systems analysis goes around.
你应该理解光速意味着什么。
You should understand what the speed of light is.
比如,在这个场景下理论上能达到的最佳性能是什么?
Like, what would be the best you could possibly do here?
这听起来很糟糕,但在多数情况下,即使比理论极限慢上千倍也完全无碍。
And it sounds horrible, but in a lot of cases, you can be a thousand times off your speed of light velocity for something and it'd still be okay.
事实上,从更大的系统视角来看,这种状态有时反而是最优的——毕竟你总不希望专门请我这样的人去把某个网页提速上千倍。
And in fact, it can even sometimes still be the optimal thing in a larger system standpoint where there's a lot of things that you don't wanna have to parachute in someone like me to go in and say, make this this web page run a thousand times faster.
你知道吗?
You know?
把这个网页应用改造成一个启动时间37毫秒、所有操作响应延迟低于一帧的硬核原生应用,这根本没必要。
Make this web app into a a hardcore native application that starts up in thirty seven milliseconds and everything responds in less than one frame latency, that's just not necessary.
如果有人愿意花几百万美元让我开发这种软件,而他们其实完全可以从培训班随便找个人说'给这个需求开发个应用'——很多时候效率并不是最佳衡量标准。
And if somebody wants to go pay me millions of dollars to do software like that when they can take somebody right out of a boot camp and say, spin up an application for this, often being efficient is not really the best metric.
这种情况在很多领域都存在,就像我们很多电器设备都围绕能效设计,有时却牺牲了其他方面的稳健性或增加了其他成本。未来世界能源可能变得非常廉价,这会改变我们的工程权衡标准——你可以放弃效率来换取真正重要的优势。
And it's like there's that applies in a lot of areas where it's kind of interesting how a lot of our appliances and everything are all built around energy efficiency, sometimes at the expense of robustness in some other ways or higher costs in other ways, where there's interesting things where energy or electricity could become much cheaper in a future world, and that could change our engineering trade offs for the way we build certain things where you could throw away efficiency and actually get more benefits that actually matter.
这是我曾经考虑过的发展方向之一——当我思考'接下来要做什么'时,核能是选项之一。
I mean, that's one of my you know, I've one of the directions I was considering swerving into was nuclear energy when I was kind of like, what do I wanna do next?
当时的选择要么是经济型核裂变,要么是通用人工智能。
It was either gonna be cost effective nuclear fission or artificial general intelligence.
我有个小众观点是:人们不了解核燃料有多便宜,其实就算效率只有四分之一甚至更低...
And one of the one of my pet ideas there is, like, you know, people don't understand how cheap nuclear fuel is, and there would be ways that you could be a quarter the efficiency or less.
但如果能让发电厂成本降低10倍,这可能会带来革命性的创新。
But if it wound up making your plant 10 times cheaper, that could be a radical innovation in something like that.
展开剩余字幕(还有 480 条)
所以有些想法是关于直接裂变能量转换的,比如裂变碎片转换,也许你可以设计出不需要蒸汽涡轮机等设备的东西,即使最终效率较低。
So there's, like, some of these thoughts around, like, direct fission energy conversion, you know, fission fragment conversion that, you know, maybe you milled something that doesn't require all the steam turbines and everything even if it winds up being less efficient.
这在编程中也很常见,了解如果真正深入研究并推进到极致时能实现什么总是好的,因为有时会出现不连续性。
So that applies a lot in programming where there's always it's always good to know what you could do if you really sat down and took it took it far because sometimes there's discontinuities.
比如在用户反应时间方面。
Like, around user reaction times.
在某些点上,1秒和750毫秒之间的差异并不大。
There are some points where the difference between operating in one second and seven hundred and fifty milliseconds, not that huge.
你会在网页统计数据中看到这点,但对大多数可用性指标影响不大。
You'll see it in web page statistics, but most of the usability stuff, not that great.
但如果降到50毫秒,突然间就会感觉惊艳无比。
But if you get down to fifty milliseconds, then all of a sudden, this just feels amazing.
明白吗?
You know?
这就像你的指令被立即执行,而不是发出命令后还要等待响应。
It's just like doing your bidding instantly rather than you're giving it a command, twiddling your thumbs, waiting for it to respond.
因此有时候确实需要全力以赴突破某些临界点,但在许多工作的价值评估中存在广阔的低效区间,多走那一步往往得不偿失。
So sometimes it's important to really crunch hard to get over some threshold, but there are there are broad basins in the value metric for lots of work where it just doesn't pay to even go that extra mile.
有些工匠就是不愿接受这种理念,这完全值得尊重。
And there are craftsmen that, you know, they just don't wanna buy that, and more power to them.
如果有人坚持说'不',
You know, if somebody just wants to say, no.
我的骄傲源于我的作品。
I'm going to be my pride is in my work.
我绝不会做出任何未尽全力的东西。
I'm never going to do something that's not as good as I could possibly make it.
我尊重这种态度,有时我自己也是如此,但我更倾向于关注更大的价值图景。
I respect that, and sometimes I am that person, but I try to focus more on the larger value picture.
你需要选择战场,将资源投入到最终能带来最佳用户价值的领域。
And you do pick your battles, and you deploy your resources in the play that's going to give you sort of the best user value in the end.
如果把地球生命进化看作编程过程,效率似乎并非被优化的首要目标。
Well, if you look at the evolution of life on Earth as a kind of programming effort, it's it seems like efficiency isn't the thing that's being optimized for.
就像自然选择虽然效率低下,但它能不断适应,通过这种适应性过程构建出越来越复杂、越来越智能的系统,最终结果相当有趣。
Like, natural selection is very inefficient, but it it kind of adapts, and through the process of adaptations, building more and more complex systems that are more and more intelligent, the final result is kind of pretty interesting.
因此我对JavaScript也持同样看法。
And so I think of JavaScript the same way.
它就像一团巨大的混沌——不适用的东西会自然消亡,对人们有用的东西会自然存活,从而形成一个庞大的开发者社区不断产出代码,有些代码具有粘性,有些则没有。
It's like this giant mess that, you know, things naturally die off if they don't work, and they if they if they're become useful to people, they kinda naturally live, and then you build this community, large community of people that are generating code, and some code is sticky, some is not.
没人真正清楚哪些部分低效高效或存在临界点,比如代码的可靠性如何。你只能运行它,假设它能工作,然后被意外状况打脸,这种过程非常具有进化论的色彩。
And nobody knows the the inefficiencies or the efficiencies or the breaking points, like how reliable this code is, and you kinda just run it, assume it works, and then get unpleasantly surprised, and then that's very kind of the evolutionary process.
这确实是个很好的类比。我们可以延伸出很多观点——在编程的早期阶段,当你只能使用有限字节工作时。
So that's a really good analogy, and we can go a lot of places with that where in the earliest days of programming when you had finite you could count the bytes that you had to work on this.
那些黑客们会为了比别人的乘法运算少用一条指令而绞尽脑力,代码被雕琢得如此完美。
You had all the the kind of hackers playing code golf to be one less instruction than the other person's multiply routine to kind of get through, and and it was so perfectly crafted.
当你完成一个程序时EBE时,那简直就是一件水晶艺术品,因为当时根本没有那么多偷懒的方式。
It was a crystal piece of artwork when you had a program because there just were not that many you couldn't afford to be lazy in different ways.
而在许多方面,我看到这与符号人工智能工作类似——如果你没有资源说‘好吧,我们这里要做数十亿个可编程权重’
And in many ways, I see that as akin to the symbolic AI work where, again, if you did not have the resources to just say, well, we're gonna do billions and billions of programmable weights here.
你必须将其简化为一种符号化且精心设计的形式。
You have to turn it down into something that is symbolic and crafted like that.
但这绝对不是DNA、生命和生物进化的运作方式。
But that's definitely not the way DNA and life and biological evolution and things work.
一方面,我们体内包含的编程代码如此之少,这几乎令人感到谦卑。
I you know, on the one hand, it's it's almost humbling how little programming code is in our bodies.
你知道吗?
You know?
我们拥有几十亿个碱基对,这些数据多年来都能轻松存进一个U盘里。
We've got a couple billion base pairs, and it's like this all fits on a thumb drive for years now.
而我们的大脑甚至只占其中更小的一部分。
And then our brains are even a smaller section of that.
可能只有50兆字节左右。
You've got maybe 50 megabytes.
这可不是像香农极限那样信息密度完美的传输方式。
And this is not like Shannon limit perfectly information dense conveyances here.
这些就像是混乱的代码。
It's like these are messy codes.
你知道吗?
You know?
它们被分解成氨基酸。
They're broken up into amino acids.
其中很多并不执行重要功能,或者以非常笨拙的方式运作。
A lot of them don't do important things, or they do things in very awkward ways.
但这正是一个不断叠加积累的过程。
But it is this process of just accumulation on top of things.
你需要规模,既需要种群规模来推动这个过程。
And you need you need scale, both you need scale for sort of the population for that to work out.
在早期,五六十年代那个计算机的远古时代——甚至七十年代互联网刚兴起时,据说只有18台主机接入。
And in the early days, in the the fifties and sixties, the the kind of ancient era of computers where you could count when they say, like, when the Internet started even in the seventies, there were, like, 18 hosts or something on it.
当时就是这样一个有限的规模,人们仍在竭力优化每个细节。
It was this small finite number, and you were still optimizing everything to be as good as you possibly could be.
但现在有数十亿设备在运行,一切都在不断发展。
But now it's billions and billions of devices and everything going on.
你可以看到这种非常自然的进化过程:尝试许多新事物,许多事物会失败,当风投投资了错误的技术栈导致项目完全失败或无法扩展时,他们就会损失资金。
And you can have this very much natural evolution going on where lots of things are tried, lots of things are blowing up, venture capitalists lose their money when a startup invested in the wrong tech stack and things completely failed or failed to scale.
但要知道,好的成果确实会从中产生。
But, you know, but good things do come out of it.
观察不同事物发生方式的模仿进化很有趣,比如一开始提到的'Hello World'。
And it's interesting to see the the mimetic evolution of the way different things happen, like mentioning hello world at the beginning.
有趣的是像这样的小事——现在每个程序员都知道'Hello World',而这完全是个随意的决定,源自Unix和C语言的统治地位以及早期的类似例子。
It's funny how some little thing like that where everybody every programmer knows hello world now, and that was a completely arbitrary sort of decision that just came out of the the dominance of Unix and C and early examples of things like that.
所以每天都有数百万次实验在进行,但有些事物确实会脱颖而出,在适应性竞争中获胜——无论是心智空间、编程技术还是其他方面。
So millions of experiments are going on all the time, but some things do kind of rise to the top and win the fitness war for whether whether it's mind space or programming techniques or anything.
比如Stack Exchange上有个叫'Code Golf'的网站,人们用各种语言比赛谁能写出最短的程序来完成特定任务,看到那些精通技艺的大师们挑战编程语言的极限真的很有意思。
Like, there's a site on Stack Exchange called Code Golf where people compete to to write the shortest possible program for a particular task in all the different kinds of languages, and it's really interesting to see folks kind of that are masters of their craft really play with the limits of programming languages.
这景象真的很美。
It's really beautiful to see.
通过所有不同的编程语言,你能看到一些古怪的编程语言和主流语言,比如Python 2和3之间的差异。
And across all the different programming languages, you get to see some of these weird programming languages and mainstream ones, python difference between Python two and three.
你能看到C与C++、Java之间的区别,也能看到JavaScript等等。
You get to see the difference between c and c plus plus and Java, and you get to see JavaScript, all of that.
看到代码高尔夫这类任务揭示出编程语言中蕴含的无限可能性,确实很鼓舞人心。
And it's it's kinda inspiring to see how much depth of possibility there is within programming languages that code golf kind of tasks reveal.
我们大多数人如果从事编程工作,写的都是些相当常规的代码——这是构建大型系统的方式,但很高兴看到这些语言中依然蕴藏着创造性天才的可能性。
Most of us, if you do any kind of programming, you kinda do boring kind of very vanilla type of code, that's the way to build large systems, but it's nice to see that the possibility of creative genius is still within those languages.
这种可能性就蕴藏在那些语言之中。
It's laden within those languages.
既然你再次被公认为史上最伟大的程序员之一,你认为什么造就了一个优秀的程序员?
So given that given that you are once again one of the greatest programmers ever, what do you think makes a good programmer?
或许说,一个优秀的现代程序员。
Maybe a good modern programmer.
我刚在Meta给TPM组织做了场长篇演讲,我最核心的观点是:我们做的一切都应该源于用户价值。
So I just gave a long rant slash lecture at Meta to the TPM organization, and my my biggest point was everything that we're doing really should flow from user value.
要知道,我们做的所有好事,其实我们并非技术人员。
You know, all the good things that we're doing, it's like we're we're not technical people.
就像你不应该仅仅为某个具体事物感到自豪。
It's like you shouldn't be taking pride just in the specific thing.
比如,CodeGolf这类东西是个有趣的解谜游戏,但它真的不应该是你的主要动力。
Like, CodeGolf is the sort of thing it's a fun puzzle game, but that really should not be a major motivator for you.
就像我们在为人们解决问题,或是给他们提供娱乐。
It's like we're solving problems for people or we're providing entertainment to people.
我们正在做的是对人们有价值的事,这会取代他们生活中的其他事物。
We're doing something of value to people that's displacing something else in their life.
所以我们希望提供的净价值超过他们本可以做的事,但他们却选择使用我们的产品。
So we wanna be providing a net value over what they could be doing, but instead they're choosing to use our products.
这就是我的意思,听起来可能老套或俗气,但我从根本上认为这就是让世界变得更美好的方式。
And that's where I mean, it sounds trite or corny, but I fundamentally do think that's how you make the world a better place.
如果你给人们创造的价值超过你和团队付出的成本,那么世界就会变得更美好。
If you have given more value to people than it took you and your team to create, then the world's a better place.
人们从价值较低的事物转向选择使用你们的产品,他们的生活因此变得更美好。
People have they've gone from something of lesser value, chosen to use your product, and their life feels better for that.
如果你们在经济上实现了这一点,那确实是件非常好的事情。
And if you've produced that economically, that's that's a really good thing.
另一方面,如果你们花费了荒谬的金额,就像把大量现金扔进了碎木机,也许你们应该对所做的事情不那么自我感觉良好。
You know, on the other hand, if you spent ridiculous amounts of money, you've just kind of shoveled a lot of cash into a wood chipper there, and you should maybe, you know, not feel so good about what you're doing.
所以对某个具体架构、技术或代码序列感到自豪是可以的——获得一点微笑就像小小的多巴胺刺激——但最高层级的衡量标准应该是你们正在创造有价值的事物。
So being proud about, like, a specific architecture or a specific technology or a specific code sequence that you've done, it's great to get a little smile, like a tiny little dopamine hit for that, but the top level metric should be that you're building things of value.
现在你们可能会陷入关于如何定义用户价值、如何实际量化的争论,这方面可能存在巨大分歧。
Now you can get into the argument about how you you know, what is user value, how do you actually quantify that, and there can be big arguments about that.
但至少很容易就能判断出:
But it's easy to be able to say, okay.
那个愤怒的用户显然没有从你们的产品中获得价值。
This pissed off user there is not getting value from what you're doing.
而那边脸上洋溢着笑容的用户,当某个功能触发时那瞬间的喜悦,就是价值产生的明证。
This user over there with the big smile on their face, I the moment of delight when something happened, there's a value that's happened there.
我是说,你至少得承认用户价值这个概念是存在的。
I mean, if you you have to at least accept that there is a concept of user value.
即便你难以精确量化它,通常也能做出相对比较的论证。
Even if you have trouble exactly quantifying it, you can usually make relative arguments about it.
比如这个方案比那个更好。
Well, this was better than this.
我们已经做出了改进。
We've improved things.
要知道,作为开发者,服务用户就是你的职责所在。
So, you know, being a, you know, being a servant to the user is your job when you're when you're a developer.
开发者。
Developer.
你要创造出对他人有价值的东西。
You You wanna wanna be producing something that, you know, other people are gonna find valuable.
如果你具备技术思维,就要找到正确的杠杆,用最少精力设计出能创造最大价值的方案。
And if you are technically inclined, then finding the right levers to be able to pull, to be able to make a design that's going to produce the most value for the least amount of effort.
And it always has to be, kind of divide there's a ratio there where you it's a problem at the big tech companies, you know, whether it's, you know, MetaGoogle, Apple, Microsoft, Amazon, companies that have almost infinite money.
And it always has to be, kind of divide there's a ratio there where you it's a problem at the big tech companies, you know, whether it's, you know, MetaGoogle, Apple, Microsoft, Amazon, companies that have almost infinite money.
I I mean, I know their CFO will complain that it's not infinite money, but from most developer standpoints, it really does feel like it.
I I mean, I know their CFO will complain that it's not infinite money, but from most developer standpoints, it really does feel like it.
And it's almost counterintuitive that if you're working hard as a developer on something, there's always this thought, if only I had more resources, more people, more RAM, more megahertz, I then my product will be better.
And it's almost counterintuitive that if you're working hard as a developer on something, there's always this thought, if only I had more resources, more people, more RAM, more megahertz, I then my product will be better.
And that sense that at certain points, it's certainly true that if you are really hamstrung by this, removing an obstacle will will make a better product, make more value.
And that sense that at certain points, it's certainly true that if you are really hamstrung by this, removing an obstacle will will make a better product, make more value.
But if you're not making your core design decisions in this fiercely competitive way where you're saying feature a or feature b, you can't just say, let's do both, because then you're not making a value judgment about them.
But if you're not making your core design decisions in this fiercely competitive way where you're saying feature a or feature b, you can't just say, let's do both, because then you're not making a value judgment about them.
You're just saying, well, they both seem good.
You're just saying, well, they both seem good.
I don't wanna necessarily have to pick out which one is better or how much better and tell team b that, sorry, we're not gonna do this because a is more important.
I don't wanna necessarily have to pick out which one is better or how much better and tell team b that, sorry, we're not gonna do this because a is more important.
But that that notion of always having to really critically value what you're doing, your time, the resources you expend, even the opportunity cost of doing something else.
But that that notion of always having to really critically value what you're doing, your time, the resources you expend, even the opportunity cost of doing something else.
要知道,这一点极其重要。
That's, you know, super important.
那么,让我请教你关于如何衡量价值的这些重大讨论。
Well, let me ask you about this the big debates that you're mentioning of how to measure value.
是否有可能用数字化的方式来衡量?还是说可以走乔尼·艾维那种设计师路线——想象某人使用产品时脸上露出微笑,想象使用过程中体验到的爱与喜悦?
Is it possible to measure it kind of numerically, or can you do the sort of Johnny Ive, the designer route of imagining sort of somebody using a thing and imagining a smile on their face, imagining the experience of love and joy that you have when you use the thing.
这是设计视角的考量。如果你开发的是像Linux这样更底层的东西,你会想象可能有开发者遇到并使用它,因此变得更快乐、更高效。
That's from a design perspective, or if you're building more like a low lower level thing for like Linux, you imagine a developer that might come across this and use it and become happy and better off because of it.
那么你如何看待这些不同方式?
So where do you land on those things?
这是可量化的吗?
Is it measurable?
我猜想,像Meta和谷歌这样的公司可能会尝试量化这些指标。
So I imagine, like, Meta and Google will probably try to measure the thing.
他们就像试图优化用户参与度之类的数据。
They'll try to it's like you try to optimize engagement or something.
我们来衡量参与度。
Let's measure engagement.
然后我觉得有种——我是说,我欣赏设计师那种伦理观,比如设想一个无法量化的未来,并努力让那个与今天不同的未来中的某人感到快乐。
And then I think there is a kinda I mean, I I admire the designer ethic of, like, think of a future that's that's immeasurable, and you try to make somebody in that future that's different from today happy.
所以我通常倾向于,如果你能获得任何好的指标,那就一定要倾听数据。
So I do usually favor if you can get any kind of a a metric that's good, by all means, listen to the data.
但你可能在这方面走得太远,我们曾遇到过问题,比如,嘿。
But you can go too far there where we've had problems where it's like, hey.
我们遇到了性能回退问题,因为花哨的新遥测系统正在进行大量文件写入来归档这些数据,因为我们需要收集信息来判断我们的计划是否有效。
We had a performance regression because our fancy new telemetry system is doing a bazillion file rights to kind of archive this stuff because we needed to collect information to determine if we were doing you know, if our plans were good.
所以当信息可用时,绝不应该忽视它。
So when information is available, you should never ignore it.
我是说,所有
I mean, all
使用产品的用户,实际使用产品的人类,大量的人类用户,你可以看到
users using the thing, human beings using the thing, large number of human beings, and you get to see sort of at
所以从零到一的过程中,当你尝试全新事物时,确实需要做出某种程度的猜测。
So there's zero to one problem of when you're doing something really new, you do kind of have to make a guess.
但我在Meta一直强调的一个观点是:我们现在拥有足够多的用户,任何人在VR中想尝试的东西,都会有感兴趣的用户群体。
But one of the points that I've been making at Meta is we have more than enough users now that anything somebody wants to try in VR, we have users that will be interested in that.
你不能凭空提出一个完全未经实践的想法,然后说‘我要这么做,因为我觉得这可能有意思’。
You do not get to make a completely greenfield blue sky pitch and say, I'm going to do this because I think it might be interesting.
我向所有人发起挑战。
I challenge everyone.
无论是通过VR工作替代桌面办公,还是以不同方式与人交流,或是玩游戏,总会有人使用这些技术。
There are going to be people, whether it's, you know, working in VR on your, like, on your desktop replacement or communicating with people in different ways or playing the games.
即使你选择某个我们目前尚未涉足的小众领域,也至少会有成千上万拥有头显设备的用户成为你的目标市场。
There are there are going to be probably millions of people or at least in if you pick some tiny niche that we're not in right now, there's still gonna be thousands of people out there that have the headsets that would be your target market.
我常告诫人们:要关注这些真实用户。
And I tell people, pay attention to them.
不要虚构用户需求。
Don't invent fictional users.
不要为了迎合你设想的市场细分矩阵,虚构出像Alice、Bob、Charlie这样的用户角色。当你拥有真实用户可供合作时,沉迷于假想用户是一种错误。
Don't, you know, make an Alice Bob Charlie that fits whatever matrix of of tendencies that you wanna break the market down to because it's a mistake to think about imaginary users when you've got real users that you could be working with.
但另一方面,为产品保持整体愿景的完整性确实有其价值。
But, you know, on the other hand, there is there is value to having a kind of wholeness of vision for a product.
像Meta这样的公司明白权衡之道,你可以有像SpaceX或史蒂夫·乔布斯时代的苹果这样的企业,那里有一个极具影响力的领导人物,能够进行非常细致的微观管理,直接否决说‘不’。
And companies like Meta have, you know, they understand the trade offs where you can have a company like SpaceX or, you know, Apple in the the Steve Jobs era where you have a very powerful leading personality that, you know, that can micromanage at a very low level and can say it's like, no.
那个手柄需要不同设计,或者那个图标的色调需要调整。
That handle needs to be different or that, that icon needs to change the tint there.
他们显然从中获得了巨大价值。
And they clearly get a lot of value out of it.
同时也有大量员工在离职后讲述关于在那里工作的恐怖经历。
They also burn through a lot of employees that have horror stories to tell about, working there afterwards.
我的观点是,当领导者处于他们能够理解下属所有事务的极限状态,并能对所有情况形成明智见解时,团队才能发挥最佳状态。
My position is that you're at your best when you've got a leader that is at their limit of what they can kind of comprehend of everything below them, and they can have an informed opinion about everything that's going on.
你必须相信,一个拥有三、四十年经验的人,理应具备刚从训练营出来的贡献者所不具备的智慧。
And you take somebody, it's you've gotta believe that somebody that has thirty, forty years of experience, you would hope that they've got wisdom that the the just out of boot camp person, contributing doesn't have.
如果他们表示'那里有问题'
And that if they're like, well, that's wrong there.
你或许不该那样做,或者干脆就别那样做
You probably shouldn't do it that way or or even just don't do it that way.
换种方式来做
Do it another way.
这其中确实有价值,但不能超过某个限度
So there's value there, but it can't go beyond a certain level.
是的
I am yeah.
我是说,我亲历过史蒂夫·乔布斯当着我的面说些技术方面完全错误的话,因为他并不在那个技术层级工作
Mean, I have Steve Jobs stories of him saying things that are just wrong right in front of me about technical things because he was not operating at that level.
但当这种模式奏效时,当你遇到那种全身心投入产品、真正在意每个细节的激情型领导者时,我认为这具有巨大价值
But when it does work and you do get that kind of passionate leader that's thinking about the entire product and just really deeply cares about not letting anything slip through the cracks, I think that's got a lot of value.
但另一方面,也有人主张要建立能自主提出创意的独立团队——这几乎像是反资本主义或反自由市场的观点,他们质疑为何要让伟大领袖来独断专行,毕竟自由市场确实能产生意想不到的成果
But the other side of that is the people saying that, well, we wanna have these independent teams that are bubbling up the ideas because and, like, it's it's almost it's anti capitalist or anti free market to say it's like, want my grand you know, my great leader to go ahead and dictate all these points there where clearly free markets bring up things that, you know, you don't expect.
比如在VR领域,我们见证了许多现象。
Like, in VR, we we saw a bunch of things.
早期人们认为会成为关键应用的领域,结果完全不是那样。而那些可能被决策委员会否决的内容,在某些情况下却取得了巨大成功。
Like, it didn't turn out at all the way the early people thought were gonna be the key applications and things that, you know, would not have been approved by, you know, the the dark cabal making the decisions about what gets into the store turned out to, in some cases, be extremely successful.
所以,确实有段时间我确实提出了一个建议。
So, yeah, I definitely kinda wanted to be there was a point where I did make a pitch.
就是,嘿,
It's like, hey.
让我当VR领域的独裁者,我会把事情搞定。
Make me VR dictator, and I'll go in and get shit done.
但Meta的企业文化不允许这样。
I am and that's just it's not in the culture at Meta.
你懂我的意思吧?
You know?
而且他们明白其中的利弊权衡。
And they they understand the trade offs.
他们和我...这根本不是他们想要的公司模式,也不是他们团队希望运作的方式。
They I and that's just not the way that's not the company that they want, the team that they that they wanna do.
这很耐人寻味,因为VR——我们稍后会深入讨论——对我来说,VR将以何种方式改变世界仍不明确。
It's fascinating because VR, and we'll talk about it more, it's still it's still unclear to me in what way VR will change the world.
因为VR显然将以某种方式从根本上改变这个世界,但具体如何改变尚不明确。
Because it does seem clear that VR will somehow fundamentally transform this world, and it's unclear to me how.
嗯。
Yeah.
对。
Yeah.
而且...
And it's
等你想讨论这个话题时随时告诉我。话题切换。
Let me know when you wanna get into that.
等等,稍等一下。
Well, hold on a second.
嗯。
Yeah.
所以坚持做史上最优秀的程序员。
So in the stick to the the you being the best programmer ever.
好的。
Okay.
早期的时候,你还没有承担带领团队这类成人责任,可以只专注于编程。
In the early days, when you didn't have when when you didn't have adult responsibilities of leading teams and all that kind of stuff, and you can focus on just being a programmer.
约翰·卡马克的高效一天是怎样的?
What did the productive day in the life of John Carmack look like?
敲键盘多少小时?
How many hours is the keyboard?
睡多久?
How much sleep?
大脑运转的能量来源是什么?
What was the source of calories that fueled the brain?
那是什么感觉?
What was it like?
你几点起床的?
What time did you wake up?
在很长一段时间里,我都能保持非常稳定的良好工作状态。
So I was able to be remarkably consistent about what was good working conditions for me for a very long time.
我从来不是那种会通宵工作20小时不间断的程序员。
I was never one of the programmers that I that would do all nighters going through work for twenty hours straight.
通常12小时后我的大脑就开始变得迟钝。
It's like my brain generally starts turning to mush after twelve hours or so.
但努力工作确实很重要,几十年来我一直如此。
But the hard work is really important, and I would work for for decades.
我每周工作60小时。
I would work sixty hours a week.
我每天工作10小时,每周6天,并努力保持高效。
I would work a ten hour day, six days a week, and try to be productive at that.
在我年轻时,没有孩子和其他责任的时候,我的日程安排相当灵活。
Now my schedule shifted around a fair amount when I was young without any kids and any other responsibilities.
我当时采用了一种循环作息,每天大约晚一小时起床,全天候轮转。有时下午两三点才到办公室,然后工作到凌晨或半夜两三点。
I was on one of those cycling schedules where I'd kind of get in an hour later each day and roll around through the entire time, and I'd wind up kind of pulling in at two or three in the afternoon sometimes and then working again past, you know, midnight or two in the morning.
那时只有我一个人在努力推进项目,通常独自待在办公室里。
And that was when it was just me trying to make things happen, I am and I was usually isolated off in my office.
基本上没什么人会打扰我,这样我能完成大量编程工作。
People generally didn't bother me much at in, and I could get a lot of programming work done that way.
后来要送孩子上学之类的事情,我就调整成了更规律的作息。
I did settle into a more normal schedule when I was taking kids to school and things like that.
所以孩子是迫使你每天固定时间起床的关键因素?
So kids were the forcing function that got you to wake up at the same at the same time
我清楚意识到这种作息对工作效率影响不大。如果随性起床,通常每天都会比前一天稍晚些。
each clear to me that there was much of a difference in the productivity with I with that where I kind of feel if I just get up when I feel like it, it's usually a little later each day.
但最近我决定尝试把作息往前调,改成早上八点起床,重新安排日程。
But I just recently made the focusing decision to try to push my schedule back a little bit earlier to getting up at eight in the morning and trying to to shift things around.
比如,我经常在自己身上做实验,研究该怎么做才能更高效。
Like, I'm I'm often doing experiments with myself about what should I be doing to to be more productive.
最近几个月我意识到的一件事是,我经常会去散步或跑步。
And one of the things that I did realize was happening in recent months where I would I would go for a walk or a run.
我每天大约走四英里,通常是在太阳下山时进行,现在德州的天气依然非常炎热。
I I cover, like, four miles a day, and and I would usually do that just as the sun's going down at here in Texas now, and it's still really damn hot.
我会在八点半左右出门,完成运动后洗澡,但这给我的白天留下了一个时间缺口,之后我还有几个小时,有时晚上没人打扰时反而是我效率最高的时候。
But I'd go out at 08:30 or something and cover the time there and then the showering, and it was putting a hole in my day where I would have still a couple hours after that, and sometimes my best hours were at night when nobody else is around, nobody's bothering me.
但这个白天的缺口是个问题,所以就在几周前,我决定做出改变:
But that hole in the day was a problem, so just a couple weeks ago, I made the the change to go ahead and say, alright.
我要稍微早起一点。
I'm gonna get up a little earlier.
我要先完成散步或外出活动,这样就能获得更多不被打断的时间。
I'm gonna do walk or get out there first so I can have more uninterrupted time.
所以我仍在调整这类因素,以优化我的工作效率。
So I'm still playing with factors like this as I kind of optimize my my work efforts.
但你知道,长期以来每周工作60小时是常态。
But it's always been you know, it was sixty hours a week for a very long time.
某种程度上,我心底里其实有点羡慕那些能进行马拉松式编程的程序员。
To some degree, I had a little thing in the back of my head where I was almost jealous of some of the programmers that would do these marathon sessions.
比如戴夫·泰勒就是其中一个典型代表。
And and I had, like, Dave Taylor, one of the guys that he had.
他就是那种会睡在办公桌底下的人,完全符合人们对黑客的刻板印象。
He would be one of those people that would fall asleep under his desk sometimes and all the the kind of classic hacker tropes about things.
而我内心总有点困扰,因为我做不到那样——我无法连续编程20小时,12小时后我就效率低下了。
And a part of me was, like, always a little bothered that that wasn't me, that I I wouldn't go program twenty hours straight because I'm just I'm falling apart and not being very effective after twelve hours.
12小时编程当然没问题,但之后基本就做不出什么聪明的工作了,至少我是这样。
I mean, yeah, twelve hour programming, that's fine when you're doing that, but it never you're not doing smart work much after at least I'm not.
但人的类型各不相同。
But there's a range of people.
很多人骨子里不明白这点:有人每天睡4小时依然思维敏捷,也有人稍微熬夜就完全崩溃。
I mean, that's something that a lot of people don't really get in their gut, where there are people that work on four hours of sleep and are smart and can continue to do good work, but then there's a lot of people that just fall apart.
所以我确实告诉人们,我总是尽量保证八小时睡眠。
So I do tell people that I always try to get eight hours of sleep.
这并不是说要逼自己更努力、起得更早,那样我只会做得更糟。其实只要合理安排优先级,每周工作一百小时的同时仍能保证八小时睡眠。
It's not this, you know, push yourself harder, get up earlier, I just do worse work, where, you know, there's you can work a hundred hours a week and still get eight hours of sleep if you just kind of prioritize things correctly.
但我确实相信要努力工作,多干活。
But I do believe in working hard, working a lot.
我记得有位游戏开发者说过,现在很多人对高强度工作有抵触情绪,我经常为此在网上争论。
I'm there was a comment that game dev made that that I know there's a backlash against really hard work in a lot of cases, and I get into online arguments about this all the time.
他基本意思是:每周四十小时?那简直像兼职工作。
But he was basically saying, yeah, forty hours a week, that's kind of a part time job.
如果你真正投入其中,做自己认为重要且热爱的事,多干就能多出成果。
And if you are really in it, you're doing what you think is important, what you're passionate about, working more gets more done.
当你见识过那种高强度工作的人后,真的很难反驳这种观点——就像,不,
And I it's just really not possible to argue with that if you've been around the people that that work with that level of intensity and just say, it's like, no.
他们真该停下来了。
They should just stop.
我几年前就重新思考过这个问题,当时我用了一个虚构的例子来说明
And we had I kinda came back around to that a couple years ago where I was using the fictional example of, alright.
有些人会一本正经地说,他们认为
Some people say they'll say with a straight face, they think, no.
如果你每周工作超过40小时,你的效率会降低
You you are less productive if you work more than forty hours a week.
他们通常误解了这一点:你工作8小时后每小时的边际产出可能低于峰值时段,但并不意味着你实际完成的工作量减少了
And they're generally misinterpreting things where your your marginal productivity for an hour after eight hours is less than in one of your peak hours, but you're not literally getting less done.
确实存在一个临界点,超过后你会开始出错、表现越来越差,甚至适得其反,但这个临界点绝不是8小时、10小时或12小时
There is a point where you start breaking things and getting worse worse behavior and everything out of it where you're literally going backwards, but it's not at eight or ten or twelve hours.
我用的虚构例子是:想象有一颗小行星即将撞击地球,毁灭全人类
And the fictional example I would use was, imagine there's an asteroid coming to impact you know, to to crash into Earth, destroy all of human life.
你希望埃隆·马斯克和SpaceX团队——那些正在建造拦截器来偏转小行星的人
I do you want Elon Musk or the people working at SpaceX that are building the interceptor that's going to, to deflect the asteroid?
你希望他们五点准时下班吗?
Do you want them to clock out at five?
因为,该死的,他们再工作几个小时只会做出更差的成果。
Because, damn it, they're just gonna go do worse work if they work another couple hours.
而且,你知道的,这看起来很荒谬。
And, you know, it seems absurd.
不过那只是个假设,大家都可以不以为然。
And that's a hypothetical, though, and everyone can dismiss that.
但当新冠疫情来袭时,所有医护人员显然都在拼命工作,我就觉得,好吧。
But then when coronavirus was hitting and you have all of these medical personnel that are clearly pushing themselves really, really hard, and I'd say it's like, okay.
你希望这些科学家研发治疗方法和疫苗、救治所有患者吗?
Do you want all of these scientists working on treatments and vaccines and caring for all of these people?
他们每天工作超过八小时真的会把事情搞砸吗?
Are they really screwing everything up by working more than eight hours a day?
当然,人们会说我是个混蛋才会说这种话,但你知道,这就是事实。
And, of course, people say I'm just an asshole to say something like that, but it's I you know, it's the truth.
工作时间越长,完成的事情就越多。
Working longer gets more done.
嗯,这算是第一层。
Well, so that's kind of the layer one.
但我也想补充一点,至少我认为,根据个人和任务的不同,在那些高峰时段投入更多更努力的工作会让你接下来的一周表现更好。
But I'd like to also say that, at least I believe, depending on the person, depending on the task, working more and harder will make you better for the for the next week in those peak hours.
对某件事的深度投入会让你对其产生某种深刻的理解。
So there's something about a deep dedication to a thing that kinda gets deep in you.
所以,努力工作不仅仅关乎当下产出的工时,更在于它对你未来数周乃至数月产生的影响。
So it's it's the the hard work isn't just about the raw hours of productivity, productivity, it's it's the the it's the thing it does to you in the in the weeks and months after too.
你在某些方面正在磨练自己。
You're tempering yourself in some ways.
而且我觉得,这就像《寿司之神》里演的那样。
And I think, you know, it's like Jiro dreams of sushi.
如果你真的全身心投入制作寿司,日复一日地长时间工作,你就会成为你所做之事的真正匠人。
If you really dedicate yourself completely to making the sushi, like, to to really putting in the long hours day after day after day, you become a true craftsman of the thing you're doing.
当然,现在存在一些讨论:你是否牺牲了很多个人关系?
Now there's, of course, discussions about are you sacrificing a lot of personal relationships?
你是否牺牲了在那段时间里本可以做的许多其他事情?
Are you sacrificing a lot of other possible things you could do with that time?
但如果你纯粹谈论成为某项艺术的大师或工匠,那么投入更多时间不仅仅是为了做更多事。
But if you're talking about purely being a master or a craftsman of your art, that more hours isn't just about doing more.
而是为了在你所做的事情上变得更好。
It's about becoming better at the thing you're doing.
是的。
Yeah.
我也不会反驳那些只想做最低限度工作的人。
And I don't gainsay anybody that wants to work the minimum amount.
他们生活中有其他优先事项。
They've got other priorities in their life.
我要表达的唯一观点并不是每个人都应该努力工作。
My only argument that I'm making, it's not that everybody should work hard.
而是如果你想成就某事,更长时间、更努力地工作就是实现它的途径。
It's that if you want to accomplish something, working longer and harder is the path to getting it accomplished.
那么,让我问问你这个问题。
Well, let me ask you about this then.
那个传说中的工作与生活平衡。
The the mythical work life balance.
对于工程师来说,这似乎是程序员这类职业中的一个特点——努力工作确实能提高生产力,但同时也引发了关于个人关系、家庭这类事情的疑问,你是如何找到工作与生活平衡的?
Is for an engineer, it seems like that's one of the professions in the for for a programmer where working hard does lead to greater productivity in it, but it also raises the question of sort of personal relationships and all that kind of stuff, family, and how are you able to find work life balance?
你有什么建议可以提供,也许能分享一些你个人经验之外的见解?
Is there advice you can give, maybe even outside of yourself?
在你多年的生活经历中,是否在这方面获得了一些智慧?
Have you been able to arrive at any wisdom on this part in your years of life?
我确实认为不同的人有不同的需求,这因人而异。
I do think that there's a wide range of people where different people have different needs.
这不是一个放之四海而皆准的方法。
It's not a one size fits all.
我当然适合我自己的方式。
I am certainly what works for me.
我可以明确地说,我与普通人在很多方面不同——事物对我的影响、我想做的事、我的目标都不同,甚至影响事物的杠杆也不同。比如,我从未感受过倦怠,而我知道许多做出世界领先成果的聪明人却会感到倦怠,这种情况从未发生在我身上。
I I can tell enough that I'm, you know, I'm different than a typical average person in the way things impact me, things that I wanna do, my goals are different, and sort of the the levers to impact things are different, where, you know, I have literally never felt burnout, and I know there's lots of brilliant, smart people that that do world leading work that get burned out, and it's never hit me.
我从未有过那种‘我根本不在乎这个’的时刻。
You know, I've never been at a point where I'm like, I'm I just don't care about this.
我从未产生过‘不想再继续做这个’的念头。
I don't wanna do this anymore.
但我始终拥有从事多种有趣工作的灵活性。
But I've always had the flexibility to work on lots of interesting things.
要知道,我总是可以把注意力转向其他事情,并乐在其中地投入工作。
You know, I can always just turn my gaze to something else and have a great time working on that.
实际上,努力工作的能力很大程度上在于能够有多样选择,并将时间用在最合适的事情上。
And so much of that so much of the ability to actually work hard is the ability to have multiple things to choose from and to use use your time on the most appropriate thing.
比如,有些时间段对我来说最适合研读需要深入思考的新研究论文。
Like, there are there are time periods where I am it's the best time for me to read a new research paper that I need to really be thinking, you know, hard about it.
也有些时候我可能应该只是快速浏览整理旧笔记,因为你知道,我状态并不在线。
Then there's a time that maybe I should just scan and organize my old notes because my you know, I'm just not on top of things.
然后有时候,好吧。
Then there's the time that, alright.
来吧,快速敲出几百行代码。
Let's go, you bang out a few 100 lines of code for something.
所以能在这些状态间切换真的很有价值。
So switching between them has been real valuable.
看来你对你做的所有事都心怀喜悦,这本身就是一种工作与生活的平衡,作为第一步。
So you always have kind of joy in your heart for all the things you're doing, and that that is a kind of work life balance as a first sort of step.
是啊。
Yeah.
确实如此。
I do.
所以你总是很快乐。
So you're always happy.
确实。
I do.
我
I
是啊。
yeah.
而且保持快乐。
And while Happy.
对。
Yeah.
我是说,就像很多人会说我看起来总像个严肃的人,你知道的,就那样面无表情地坐着,甚至皱着眉头、板着脸盯着什么东西看。
I mean, that's like I a lot of people would say that often I look like kind of a grim person, you know, with just sitting there with a a neutral expression or even, like, knitted brows and a frown on my face as I'm staring at something.
这就是你快乐时的样子。
That's what happiness looks like for you.
没错。
Yeah.
某种程度上确实如此,好吧。
It's it's kinda true where that that it's like, okay.
我正在挺过这个阶段。
I'm pushing through this.
我在这里取得了进展。
I'm making progress here.
你知道,我明白这并不适用于所有人。
I am you know, we I know that doesn't work for everyone.
我知道这对大多数人都不适用。
I know it doesn't work for most people.
但在这些情况下,我一直试图做到的是:我不想让可能是这类人的人被别人告知'不'。
But what I am always trying to do in those cases is I don't wanna let somebody that might be a person like that be told by someone else that, no.
甚至不要尝试将其作为一种选择——你知道,工作与生活的平衡与你毕生事业之间的选择,其实有一小部分人可以通过对事物保持痴迷而获得极大满足。
Don't try don't even try that out as an option where I you know, work life balance versus kind of your life's work, where there's a small subset of the people that can be very happy being obsessive about things.
而且,痴迷往往能完成那些仅仅靠务实、谨慎、平庸的工作所无法完成的事,至少短期内无法完成。
And, you know, obsession can often get things done that just practical, prudent pedestrian work won't, or at least won't for a very long time.
关于你早期营养摄入的传说可不少。
There's legends of your nutritional intake in the early days.
关于作为一个程序员,某种程度上像运动员,你有什么想说的?
What what can you say about sort of as a you know, being a programmer as a kind of athlete.
嗯。
Mhmm.
那么,当时支撑你的营养来源是什么?
So what what what was the nutrition that fueled?
说实话,我在这方面一直不太讲究,我吃得不多也就勉强过得去。
So I have never been that great on I on really paying attention to it where I'm good enough that I I don't eat a lot.
你知道,我从来不是那种大块头,但有趣的是,我记得自己是个不快乐的青少年,没什么钱,而让我烦恼的事情之一就是不能随心所欲地买披萨吃。
You know, I've never been, like, a big heavy guy, but it was interesting where one of the things that I can remember being an unhappy teenager, not having enough money, and, like, one of the things that bothered me about not having enough money is I couldn't buy pizza whenever I wanted to.
是啊。
Yeah.
所以我后来有钱了,就买了好多好多披萨。
So I got rich, and then I bought a whole lot of pizza.
这就是定义啊,所谓富有就是这种感觉
That was defining like, that's what being rich felt like
是很多小事情。
is A lot of little things.
比如,我可以买所有想买的披萨、漫画书和电子游戏。
Like, I could buy all the pizza and comic books and video games that that I wanted to.
其实并不需要太多钱,但披萨确实是其中之一。
And it really didn't take that much, but the pizza was one of those things.
而且很长一段时间里,软件确实如此。
And it's absolutely true that for a long time, it did software.
我每天都订一份披萨外卖。
I had a pizza delivered every single day.
你知道,送餐员都认识我了,多年后我才发现,显然因为我是优质客户,他们一直没给我涨价。
You know, the delivery guy knew me by name, and I didn't find out until years later that apparently I was such a good customer that they just never raised the price on me.
我用了六年前的旧价格订披萨,他们还是每天给我送。
And I was using this six year old price for the pizzas that they were still kind of sending my way every day.
所以你那时一天只吃一顿?
So you were doing eating once a day?
或者你是
Or or were you
其实是分散开的
It would be spread out.
你知道的,吃几片披萨
You know, you have a few pieces of pizza.
晚些时候再吃些,可能家里还有些吃的
You have some more later on, and I'd maybe have something at home.
这是Facebook(现Meta)的一个好处,他们确实把员工喂得不错
It was one of the nice things that Facebook meta is they do they feed you quite well.
现在可能是DoorDash这类外卖了,但他们确保每个人都吃得很好
You get a different I guess, now it's DoorDash sorts of things delivered, but they take care of making sure that everybody does get well fed.
我在Meta办公室工作的那六年,可能吃得比以前更好
And I probably had better food the those six years that I was working in the Meta office there than I used to before.
不过对我来说还算顺利
But I've it's worked out okay for me.
我的身体一直很健康。
My health has always been good.
我平时运动量相当充足,而且饮食有度,尽量避免那些对身体不太好的东西。
I I get a a pretty good amount of exercise, and and I don't eat to excess, and I avoid a lot of other kind of not so good for you things.
所以在我这个年纪,状态依然保持得不错。
So I'm still doing quite well at my age.
你是否曾有过某种...我不知道该怎么说...与食物或咖啡相关的精神体验?
Did you have a kind of, I don't know, spiritual experience with food or coffee or any of that kind of stuff?
我是说,就像编程时用音乐营造氛围那样——比如我会听着棕色噪声编程,或是通过营造环境氛围,包括摄入体内的东西,所有这些构建行为都能成为一种仪式,赋能整个编程过程。
I mean, you know, the programming experience, you know, with music and or or like, I listen to brown noise in a program, or like creating an environment and the things you take into your body, just everything you construct can become a kind of ritual that empowers the whole process of the program.
你和披萨之间有过这种关系吗?
Did you have that relationship with pizza?
还是说
Or
真要算的话应该是健怡可乐。
It would really be with Diet Coke.
我是说,现在依然有那种感觉,你知道的,放下罐子,打开一罐健怡可乐。
Mean, there still is that sense of, you know, drop the can down, crack open the can of Diet Coke.
好的。
Alright.
现在我认真了。
Now I mean business.
我们要开始干活了。
We're getting to work here.
直到现在依然如此。
Still, to this day Yeah.
健怡可乐现在还是
Is Diet Coke is still part
可能每天八到九罐。
of the Probably eight or nine a day.
不错。
Nice.
好的。
Okay.
你的设备配置怎么样?
What about your setup?
有几个屏幕?
How many screens?
用的是什么键盘?
What kind of keyboard?
有什么特别的东西吗?
Is there something interesting?
用的是什么IDE?
What kind of I IDE?
Emacs、VIM还是现代编辑器?
Emacs, VIM, or something modern?
Linux系统吗,还是其他操作系统,笔记本,或者任何让你开心的工作设备?
Linux, what, operating system, laptop, or any any interesting thing that brings you joy?
所以我在某种程度上经历了文化迁移,早期在整个游戏开发领域存在一种独特的文化,与硅谷的风险投资文化截然不同,你懂的。
So I kind of migrated cultures where early on through all of game dev, there was sort of one culture there, which was really quite distinct from the more Silicon Valley venture, you know Right.
为事物而生的文化。
Culture for things.
它们是不同的群体,思维方式有着显著差异——至今我仍认为许多大公司可以从硬核游戏开发领域学到东西。最让我震惊的是,那些手握数十亿资金的硅谷风投支持的公司,对调试器和集成开发环境竟如此排斥。
It's they're different groups, and they have pretty different mores in the way they think about things where and I still do think a lot of the big companies can learn can learn things from the the hardcore game development side of things where it still boggles my mind how I am how hostile to debuggers and IDEs that so much of them, the kind of big money get billions of dollars Silicon Valley venture backed funds are.
哦,这很有趣。
Oh, that's interesting.
抱歉打断。
Sorry.
你是说像谷歌和Meta这样的大公司对...
So you're saying, like like, big companies like Google and Meta are hostile to
他们不太推崇调试器和IDE。
They are not big on debuggers and IDEs.
比如很多工作都用Emacs、VIM这类工具完成,而且我们默认调试器在大多数系统上根本不管用。
Like, so much of it is like Emacs, BIM for things, and we just assume that debuggers don't work most of the time for the systems.
这种观念很大程度上源于对Linux的偏见,我个人的成长经历是从个人电脑开始,然后是DOS系统,最后是Windows系统。
And a lot of this comes from a sort of Linux bias on a lot of things where I did come up through the the personal computers and then the DOS and then I am, you know, Windows.
那时候用的是Borland工具,后来转到了Visual Studio。
And it was Borland tools and then Visual Studio.
而且
And
你喜欢用调试器吗?
Do you appreciate the buggers?
非常喜欢。
Very much so.
我的意思是,调试器能让你深入了解那些过于复杂的系统。
I mean, a debugger is how you get a view into a system that's too complicated to understand.
如果有人觉得只要读代码就能理解系统,这种想法简直荒谬——在大型系统里你连完整读一遍代码都做不到。
I mean, anybody that thinks just read the code and think about it, that's an insane statement in the you can't even read all the code on a big system.
你必须通过实验来理解系统。
You have to do experiments on the system.
通过添加日志语句、重新编译和重新运行来进行调试,这种方式效率极其低下。
And doing that by adding log statements, recompiling, and rerunning it is an incredibly inefficient way of doing it.
我的意思是,是的,你总能完成任务,即使你用的是石器时代的工具。
I mean, yes, you can always get things done even if you're working with stone knives and, you know, and bearskins.
这正是优秀程序员的标志——无论用什么工具,你都能找到方法解决问题。
That's that is the mark of a good programmer is that given any tools, you will figure out a way to get it done.
但当你拥有更好的工具时,效果会令人惊叹。比如不用经历反复编译、运行、调试的循环,而是像Lisp那样拥有REPL环境,可以交互式地完成惊人的工作。
But it's amazing what you can do with sometimes much, much better tools where instead of just going through this iterative compile, run, debug cycle, you have the you have the old Lisp direction of, like, you've got a REPL, and you're working interactively and doing amazing things there.
不过在很多情况下,调试器拥有非常强大的用户界面,可以暂停程序、检查所有变量、设置各种断点。
But in many cases, a debugger has a very powerful user interface that can stop, examine all the different things in your program, set all of these different breakpoints.
当然,你也可以用GDB之类的工具实现这些,但这涉及用户界面的基本原则:当操作过于复杂时,人们就不会经常使用它。
And, of course, you can do that with GDB or whatever there, but this is one of the user interface fundamental principles where when something is complicated to do, you won't use it very often.
有些人只有在黔驴技穷时才会启用GDB,通常是在某个问题上耗费了大量时间之后。
There's people that will break out GDB when they're at their wit's end, and they just have beat their head against a problem for so long.
但对于游戏开发出身的人来说,他们甚至在发现问题之前就会习惯性地使用调试器,随时停下来查看运行状态。
But for somebody that kinda grew up in game dev, it's like they were running into the debugger anyways before they even knew there was a problem, and you would just stop and see, you know, what was happening.
有时候你甚至能在完成一次编译周期前就修复问题。
And sometimes you could fix things even before you, you know, even before you did one compile cycle.
你可以在调试器里直接说:'好吧,我就在这里改一下'。
You could be in the debugger, and you would say, well, I'm just going to change this right here.
然后,没错,这样就解决问题了,可以继续了。
And, yep, that did the job and fix it and go on.
对于不了解的人来说,GDB是一种流行的Linux调试器,主要用于C++吗?
And for people who don't know, GDB is a sort of popular, I guess, Linux debugger primarily for c plus plus?
它能处理大多数语言,但你知道,它基于C语言,继承了Unix的传统。
They they handle most of the languages, but it's, you know, it's based on c as the the original kind of Unix heritage.
它有点像命令行工具,不够用户友好,不能提供清晰的可视化效果,你说得完全正确。
And it's kinda like command line, it's not user friendly, it's not it doesn't allow for clean visualizations, and you're you're exactly right.
所以你通常是在束手无策时才会用这种调试器,遇到通过看代码无法解决的问题时才不得不使用它。
So you're using this kind of debugger usually when you're at wit's end and there's a problem that you can't figure out why by just looking at the codes, you have to find it.
我想这就是普通程序员使用它的方式。
That's how, I guess, normal programmers use it.
但你说应该有工具能可视化并辅助编程过程,作为常规编程流程的一部分,帮助更深入地理解代码。
But you're saying there should be tools that kind of visualize and help you as part of the programming process, just a normal programming process to to deep understand the code deeper.
是的。
Yeah.
当我处理C/C++代码时,我总是通过调试器运行它。
When I'm working on, like, my c c plus plus code, I'm always running it from the debugger.
你知道,我输入代码后。
You know, just I type in the code.
我就会运行它。
I I run it.
很多时候,我写完代码后的第一件事就是设置断点并逐步执行函数。
Many times, the first thing I do after writing code is set a breakpoint and step through the function.
其他人可能会说他们在大脑里完成这个过程。
Now other people will say it's like, I do that in my head.
但人脑对这些东西的解释容易出错,而我写的是全新的代码。
Well, your head is a faulty interpreter of all those things there, and I've written brand new code.
我想逐步执行代码,单步调试,检查各种变量,看看它是否真的按照我的预期运行。
I wanna step in there, and I'm gonna single step through that, examine lots of things, and see if it's actually doing what I expected it to.
调试器确实像一种伙伴。
It it is a kind of companion, the debugger.
就像你现在是在与另一个存在进行交互式编程。
Like, it you're you're now coding in an interactive way with another being.
调试器虽然有点笨拙,但非常可靠。
The debugger is a kind of dumb being, but it's a reliable being.
这是个有趣的问题:AI在编解码器和生成代码这类能力中扮演什么角色,可能会出现能以深刻有趣的方式理解代码并与你协作的工具。
It's that is an interesting question of what role does AI play in that kind of with codecs and this kind of ability to generate code that might might be you might start having tools that understand the code in interesting deep ways that can work with you.
我是说,这里有一整个光谱,从静态代码分析器到各种动态工具,再到理论上能理解那些人类根本无法理解的程序的AI。
I mean, there's there's a whole spectrum there from static code analyzers and various kind of dynamic tools there up to AI that can conceivably grok these programs that no literally no human can understand.
它们虽然庞大、错综复杂且相互关联,但并非超出理解范围。
They're they're too big, too intertwined, and too interconnected, but it's not beyond the possibility of understanding.
这已经超出了我们在处理问题时,头脑中能保持的那种可变状态的范围。
It's just beyond what we can hold in our heads as kind of mutable state while we're working on things.
而且我再次强调,我是静态分析器等工具的大力支持者,尽管有些人讨厌被程序指摘他们的代码写法,觉得'我比程序更懂'。
And and I'm a big proponent, again, of things like static analyzers and some of that stuff where you'll find some people that don't like being scolded by a program for how they've written something where it's like, oh, I know better.
有时确实如此,但对我来说这是非常非常宝贵的经历,而且不是很多人能获得这样的机会。
And sometimes you do, but that was something that I was it was very, very valuable for me when and not too many people get an opportunity like this to have.
这几乎是程序员的一种精神体验,对id软件代码库的觉醒——那可是数百万行代码。
This is almost one of those spiritual experiences as a programmer, an awakening to the id software code bases were a couple million lines of code.
我曾用过几种不同的分析工具,但我特意彻底梳理了整个代码库,用尽我能找到的所有工具。
And at one point, I had used a few of the different analysis tools, but I made a point to really go through and scrub the code base using every tool that I could find.
结果令人大开眼界。我们以拥有最健壮、最强固的代码著称,我记得微软曾告诉我们Xbox崩溃数据,我们的故障率极低,他们甚至说那些可能是真正的硬件错误。
And it was eye opening where we had a reputation for having some of the the most robust, strongest code, you know, where there were some, you know, great things that I remember hearing from Microsoft telling us about crashes on Xbox, and we had this tiny number that they said were were probably literally hardware errors.
而其他重要作品的故障记录则高达数百万条。
And then you have other significant titles that just have millions of faults that are getting recorded all the time.
因此在很多层面上,我为我们的代码感到自豪。
So I was proud of our code on a lot of levels.
但当我用这些代码分析工具彻底检查时,里面的错误数量令人震惊——有些你甚至可以说'好吧...'。
But when I took this code analysis squeegee through everything, it was it was shocking how many errors there were in there, things that you could say, okay.
这是复制粘贴时未修改的内容,还有很多类似情况,最常见的问题是printf格式字符串中数据类型错误,这可能导致崩溃,而你知道,这类问题确实需要警告提示。
This was this was a copy paste, not changing something right here, lots of things that were know, the most the most common problem was something in a a printf format string that was the wrong data type that could cause crashes there, and, you know, you really want the warnings for things like that.
其次是缺少对可能发生的空指针检查,这可能导致严重问题。
And the next most common was missing a check for null that could actually happen that could blow things up.
这些都是C/C++中最典型的问题。
And those are obviously, like, top C, C plus plus things.
每个程序员都会遇到这类问题。
Everybody has those problems.
但那些可能出问题的各种小细节的长尾效应,包括我们优秀程序员自己写的代码——
But the long tail of all of the different little things that could go wrong there and we had good programmers in my own code.
我不是在挑剔别人的代码。
It's not that I'd be looking at.
就像'哦,这段代码是我写的。'
It's like, oh, I wrote that code.
那明显有问题。
That's definitely wrong.
我们已经使用这个一年了,它就像一艘潜艇,你知道的,就像一颗地雷埋在那里等着我们踩上去。
We've been using this for a year, and it's this submarine you know, this mine sitting there waiting for us to step on.
这让人感到谦卑。
And it was humbling.
我最终得出结论:任何在语法上被允许的语言特性,只要代码库足够大,最终都会出现。
It was and I reached the conclusion that anything that can be syntactically allowed in your language, if I'm it's gonna show up eventually in a large enough code base.
光有良好的意图并不能阻止这种情况发生。
I you're not gonna good intentions aren't going to keep it from happening.
你需要自动化工具和防护措施来处理这些事情。
You need automated tools and guardrails for things.
这些措施始于静态类型检查,甚至包括动态语言中的类型提示。
And those start with things like static types and or or even type hints in the more dynamic languages.
但那些反对的人会说,这样做会拖慢我的开发速度。
But the people that rebel against that that basically say, that slows me down doing that.
这种说法确实有一定道理。
There's something to that.
我理解这一点。
I get that.
你知道,我也曾在笔记本上东拼西凑地写过代码。
I've written you know, I've cobbled things together in a notebook.
我当时就想,哇。
I I'm like, wow.
能这样直接运行出来真是太棒了。
This is great that it just happened.
不过,是啊,这有点不靠谱,但它运行得挺好。
But, yeah, that's kinda sketchy, but it's working fine.
我不在乎。
I don't care.
这确实又回到了价值分析的问题,有时候不在乎反而是对的。
It does come back to that that value analysis where sometimes it's right to not care.
但当你在乎的时候,如果这个东西要存在多年、会有其他人参与开发、并且要部署给数百万用户使用,那么你就需要运用所有这些工具了。
But when you do care, if it's going to be something that's going to live for years and it's gonna have other people working on it, I and it's gonna be deployed to millions of people, then you wanna use all of these tools.
你会被告知说,不行。
You wanna be told it's like, no.
你在这里、这里和这里都搞砸了,这确实需要一种对自我认知的检查,你必须接受一个事实:你做的每件事都充满了缺陷。
You've screwed up here, here, and here, and that does require kind of an ego check about things where you have to to be open to the fact that everything that you're doing is just littered with flaws.
并不是说,哦,你偶尔会有糟糕的一天。
It's not that, oh, you occasionally have a bad day.
而是无论你输出什么代码流,都会存在统计规律性的错误。
It's just whatever stream of code you output, there is going to be a statistical regularity of things that you just make mistakes on.
而且我认为关于测试驱动设计、单元测试与分析方法的争论一直存在。
And I'm and I do think there's the whole argument about test driven design and unit testing versus kind of analysis and different things.
我更倾向于分析方法,就像你不能运行程序直到修复这个问题,而不是运行它后指望单元测试以某种方式捕捉错误。
I am more in favor of the analysis and the stuff that just like you can't run your program until you fix this rather than you can run it and hopefully a unit test will catch it in some way.
是啊。
Yeah.
在我的私人代码里,我到处都加了断言。
In my private code, I have asserts everywhere.
是啊。
Yeah.
对我来说,这种独裁式的规则——比如‘这一点应该成立’——有种令人愉悦的感觉。
It just there's something pleasant to me, pleasurable to me about sort of the dictatorial rule of, like, this should be true at this point.
而且太多次了,我犯了本不该犯的错误,我原以为自己不是会犯那种错误的人,但我还是一再犯错。
And too many times, I've made mistakes that shouldn't have been made, and I would assume I I wouldn't be the kind of person that would make that mistake, but I keep making that mistake.
因此,断言确实能及时抓住我的错误,总是很有帮助。
Therefore, an assert really catches me, really helps all the time.
所以我的代码中,大概有10%到20%的私人代码只是为了个人使用而写的断言。
So my code I would say, like, 10 to 20% of my private code just for personal use is probably a search.
而且它们都是活跃的注释。
And they're active comments.
理论上这些东西不会对程序产生任何影响。
That is one of those things that in theory, they don't they don't make any difference to the program.
如果一切按预期运行,它们永远不会触发。
And if it was all operating the way you expected it would be, then I they will never fire.
但即使你一开始写对了代码,外部环境也会发生变化。
But even if you have it right and you wrote the code right initially, then circumstances change.
程序之外的世界在不断变化。
The world outside your program changes.
事实上,这正是我在很多情况下偏爱静态数组大小声明的原因——我曾经历过一个阶段,那时觉得通用集合类就足够了。
And in fact, that's that's one of the things where I'm kind of fond in a lot of cases of static array size declarations where I went through this period where it's like, okay.
现在我们有了通用的集合类。
Now we have general collection classes.
我们应该把所有东西都变成可变的。
We should just make everything variable.
因为我早期经历过《毁灭战士》对某些元素有固定限制的时代。
I because I had this history of in the early days, you get Doom, had some fixed limits on it.
后来人们开始制作越来越疯狂的内容,不得不不断提高各种限制——线条数量、区域数量等等。
Then everybody started making crazier and crazier things, and they kept bumping up the different limits, this many lines, this many sectors.
这看起来是个好主意。
And it seemed like a good idea.
我们应该把这个做得完全通用化
Well, we should just make this completely generic.
它可以增长到任意大小
It can go kind of go up to whatever.
确实有些情况下这样做是正确的,但另一方面,当外界变化超出你的预期时,能够及时获知这种变化也很重要
And there's cases where that's the right thing to do, but it also the other aspect of the world changing around you is it's good to be informed when the world has changed more than you thought it would.
如果你使用一个持续增长的集合,你将永远无法发现这个问题
And if you've got a continuously growing collection, you're never gonna find out.
你可能会遇到性能的二次方级下降——原本你以为只会出现少量实例,但由于设计风格变化,突然间就增长到了上万个
You might have this quadratic slowdown on something where you thought, oh, I'm only ever gonna have a handful of these, but something changes and there's a new design style, and all of a sudden, you've got 10,000 of them.
所以我倾向于在很多情况下选定一个数值,比如某个漂亮的2的幂次方数,设置好并在代码中加入断言提示
So I kinda like, in many cases, picking a number, some, you know, nice round power of two number, and setting it up in there and having an assert saying it's like, hey.
你已经触及这个上限了
You hit the you hit this limit.
当使用量达到你预期值的10倍时,或许应该重新评估当初的所有设计选择是否仍然适用
You should probably think are the choices that you've made around all of this still relevant if somebody's using 10 times more than you thought they would.
嗯。
Yeah.
这段代码最初是基于这种世界观和约束条件编写的。
This code was originally written with this kind of worldview, with this kind of set of constraints.
你当时是以这种方式思考这个世界的。
You were you were you were thinking of the world in this way.
如果出现问题,就意味着需要重新审视最初的设计,能有这种反馈机制挺好的。
If something breaks, that means you gotta rethink the initial stuff, and it's it's nice for it to for it for it to do that.
有没有类似键盘或显示器之类的东西?
Is there any stuff like keyboard or So I'm fairly monitors?
在这方面我比较保守,直到几年前才升级到三显示器。
I'm fairly pedestrian on a lot of that where I I did move to triple monitors, like, in the last several years ago.
我用双显示器很长时间了,可能早就该升级了,但直到发现现在的显卡通常都有三个输出端口才想到。
I had been dual monitor for a very long time, and I and it was one of those things where probably years later than I should have, I'm just like, well, the video cards now generally have three output ports.
我应该直接把第三个显示器也装上。
I should just put the third monitor up there.
这绝对是个纯粹的胜利。
That's been a that's been a pure win.
对此我非常满意。
I've been very happy with that.
是啊。
Yeah.
不过,我并没有花哨的键盘鼠标之类的设备
But, no, I don't have fancy keyboard or mouse or anything really
关键是IDE要有好用的调试器和工具,不是Emacs、VimRoute配健怡可乐那种
key thing is an IDE that has helpful debuggers, has helpful tools, so it's not the Emacs, VimRoute, and then Diet Coke.
对。
Yeah.
所以我确实花了——你知道,我用了一周的闭关时间,心想:好吧
So I did spend you know, I spent one of my weeklong retreats where I'm like, okay.
我决定强迫自己用经典VI编辑器,虽然我知道有人会说根本不该这么做
I'm gonna make myself use it was actually classic VI, which I know people will say you should never have done that.
你本应该直接使用VIM的。
You should have just used VIM directly.
但是,你知道的,我已经尽力尝试了。
But, you know, I gave it the good try.
就像是,好吧。
It's like, okay.
我现在处于一种经典的Unix开发者模式,我花了一周时间在这上面。
I'm being in kind of classic Unix developer mode here, and I worked for a week on it.
我用Anki来教自己记住那些不同的快捷键组合之类的。
I I used Anki to, like, teach myself the the different little key combinations for things like that.
最后,感觉就像是,好吧。
And in the end, it was just like, alright.
这有点像我的内战重演阶段。
This was kind of like my civil war reenactment phase.
你懂吧?
You know?
就像我走出去,像过去的人们那样做事,从那个角度来看还挺有趣的。
It's like I'm going out there doing it like they used to in the old days, and it it was kind of fun in that regard.
现在好多人啊。
So many people right now.
但它当时在尖叫
But it was screaming
当他们正在听这个的时候。
as they're listening to this.
所以重申一下,关键在于这不是现代版的Vim,不过确实如此,我懂的。
So, again, the out is that this was not modern Vim, but still, I yes.
最后能回到我的Visual Studio环境让我非常开心。
I was very happy to get back to my visual studio at the end.
是啊。
Yeah.
其实我经常为此纠结,因为我主要用Kinesis键盘和Emacs。
I'm actually I struggle with this a lot because so I use a Kinesis keyboard, and I use Emacs primarily.
正如你所说,我觉得我能完全理解这些代码。
And I I feel like I I can exactly as you said, I can understand the code.
我能浏览这些代码。
I can navigate the code.
在Emacs里用Lisp可以构建很多东西。
There's a lot of stuff you could build within Emacs with using Lisp.
你可以自定义很多功能来帮助自己审视代码,比如理解代码和可视化代码的各个方面。
You can customize a lot of things for yourself to help you introspect the code, like, to to help you understand the code and visualize different aspects of the code.
你甚至可以运行调试器,但这需要付出努力。世界在不断前进,更好的创意层出不穷,这让我也需要像你说的那样退一步思考,但我现在还在打这场内战。
You can even run debuggers, but it's it's work, and the world moves past you, and the better and better ideas are constantly being built, and that that puts a kind of I I need to take the same kind of retreat as you're talking about, but now I'm still fighting the civil war.
我需要某种程度上迈进21世纪。
I need to kinda move into the twenty first century.
看起来世界或者说很大一部分世界正在转向Visual Studio Code,这让我觉得很有趣——一方面是针对JavaScript生态,另一方面IDE这类工具你希望它能无限快。
And it does seem like the world is or a large chunk of the world is moving towards Visual Studio Code, which is kind of interesting to me against the JavaScript ecosystem on the one hand, and IDs are one of those things that you want to be infinitely fast.
你希望它能立即响应。
You want them to just kind of immediately respond.
而且,说实话,我认识一个人。
And, like, mean, heck, I've got there's someone I know.
我是个老派游戏开发者,至今仍在使用Visual Studio 6。
I'm an old school game dev guy that still uses Visual Studio six.
在现代电脑上运行这种老软件,所有操作都瞬间完成——因为它原本是为运算速度慢十万倍的电脑设计的。
And on a modern computer, everything is just absolutely instant on something like that because it was made to work on a computer that's 10,000 or a 100,000 times slower, so just everything happens immediately.
而所有现代系统都让人觉得,它们太臃肿了——为什么这里要刷新屏幕,那里要移动光标,这边要更新那个,那边又闪动那个。
And all the modern systems just feel you know, they feel so crufty when it's like, oh, why is this refreshing the screen and moving around and updating over here and something blinks down there and you should update this?
你知道,我们在获得惊人灵活性的同时,确实也失去了一些东西——但大多数人对此都很满意。
And there's you know, there there are things that we've lost with that incredible flexibility, but lots of people get tons of value from it.
我很高兴看到它甚至征服了许多VIM和Emacs的老用户,他们开始觉得:
And I am super happy that that seems to be winning over even a lot of the old VIM and Emacs people that they're kind of like, hey.
也许Visual Studio Code并不差劲。
Visual Studio codes may be, you know, not so bad.
这可能是个最终的和解方案——让所有人都能对类似工具感到基本满意。
I am that may be the final peacekeeping solution where everybody is reasonably happy with with something like that.
所以
So
你能解释一下什么是点计划文件以及它在你的生活中扮演了什么角色吗?
can you explain what a dot plan file is and what role that played in your life?
它是否仍在发挥作用?
Does it still continue to play a role?
回到id Software的早期,我们的一大独特之处在于我采用了NextStations或NextStep系统,这些系统来自史蒂夫·乔布斯在苹果公司之外创立的公司。
Back in the early, early days of id Software, one of our big things that was unique with what we did is I I had adopted NextStations or kinda NextStep systems from Steve Jobs' out in the out in the woods away from Apple company.
这其实挺有意思的,因为我并没有Unix系统的背景。
And I they were basically it was kind of interesting because I did not really have a background with the Unix system.
很多人都是在大学时期就沉浸其中了。
So many of the people, they get immersed in that in college.
你知道,这为他们设定了很多文化预期。
And I you know, and that's you know, that sets a lot of cultural expectations for them.
我并没有那些经历,但我知道我的背景是——我曾是个狂热的Apple II粉丝。
And I didn't have any of that, but I knew that my background was I was a huge Apple two fanboy.
关于 Bayt 播客
Bayt 提供中文+原文双语音频和字幕,帮助你打破语言障碍,轻松听懂全球优质播客。