• And in the process of tidying it up and making it prettier, I'll often by accident find the bug.

    让我的程序更漂亮些,在这个清理美化代码的过程中,我常常无意中发现我的错误

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

  • I've read through the same thing twenty times and I've missed something obvious. Someone who's never seen it before looks at and says, did you really mean to do this?

    但是它们有一双旁观者之眼,我把同一段代码读上20遍,都会漏掉一些很明显的错误,从没看过这段代码的人会告诉我?

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

  • So things break if you try-- if the computer tries to take you too literally so it would not be correct generally to do something like that.

    如果你把它分开-,那么电脑会逐字逐句地解析,你拆开写的代码,由此得到的结果一般都是错误的。

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

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

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

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

  • I'm much better having an exception get handled at the time of input than to let that prop -- that value rather propagate through a whole bunch of code until eventually it hits an error 17 calls later, and you have no clue where it came from.

    不是我期望的格式,这时我最好有一个异常处理,而不是让其传下去,这个值传到代码的整个分支,最终会导致一个错误17调用的发生,并且你不知道这个错误是哪里来的。

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

  • So we've embedded some error checking, if you will, into our implementations.

    所以我们植入了一些错误校验,如果你愿意,在我们的执行代码里。

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

  • Spelling. These are just dumb little things to look for. Did you spell all the identifiers the way you think you did. The problem is, when you read code you see what you expect to see.

    拼写错误,你可能得找找这些粗心的小错误,你是否拼对了标识符,问题是当你阅读代码的时候,你看到的都是你以为的。

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

  • I just reran make or GCC does it for me, and now I've got all these errors. Well, let's see.

    我刚重新运行了make,或者GCC为我编译了代码,现在我得到了这些错误,好的,让我们看看。

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

  • hey'd rather single step it through using Idol or something, than just read it and try and figure things out. The most important thing to remember when you're doing all of this is to be systematic.

    比起阅读代码发现错误来他们,宁愿用内置的操作层,或者其他工具一步完成,你要记住的最重要的事情,就是要系统化的去做调试。

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

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

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

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

  • 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
- 来自原声例句
小调查
请问您想要如何调整此模块?

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

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