When we did the spring, we had this theory of Hooke's Law that told us something, and we built a simulation, or built some tools around that theory.
当我们写弹簧程序的时候,我们有胡克定律来告诉我们原理,然后我们建立了一个仿真模型,或者说是在这个理论基础上建立了一些工具。
But the things we were trying to stress were that it's an important design decision when you are coming up with a piece of code, as to what kind of efficiency your code has.
但是我们这里要强调的是,当你写代码的时候,决定你的代码的效率的很重要的事情,就是你的设计决定。
But when you start writing programs, especially when we get to web-based stuff where you want -- to check the user's input -- is it valid, is it an email address, -- and all these different scenarios -- it's actually often useful to be able to just enumerate them or rattle them off using this switching construct instead.
但是当你看是写程序时,特别是当我们,使用基于网络的东西,你想要,检查用户的输入-,它是合法的吗?它是不是一个电子邮箱地址?,所有的这些场景-,实际上它常常是有用的,当你用枚举结构列举它们,或者用它来快速地来说出它们。
So when we write that out, we just write sigma 1 s squared, or we can break it up into its individual parts, there's no reason we can't do that as well.
当我们把这个写出来时,我们写sigma1s的平方,或者我们可以把它拆分成每个部分,我们没有理由不能这么做。
When we start writing code, you're going to see that difference, but for now, don't worry about it, I just want to plant that idea.
当我们开始写代码的时候,你就会看到区别了,但是现在别担心,我只是想让你们初步有个印象。
And when we do a simulation, we're pulling the samples from some distribution.
当我们写一个仿真程序的时候,我们就是从一些分布中进行了采样。
When we start building up code, we're going to use commands. Or statements.
当我们写代码的时候,我们会用到命令或者声明。
First one, when I write a piece of code, especially code that has branches in it, when I design test cases for that piece of code, I should try and have a specific test case for each possible path through the code.
第一点,当我们写代码的时候,尤其是一些含有分支语句的代码的时候,当我为这些代码,设计测试用例的时候,我应该为每一个可能的程序路径,都设计一个特别的用例。
应用推荐