• 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.

    它可能会正确运行,并返回给你一个正确的答案,它可能会崩溃,它可能会一直运行下去,它可能会运行并给你正确的答案。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Run merge sort on those. By induction, if it does the right thing, I'm going to get back two lists, and I'm going to then merge Them together. Notice what I'm going to do.

    在这些上面再运行归并排序,根据归纳,如果这样是正确的,我将重新得到两个列表,然后我会把它们合并在一起。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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.

    事实上,它是运行在苹果机上的,如果你在电脑上有正确的软件,可以去看看这个环境大致是怎么样的,提前说下,这个程序不会让你印象深刻,我是故意这样做的。

    哈佛公开课 - 计算机科学课程节选

  • I'll let you chase it through, it does work. What I want to look at is, what's the order of growth here?

    我会让你们去运行这个方法的,确实能得到正确答案,我想问的是,这个解决问题的方法的增长率是什么?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • OK. What happens if you actually have something that's both syntactically correct, and appears to have correct static semantics, and you run it?

    好,当你的代码语法,没错误,并且也有正确的静态语义,你去运行它的时候会发生什么呢?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • it's not as good as helping debug, sorry, that's the wrong way of saying it's not as good at catching some things before you run them, it is easier at some times in debugging as you go along on the fly.

    它在帮助我们调试方面可能不是太优秀,对不起,这么说有点不正确,它在运行前捕捉错误,可能不是那么优秀,可能边运行边调试,会更容易一些。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Not just the one where it didn't work, but also the ones where it did.

    因为可能程序对一些输入可以,正确运行但对另外一些却不能。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • At the end of the first round, I've got the smallest element at the front. At the end of the second round, I've got the smallest two elements at the front, in fact I got all of them sorted out. And it actually runs through the loop multiple times, making sure that it's in the right form.

    看看发生了什么,在第一轮结束后,我把最小的元素移到了前面,第二轮结束后,我把最小的,两个元素移到了前面,实际上,所有的元素都排好序了,实际上,这个算法运行了几次循环,确认下这是正确的形式。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • What else might we want to see, to see if we got things working properly?

    我们还希望看到什么呢,要看看我们的程序是不是正确运行的?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Or get to run on the right processor.

    或者运行正确的处理器上。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Pseudo code. Now, you're all linguistic majors, pseudo means false, this sounds like code that ain't going to run, and that's not the intent of the term. When I say pseudo code, what I mean is, I'm going to write a description of the steps, but not in a particular programming language.

    伪代码,基于你们都是学语言的,伪代码意味着不正确,这听起来就像是没法运行的代码,这可不是我们学这个的目的,当我说到伪代码的时候,我的意思是要对步骤进行一个描述,而不是某种特定的编程语言。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • The format is the same. I'm going to ask for some input, and then I am going to use that procedure to check, is this the right type of value. And I'm trying to use that to do the coercion if you like. Same thing if it works, I'm going to skip that, if it not, it's going to throw the exception.

    格式是一样的,我需要一些输入,然后我要用一个过程来检查,是否是正确的值,然后你就可以做强制转换了,如果能运行,那是一样的,我打算跳过这段,如果不正确,那就会抛出一个异常。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So, summarizing better, assert is something you put in to say to the user, make sure you're giving me input of this type, but I'm going to guarantee you the rest of the code works correctly. Exceptions and exception handlers are saying, here are the odd cases that I might see and here's what I'd like to do in those cases in order to try and be able to deal with them.

    所以更好的总结下,断言就是你放在那里告诉用户,保证你输入的是这种类型的,但我能保证剩下的代码运行正确,异常和异常处理做的事,这里有些我能预期的异常情况,并且这里有些情况,我能尝试处理。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And then I run a loop in which I read something in, I check to see if it's the right type, if it is, I change that variable to say it's now the correct type, which means the next time through the loop, I'm going to say I'm all set and I'm going to bounce out.

    因为我还没输入,然后我运行一个循环,循环内部我输入一些东西,然后看看是不是正确的类型,如果是的话我改变input,Ok为真,来证明输入数是正确的类型,这就意味着下一次运行这个循环的时候,就可以跳出循环继续执行了。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So in other words, if you terminate these lines early, if you terminate the four loop early, if you terminate an if condition early with that semicolon, the code may very well work; and this is a common source -- of frustration and conundrum because you don't -- because your code looks right and yet it's misbehaving, but that semicolon means stop looking for subsequent lines of related code.

    换句话说,如果你用分号过早的终止了这些代码行,如果你过早地终止了那个for循环,如果如此,一个if条件,代码可能可以运行,这就是,挫折和问题产生的源头,因为你没有-,因为你的代码看起来是正确的,但是运行是错误的,那个分号的意思是,停止寻找后面相关的代码。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定