>> They only use that when the program that you're running-- the program that you're referring to is going to your computer?
>它只有在你运行程序的时候才用到-,那你刚刚提到的程序,会到你的电脑上运行吗?
Whereas in the linear case, I make it ten times bigger, it takes ten times longer to run. OK.
它要占用原来十倍的时间去运行,我一直在说还有一件事情没有讲,这是我要强调的最后一件事。
This machinery is so precise that a human hair couldn't even pass between the heads and spinning platters, yet it all works in terrific speeds.
这些设备是很紧密的以至于人的头发,都不能在头和旋转的磁盘之间通过,尽管如此,它的运行速度非常快。
In our business, you got to be inventing new things because software doesn't wear out, it doesn't break, or at least if it breaks it was broken when you finished it, it doesn't break over time the way physical goods do.
在我们行业,你需要不断发明新事物,因为软件并不会磨损,不会坏,或者至少如果坏了,也是在你运行完之后,它并不像物理上的东西会随着时间磨损。
And now since it's reversible, we can run it forward or backward.
因为它是可逆的,所以可以正方向运行。
I didn't expect it to do this. If you understand why it did what it did, you're half way there.
这样运行的啊,如果你能弄明白为什么,它这么运行,你已经完成了差不多一半了。
So in fact if I run this, ah, and save it, and it prints out odd.
因此实际上如果我运行这个,啊,先保存它,然后它输出奇数。
So that's the only change we need to make there and watch what happens when we actually run this.
那就是我们需要改变的,并且当我们运行它,会发生什么事情。
It could run and give you the right answer, it could crash, it could loop forever, it could run and apparently give you the right answer.
它可能会正确运行,并返回给你一个正确的答案,它可能会崩溃,它可能会一直运行下去,它可能会运行并给你正确的答案。
But it turns out that on Macs and if you have the right software on PCs, you can kind of get a teaser of what this environment tends to look like and be forewarned, what you're about to see is intentionally very underwhelming.
事实上,它是运行在苹果机上的,如果你在电脑上有正确的软件,可以去看看这个环境大致是怎么样的,提前说下,这个程序不会让你印象深刻,我是故意这样做的。
OK. What happens if you actually have something that's both syntactically correct, and appears to have correct static semantics, and you run it?
好,当你的代码语法,没错误,并且也有正确的静态语义,你去运行它的时候会发生什么呢?
So we can see what it's doing is it runs. So let's try fib it here with Fib of 6.
我们可以看到它在,运行的时候做了什么,让我们试试。
In other words it doesn't just return when it finds one, it's going to run through all of them. All right?
但是它将会继续运行,换句话来说当它找到一个结果时,它不会立刻返回结果它会先遍历所有的内容?
It will probably quit at some point because of space issues, unless I'm writing an algorithm that is using no additional space.
其中一个的时候,它会一直运行下去,它可能在某一处因为空间问题退出,除非我写了一个。
I was hoping for a simpler answer, which is, just run it. Which is, yeah I know, seems like a dumb thing to say, right?
我希望一个简单点儿的答案,比如说去运行它吧,这方法看起来挺笨的对不对?
So, let's see this eraser actually never works very well so I'm just going to draw below it.
这个清除器不能很好地运行,我将在下面画出它。
So it has to have that. Typically it's nice if it can have useful intermediate results.
否则为什么还要那么麻烦去运行它呢?,因此实验必须有这个可能。
And in fact, if you look down- and I'm just going to highlight this portion, I'm not going to run it- but if you look down here, that's exactly what that does.
实际上,如果你往下看-,我正要强调这一部分,我不会去运行它-,但是如果你看看这儿的话,这个方法确实就是这么做的。
And if I go ahead and run this -- now it's going to say woops, at me.
如果我继续来运行它-,现在发生了什么?我在这里尝试。
So if your word game doesn't work when the words are 12 letters long, instead of continuing to debug 12 letter hands see if you can make it fail on a three letter hand.
因此如果你的单词游戏当输入单词,有12个字母的时候没法运行了,看看输入三个字母的单词它,能不能正常运行吧。
Now in fairness, that particular problem kind of happened because so many companies ended up running so much code for many more years than the programmers actually thought they would be running it, but the idea is still the same.
公平起见,那个问题有时会发生,因为实际上,很多企业在这么多年里运行了,比程序员多得多的代码,虽然他们将运行它,但那个构想还是一样的。
And then I could do things like again, say, okay having done, that let me just run it here, run that, so I've now got polar point 1, and polar point 2.
然后给它们赋值半径和角度,然后我可以进行刚才的操作,也就是说,对刚才的笛卡尔坐标进行的操作,让我们来运行下它吧,运行下,现在我有一个极坐标点。
buggy3 But if I run this thing, buggy three, they've clearly not been swapped.
但是如果我运行它,它们显然没有交换。
> Compiling the program , -- saving it under the name "hello," in the library -- >> David: Okay, good.
>运行程序【无法辨认的声音】,然后把它保存为“hello“文件-,>>大卫:好的,不错。
So based on initial impressions, what does this program do when you run in it? Yeah?
所以根据初步的印象,如果你们运行这个程序,它会做什么?,啊?
So before I try and run my program, I test each part of it independently.
因此在我尝试运行我的程序之前,我都会对它的每个部分进行独立的测试。
Does it give you the answer that you expected it to give? Often, in practical problems, you'll spend just as much time doing performance debugging. Why is it slow?
它返回了期待中的结果了么?通常,在实际的问题中你会花,同样多的时间在性能调试上,它为什么运行这么慢?
Or, said a different way, what's going to happen when I run it?
或者,用不同说法来讲就是,当我运行它的时候会发生什么?
OK. All right, let me show you one other tool that I want to use. Which is, I've written that piece of code, I ought to check it. Well, I could just run it, but another useful thing to do is, I'm, especially as I want to debug these things, is to simulate that code.
好,那么,让我给大家讲下,我想用的另外一个工具吧,也就是,我已经写好了这一块代码,我应该去检查检查,那么我可以去运行它,但是特别是当我想要调试代码的时候。
But here I want it to be determined, chosen at run time.
但是在这里我想要让它是一个由运行时间。
应用推荐