So one of the things I want you to notice here is that testing and debugging are not the same thing. When we test, we compare an input output pair to a specification.
这里我想大家注意的一件事,就是测试和调试是不同的两件事情,我们测试的时候,我们把输入输出,跟程序的规格说明书对比下。
See if we can find it here. And notice, by the way, that I commented out the previous debugging line, rather than got rid of it.
我们再去从它们的中间开始尝试,看看我们能不能发现问题源,顺便说一下,请注意。
There's a lecture I've given several times at hospitals, to doctors, on doing diagnosis of complex multi illnesses. And I go through it and almost the same kind of stuff I'm going to talk to you about, about debugging.
一个实验室内的实验,为什么实验不对呢?,我也在医院给医生关于,诊断复杂的多种疾病做过很多讲座,我想了想,那和我给你们讲的,关于调试其实都是一回事。
And I've put it in my debugging code.
调试的代码中去,然后运行看看结果。
And at considerable length about debugging.
我曾经尝试过在学期的开头。
Alright, that's the end of my, maybe sermon is the right word on debugging. Polemic, I don't know. I hope it will be helpful. And I hope you'll remember some of these things as you try and get your programs to work.
这就是我有关调试好习惯的一些废话,也许你们会有争议,我希望这些对你们会有帮助,而且我希望你在调试的时候,会想起我今天讲的这些话。
So I'm going to have an assignment of y, I'm going to have an assignment of iters left, I've got a comment that I had borrowed in order to do some debugging, and then what do I want it to do?
因此我需要对y进行赋值,需要对iters,left进行赋值,还有一个我用的别人的,用来调试的一些注释,那么接下来我希望程序怎么运行呢?
Typically, even though they don't breed, there are many bugs. And keep in mind that the bug goal of debugging is not to eliminate one bug.
这是件好事,其实即使bugs不会繁殖,也会有很多,并且请记住调试的目的,并不是去消除一个。
应用推荐