Who was also one of the word's first programmers. So she was trying to write this program, and it didn't work.
也是世界上最早的几个程序员之一,她正尝试着完成一个,复杂的求反正切的程序。
If I wanted every stock to have the same volatility, I could just do that, if you will, at the time I wrote my program.
如果我希望每只股票的浮动值都相同,在我编写程序的时候,如果你愿意的话,我会这么做。
Why does agreement to a certain procedure, even a fair procedure, justify whatever result flows from the operation of that procedure?
为什么只要经过了特定程序,公平的程序,不管任何结果都可以视为正当呢?
There are absolutely going to be times where you're running a program where the programmer, say you, didn't possibly know in advanced how much RAM the program was going to need.
它们总是在,程序员运行程序的地方,你可能预先不知道那个程序,需要多少内存。
The first step in the process is when I was Deputy WHCF, that I put on the wall a big white board calendar.
程序的第一步是,当我还是办公室副主任,我在墙上安了个,白色的日历板。
And most particularly, producing something that your programmers didn't already have in mind.
而且特别要指出的是,酝酿些,你们的程序员还没想到的东西
And the two categories I'm going to divide them into are declarative and imperative knowledge.
我会把它分成两类:,陈述性的知识和程序性的知识。
And it's hard to imagine a simpler program than this. So we very quickly realize that exhaustive testing is just never feasible for an interesting program.
更简单的程序了,因此我们很快的意识到,对一个程序来说详尽的,测试是永远不可行的。
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.
当我们写弹簧程序的时候,我们有胡克定律来告诉我们原理,然后我们建立了一个仿真模型,或者说是在这个理论基础上建立了一些工具。
So all of these programs or commands that we've been using thus far for the piece set in class, take what we call command line arguments, they are the zero or more words that follow the program's name.
所有我们一直在课堂上使用的,这些程序或者命令,携带着命令行参数,它们是跟在,程序名的后面的一个或多个单词。
The chess-playing program makes moves these guys haven't thought of.
象棋程序的走法,是这些程序员也未曾想到过的
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.
没人能凭本能做好它,如果你相当一名优秀的程序员,或者想通过学习成为一名优秀的程序员,很重要的一部分就是学习怎么去调试。
We'll talk more about this later, but it often happens that when you change your program to solve one problem you break it, and things that used to work don't work.
我们以后会更多的去讨论者一点,但是经常发生的情况是当你因为,一个问题修改你的程序的时候,你修改了程序,但原来没问题的模块。
So, we'll talk about this other axis of style on the course, writing code that looks pretty and as well aesthetically laid out.
我们来讨论一下这个中心对称的程序,这程序写出来的结果很漂亮,完全按照美学角度摆放。
And check the answers, and say yeah that's what we expected. But it also involves reasoning. About why that's an appropriate set of inputs to test it on it.
然后说对,这就是我想要的结果,但是它跟推理也有关系,表现在关于为什么这是一个,测试我们程序的适合的输入集。
And henceforth I'm gonna start calling these tools, these monickers that I can use as building blocks in my own program, it's gonna be called a function as we'll see.
从此以后,我将在我的程序里把这些工具,称为我们可以用来写代码的组件,在我自己的程序中,我们将了解到它被叫做为一个函数。
So this is not all that interesting, but let's actually take a look at a 5th version of high that actually does something interesting.
这并不总是有趣的,但是当你看到该程序的第五个版本,会觉得有意思了。
So the end result, because someone wrote this function years ago is that printf takes this thing, takes this thing, David plops David inside the middle of that formatted string and then renders the whole result.
基于这是某人多年以前写的程序,最终的结果是打印出这个,这个,在格式化字符串中间的,然后返回结果。
So you can imagine that this is a very powerful mechanism. So let's look what happens when I run-- start to run this.
因此你可以想到这是一种很强大的机制,让我们看看让我开始运行,这个程序的时候会有什么结果。
And by that I mean, do the set of primitives support a broad range of applications, or is it really aimed at a very specific set of applications?
也就是说这个基本集合,是不是支持,比较多的程序,或者是不是面向,某一特定种类的程序的?
A huge one is, are you actually running the code you're looking at in your editor.
一个很大的错误就是你运行的程序,是否是你在编辑器中看到的程序。
Let's go into the third version of this and then start doing something with these constructs.
让我们进入这个程序的第三版,开始用这些概念来写点东西。
So there's a return branch on every possible path through the code. And that's valuable, it's something you want to think about as your right your own.
所以代码中每条可能的路径,都会有一个返回值分支,这是非常有价值的,当你自己写程序的时候也应该考虑这件事。
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.
我想要说的是一种类型的模块,当然这是因为我们关注的是程序的可组合性,我们如何处理复杂程序呢?
And they'll test an intermediate value near the end or near the beginning.
他们从最后或者程序的,开始处去取测试需要的中间值。
And those are two things that you'd like to do with every looping construct you write: you'd like to be able to assure yourself that they will always terminate, and then the second thing you'd like to do, is to assure yourself that it does give you back a reasonable answer.
就是现在我有了能去检查程序,是不是做了正确的操作的能力:,这就是你们在写每个循环程序的时候,都要注意的两个事情:,第一件事情是要确保程序可以终结,第二件你要做的事情,就是要确保程序返回了正确的答案。
Now, efficiency is obviously an important consideration when you're designing code, although I have to admit, at least for me, I usually want to at least start initially with code that works, and then worry about how I might go back and come up with more efficient implementation.
现在,当你设计程序的时候效率,是不得不考虑的问题,虽然我必须承认,至少对我来说,我是先担心程序能不能运行,再去把它的效率优化的,我喜欢可靠点的东西。
And it's called Silly because it's really a rather ugly program. It's certainly not the right way to write a program to do this.
它之所以被称为Silly因为,它实在是一个相当丑的程序,当然以这种方式去写一个程序是不对的。
All right so now here's the start of my program.
好的,现在这里是我的程序的开端。
Is it some kind of procedure standard operating procedure that you follow?
是不是有一定的程序,标准的执行程序呢,然后你就按照那个程序?
应用推荐