• They're easy to spot, you can't run the program with them there, so you're not going to get weird answers.

    它们很容易被捕捉到,你没法带着这些错误运行程序,因此你不会得到奇怪的答案。

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

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

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

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

  • If you've ever been using some program, you did something completely innocuous, pull something down from a menu, click a button, you didn't do anything wrong and yet all of a sudden the thing just starts hanging there or you get a little spinning beach ball or the hour glass or whatever it is.

    如果你之前在用一些程序,做一些无伤大雅的事情,拉下一个菜单,点击一个按钮,你没有做任何错误的事情,突然间有东西开始一直运行,或者一个沙滩上的小球旋转,或滴漏或是别的什么。

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

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

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

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

  • A huge one is, are you actually running the code you're looking at in your editor.

    一个很大的错误就是你运行的程序,是否是你在编辑器中看到的程序。

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

  • It's a bad habit to get into, because when you come back to it, it may haunt you later on down the road. So really get into that notion of trying to be defensive as you program.

    运行程序的时候,错误就会出现缠住你了,因此现在我们真的要培养,在程序中有防卫性设计的概念。

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

  • yeah I run this, yeah, I have a syntax error, yes indeed, because I forgot to comment that one out, all right, and cue, we'll try it again.

    运行下,一个语法错误,确实是,因为我忘了把这里注释上了,好,让我们再来试试。

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

  • You can very quickly drive yourself nuts by sitting down, thinking, oh, I can write this program, no sweat, and then you write it and then there's a tiny little mistake here, but then there's a tiny little mistake here and here, and all of these stupid little things cascade until you try running your program, and the thing just doesn't work.

    如果你只是仅仅干坐着,不费吹灰之力,凭空幻想着我可以把这个项目搞定,你会想地发疯的,也许你会写出一点东西出来,可能会有一点点错误,紧接着这或那又出现一点小错误,这些小错误一点一点地堆积了起来,直到你开始运行你整个项目,你会发现这堆东西根本就不工作。

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

  • I spotted an error here, I could have spotted it by running it on different test sets, and using prints things, another way of doing it, but this idea of at least simulating it on simple examples lets you check a couple of important questions.

    操作么?我在这里发现了一个错误,我也可以通过运行不同的测试集,或者运用print声明来发现这个错误,但是至少应该用简单的例子来手工模拟下,代码的思想可以让你,对一些很重要的问题进行检验。

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

  • 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条件,代码可能可以运行,这就是,挫折和问题产生的源头,因为你没有-,因为你的代码看起来是正确的,但是运行错误的,那个分号的意思是,停止寻找后面相关的代码。

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

  • Initialization. A very common bug is to initialize a variable. Go through a loop, and then forget to reinitialize it when it needs to be reinitialized again.

    忘记初始化,忘记初始化变量是一个很常见的错误,运行完一个循环之后,当需要再次初始化时。

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

  • Yes. The point is, it's not going to work, and she caught both of them, impressive, it's not going to work because iters left is already negative, it's just going to skip the whole loop, and I'm in trouble, so thank you for catching that.

    是的,重点是,程序不会运行的,她发现了两个错误,很令人敬佩,程序不会运行,因为iters,left已经是负数了,它会跳过整个循环,然后就有麻烦了,谢谢你提出这个问题。

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

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

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

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