• And will make mistakes. And therefore, you write your programs so that catastrophes don't occur when those mistakes are made.

    就是人是很愚蠢的,会犯错误的,因此,你要这样设计你的程序,以达到当犯错误时避免大事故的目的。

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

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

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

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

  • I included the length, let me go ahead and compile this program called Holloway.c. No errors which means that's good.

    我包含了那个长度,我们继续,编译这个Holloway,c程序,零错误,非常好。

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

  • So you say well, rather than rushing off and fixing this one bug, let me pull back and ask, bug is this a systematic mistake that I've made throughout the program?

    因此我们应该回头想想,这是不是我在整个程序中都,在犯的一个系统性错误,而不是匆匆忙忙的去修复这一个,如果确实是系统性错误的话?

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

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

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

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

  • bugs If there are multiple bugs in the program, it's because you made multiple mistakes.

    他们并不会,如果在程序中有很多,那是因为你犯了很多错误

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

  • That says it's in here. It's in this tri-block. It raised an exception, but it wasn't and I O error.

    这在这里它是一个try程序块,它报出异常,但他不是io错误

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

  • I get a key error. Because, remember, these things are not ordered.

    程序会返回一个键错误,因此,记住字典里的元素是无序的。

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

  • I stress it in particular because I know you're all going to get into this stage; you've got a problem set due in a couple of hours, you're still writing the code, you don't want to waste time, and I'm going to use quotes on "waste time", doing those extra things to do the defensive programming, you just want to get the darn thing done.

    我特别强调了这一点,因为我知道你们都会慢慢成为程序员;,你在写代码过程中造成了一系列的错误,你还在写代码,你不想浪费时间,我想把“浪费时间“用引号圈起来,浪费时间来做因为防卫性程序设计,而带来的这些额外的事情,你只想赶紧把程序写完,这不是一个好习惯,因为当你做完回头。

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

  • I've certainly written code that has this problem, I've tried to use my own code that has this problem, and good to us, right, good hygiene, I'm going to use that word again here, of getting into the habit of writing defensive code up front, it's part of that collection of things that you ought to do is a great thing to do.

    我举手了吧?,我当然写过犯这种错误程序了,我也尝试过应用含有这种错误的代码,不错,好的卫生,我还是要用这个词,对我们有帮助,养成写防卫性,代码的好习惯,是你应该做的,一系列事情之一,也是我们日后要做的主要的事情。

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

  • Almost everyone in this room has probably had a segfault at some point or core dump where you end up with this random file called core, which recall is just the contents of memory at the time your program crashed.

    几乎这个教室里的所有人,在某个时候,都遇到过段错误,或者通过这个core文件的,存储器内核更新,这就是你的内存出现错误,你的程序崩溃掉了。

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

  • 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已经是负数了,它会跳过整个循环,然后就有麻烦了,谢谢你提出这个问题。

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

  • It's a little more readable because I'm using a Boolean value that tells me, the programmer, this is true or this is false.

    它更具有可读性一点,因为我使用了一个bool值,它告诉我或程序员,这是正确的或这是错误的。

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

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

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

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