>> They only use that when the program that you're running-- the program that you're referring to is going to your computer?
>它只有在你运行程序的时候才用到-,那你刚刚提到的程序,会到你的电脑上运行吗?
So in general, when you're running command line programs, they can take input or arguments or parameters or switches or flags.
一般而言,当你运行命令行程序时,可以把把这些当做输入,像什么参数啊,或开关啊,或标志啊等等。
Therefore, for simple branching programs, the length of time, the complexity the code, is what we would call constant.
因此,对于简单的分支程序,运行的时间长度,算法的复杂度,也就是我们说的常数。
It's the various programs you run on your computer along with the various data files that you have saved on your hard drive,and so forth.
是你自身这个电脑中运行的各种程序,硬盘存有的各种数据和文件,类似种种。
Over all possible inputs to this function, what's the fastest it runs? The fewest, so the minimum, if you like.
哪个输入程序运行的最快?,用的时间最少?如果你喜欢的话,这个方法看起来不错。
Said a different way, in the case of the straight-line programs, how long would it take to run a program?
换种说法,在直线式程序里面,运行一个程序要多长时间?
Well, this is one of the places where I want to come back to that highlighting of what do things do?
好,讲到这里我们得回去,看看高亮显示的关于程序,该怎么运行的注释吧?
There are absolutely going to be times where you're running a program where the programmer, say you, didn't possibly know in advanced how much RAM the program was going to need.
它们总是在,程序员运行程序的地方,你可能预先不知道那个程序,需要多少内存。
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.
事实上,它是运行在苹果机上的,如果你在电脑上有正确的软件,可以去看看这个环境大致是怎么样的,提前说下,这个程序不会让你印象深刻,我是故意这样做的。
What are the basic modules, what information needs to be passed between those modules in order to make the code work.
基本的模块是哪些,为了让整个程序正常运行,这些模块之间需要传递的信息有哪些。
OK. Having done this now, I can simply go ahead and run this, and in fact if I go up here to run, you'll see I've got both an option to check the module, though in this case I'm just going to run it.
好,讲完了这些,我可以去执行程序了,实际上如果我在这里运行,你们会看到我同样得到了,一个可以同时检查模块的选项,虽然在这个例子中我就是直接去运行程序了。
The second one is, this multiplicative constant here is 3, in some sense also isn't all that crucial.
我们需要乘的常量是,在某种意义上来说这也不是很重要,对你的程序来说要运行300年。
If you can figure out why fails on three letters instead of 12, you'll be more than half way to solving the problem.
如果你能明白为什么程序,在输入三个字母的单词的时候没法运行,你就已经解决了问题的一半了。
So based on initial impressions, what does this program do when you run in it? Yeah?
所以根据初步的印象,如果你们运行这个程序,它会做什么?,啊?
Well, you could just try it and see if it works, right? That's what testing is all about.
你可以仅仅的去试试运行程序,然后看看结果对不对?这就是测试的内容。
It'd still give me an answer. It just would not be the answer I'm looking for.
然后运行程序,程序还是会返回一个答案,只是不是我想要的答案。
You had a whole team of people trying to figure out how to do arctans.
一整个团队的人都为这个程序工作者,他们试着运行这个程序。
I can tell you the answer, but that's because I've cheated, run the program before.
我可以告诉你答案,但这是因为我作弊了,我之前运行过一次程序。
Not just the one where it didn't work, but also the ones where it did.
因为可能程序对一些输入可以,正确运行但对另外一些却不能。
So before I try and run my program, I test each part of it independently.
因此在我尝试运行我的程序之前,我都会对它的每个部分进行独立的测试。
Now, mind you, it was 20 years ago that this program was operational, 20 years.
现在,提醒你们,这是20年前,运行的一个程序,20年了。
They're running through a loop. It's a common way of thinking about problems.
有继承意义的迭代程序了,它们是以循环的模式来运行的。
They're easy to spot, you can't run the program with them there, so you're not going to get weird answers.
它们很容易被捕捉到,你没法带着这些错误去运行程序,因此你不会得到奇怪的答案。
Usually when you know why it's not working, it's obvious what you have to do to make it work.
通常你明白了出错的原因后,很明显你必须让程序正常运行起来。
And the obvious question I could start with is, and suppose I ask you, how long does the algorithm implemented by this program take to run?
我开始这个话题的第一个问题是,假设我问你,由这个算法实现的程序大概,要运行多久才能给出答案?
All right so it has to live in RAM as opposed to the hard drive because otherwise things would be terribly slow as you know so it's much better if your programs live while they're running in RAM and they end up in what's called the tech segment.
好的,它存在内存中,而不是硬盘中,因为,否则程序会非常的缓慢,程序在内存中运行会好得多,它们在技术段,的地方结束。
All right? If you run it, you have a sense of the upper bound, about how much time it's going to take to do this computation, so you're not going to get surprised by something showing up.
第一,这样做意味着没有意外了对不对?,你去运行程序,你已经大致知道运行时间的上限了,因此发生任何事情,你都不会吃惊了。
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.
公平起见,那个问题有时会发生,因为实际上,很多企业在这么多年里运行了,比程序员多得多的代码,虽然他们将运行它,但那个构想还是一样的。
What I don't want your program to do is crash when that happens. Or run forever.
当这种问题出现时程序崩溃,或者一直运行下去。
Where we put our whole program together, and we say does the whole thing work?
也就是把我们的整个程序组合起来,然后看看它们在一起能不能正常运行?
应用推荐