As every time we introduce a new programming concept, we'll relate it back, as we have been doing consistently, to defensive programming.
我们每次介绍一个,新的编程概念的时候,就会和以前讲的联系起来,就和我们介绍防卫性程序设计一样。
And the two categories I'm going to divide them into are declarative and imperative knowledge.
我会把它分成两类:,陈述性的知识和程序性的知识。
And that's basically trying to make sure our program has not regressed, as to say, gone backwards in how well it works. And so we always test it on everything.
这只是从根本上确保,我们的程序并没往后退,也就是说在可用性方面倒退了,因此我们在任何东西上,都要进行这样的测试。
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.
来运行程序的时候,错误就会出现缠住你了,因此现在我们真的要培养,在程序中有防卫性设计的概念。
And what I want to be talking about is modules of one sort, and of course that's because what we're interested in is modularity.
我想要说的是一种类型的模块,当然这是因为我们关注的是程序的可组合性,我们如何处理复杂程序呢?
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.
我特别强调了这一点,因为我知道你们都会慢慢成为程序员;,你在写代码过程中造成了一系列的错误,你还在写代码,你不想浪费时间,我想把“浪费时间“用引号圈起来,浪费时间来做因为防卫性程序设计,而带来的这些额外的事情,你只想赶紧把程序写完,这不是一个好习惯,因为当你做完回头。
应用推荐