That didn't work. Well they couldn't figure out what was wrong. And they spent a long time trying to debug the program.
调试这个程序,那时候当然不叫调试了,然后他们发现了问题。
And a large part of being a good programmer, or learning to be a good programmer, is learning how to debug. And it's one of these things where it's harder.
没人能凭本能做好它,如果你相当一名优秀的程序员,或者想通过学习成为一名优秀的程序员,很重要的一部分就是学习怎么去调试。
But for the next week or two when you're writing programs, at least for the first time, generally if you're trying Scratch to debug them like you might have been trying to troubleshoot Scratch, you're probably going to reason - through it by looking through the your code -- -- top to bottom, maybe engage a staff member for help -- but your friend will also be printf.
但是,在接下来的一两周内,当你们写程序的时候,或至少在第一次写的时候,通常如果你在调试程序,就像你们可能已经试着调试过,你们或许是通过查看你们的代码,来推断你们的程序-,从头到尾,可能还需要别人的帮忙-,但是你的朋友也将要打印输出。
And that's because it's easier to test small things than big things. And it's easier to debug small things than big things.
这是因为对小一点的对象,进行测试比对大一点的对象进行测,试要简单多了,调试也是如此。
And I'm hoping that today's lecture will help you learn faster. The nice thing, is once you learn to debug programs, you will discover it's a transferable skill.
但是突然成果就会显现出来,你们现在正在慢慢学着呢,我希望今天的课程能帮助你们学的快一点,好的一方面是,一旦你学会了如何调试程序。
an interpreted language is often easier to debug, because you can still see your raw code there, but it's not always as fast.
解释语言调试起来很容易,因为你可以看到最原始的代码,但是这种语言不够快。
So if your word game doesn't work when the words are 12 letters long, instead of continuing to debug 12 letter hands see if you can make it fail on a three letter hand.
因此如果你的单词游戏当输入单词,有12个字母的时候没法运行了,看看输入三个字母的单词它,能不能正常运行吧。
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.
它在帮助我们调试方面可能不是太优秀,对不起,这么说有点不正确,它在运行前捕捉错误,可能不是那么优秀,可能边运行边调试,会更容易一些。
And you can use it to debug other complex systems. So for example, a laboratory experience.
你会发现这是一个通用的技能,你可以用它来调试。
Give you some examples. What have we talked about? We've talked about things like using comments to highlight what you're doing in the code, to make it easier to debug.
给大家举些例子,我们一直在强调什么来着?,我们讲过要用注释来说明,你在代码中进行的操作,以便于调试。
OK. All right, let me show you one other tool that I want to use. Which is, I've written that piece of code, I ought to check it. Well, I could just run it, but another useful thing to do is, I'm, especially as I want to debug these things, is to simulate that code.
好,那么,让我给大家讲下,我想用的另外一个工具吧,也就是,我已经写好了这一块代码,我应该去检查检查,那么我可以去运行它,但是特别是当我想要调试代码的时候。
About how to debug programs where random choices are being made.
我们会谈谈当程序中,存在随机选择的时候怎么去调试程序。
应用推荐