If you want to control a program file, open, copy, paste not get me ready for my trip to Stanford.
如果想要掌控一项程序文件,打开,复制粘贴,并不会铺平通向斯坦福的路。
Well right now, I'm taking one of the classes called the Product Engineering Process,
目前,我上的一门课叫产品工程程序,
And here, too, it's just a little baby program in that I'm hardcoding the expression 17 divided by 13.
然后这里,这只是一个子程序,在那里面我硬编码了表达式“17除以13“
But it is a very handy way of thinking about, not just how to program, but how to break problems down into nice sized chunks.
但是它确实是一种很方便的思考方式,不仅仅限于编程序,在将程序分解为小部分时也很有用。
But if there were a lottery and they'd all agreed to the procedure, you think that would be okay?
但如果他们抽签了,他们也都同意这一程序,那你认为就没问题,是吧?
It looks as though the natural thing to say about the chess-playing computer is, it does have beliefs. It does have desires.
这看起来好像是一件自然的事情,说象棋程序,有自己的信念 有欲望
It turned out that one of--there were three vaccine manufacturers, one of them was using the procedure not quite correctly, they weren't completely killing the virus when they produced their vaccine.
结果显示,疫苗的生产厂家一共有三个,其中一家的生产程序不是非常正确,他们在生产疫苗的时候,并没有完全杀死病毒
Does he want to say that he's just an author function, that his textual field is a kind of set of structural operations within which one can discover an author?
他是不是想说他只是个功能性的作者,而他所写的文章只是一套,用于发现作者的结构上的应用程序?
I think we have an app that's like, "Next Muni" here in the city.
我们有一个“下一趟有轨电车”的应用程序。
You should acquire overtime this instinctive aversion to just code or programs that just look ugly because things that look ugly generally are not easy to maintain.
对于代码和程序你会有一种本能的讨厌,这是因为这些代码和程序看起来很丑陋,并且不容易维护。
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.
没人能凭本能做好它,如果你相当一名优秀的程序员,或者想通过学习成为一名优秀的程序员,很重要的一部分就是学习怎么去调试。
I could have just done this, and the only reason I didn't here is just because now I look - at this, and now it's just getting confusing for me -- even for someone who's been programming for a while.
我本可以这样做,我之所以没有这样做是因为,现在我看着这个,它是我有点迷惑了-,甚至是对于某些已经写了一段时间程序的人来说。
There's unit testing, where we validate each piece of the program independently.
一种是单元测试,也就是,分别验证程序中的每一个独立部分。
We decrement so to speak the variable and then where will we go next in terms of the flow control, the flow of this program.
可以这么说,我们递减这个变量,然后按照控制流,即程序流进入到下一语句。
So we want to write programs to do that.
为了实现这一目标我们要去写一个执行程序。
And so now we're going to try and see if we can write a simulation that will give us some insight as to which of these might be better or worse.
现在我们回来看看我们能否,写一个程序来看看,哪一种选择会更好。
I know this is a simple example, but when you mature as a programmer, one of the first things you should do when you sit down to tackle some problem is write something like this pseudo code.
我知道这是个很简单的例子,但是当你们成长为一名程序员后,当你们碰到问题后第一件事情就是,该写一些类似于,伪代码的东西。
And because there's nothing else in the code at that point, the program should just quit naturally in a good way. Yeah?
因为在那个阶段的没有其它的代码了,这个程序将以一种比较好的方式自然地退出,请说?
- So sleep -- as the name implies -- simply puts the program to sleep for a second.
所以睡眠--顾名思义-,简单地将程序睡眠一秒钟。
You had a whole team of people trying to figure out how to do arctans.
一整个团队的人都为这个程序工作者,他们试着运行这个程序。
So now let me recreate this program from memory.
现在我们在脑子里再过一遍这个程序。
So here is a computer program.
这里有一段计算机程序。
For the latter, this is a place where running test cases would do a good job of helping with that. Nonetheless, having done that, let's look at a better way to write this. Which is right here it is also, I think, on your sheet, I'm going to uncomment that, and comment this one out, yeah. All right?
对于后者来说,运行测试用例,对它会有很大的帮助,尽管如此,讲完了这些,让我们再来看看更好的,来写这个程序的一种方法吧,也就是这里,我想这程序也在,你们的课堂手册上面,我得先把这里取消注释,然后注释掉这里,是的,对不对?
In Scratch you may have realized that, "I could implement my program this way with these puzzle pieces, but it kind of feels -- like I could use these puzzle pieces instead" -- that's absolutely the case in programming.
在Scratch中你可能已经意识到,“我可以用这一段代码来,执行我的程序,不过这有点感觉到,我可以用这些代码段来代替“,那绝对是编程中的一个情况。
So the goal is to figure out a way to stamp them all out.
一种把bugs都,驱逐出程序的方法。
up employing something called programming, the act of constructing, telling a computer to do your bidding.
你们会使用一种叫做程序设计的方法,或称之为构建,即让计算机去执行你的命令。
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?
也就是说这个基本集合,是不是支持,比较多的程序,或者是不是面向,某一特定种类的程序的?
And indeed, when they program these things, the programmers will feed in game after game after game of the great chess games in history.
的确,当人们编写游戏程序时,会在这些程序中,一局接一局地,输入历史上那些最伟大的棋局
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.
我想要说的是一种类型的模块,当然这是因为我们关注的是程序的可组合性,我们如何处理复杂程序呢?
应用推荐