Alright, we are back so we just wrote a programming pseudocode or walk through a programming pseudocode.
继续上课,刚才我们只写了一个伪代码,或者说简单地过了一下。
Having now used this pseudo code to line things up, I can start putting some additional structure on this.
用伪代码把这些事情串起来后,我可以开始进行,一些结构方面的优化了。
So we just zoomed in on this line of codes.
我们放大这行伪代码。
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.
我知道这是个很简单的例子,但是当你们成长为一名程序员后,当你们碰到问题后第一件事情就是,该写一些类似于,伪代码的东西。
Second thing to notice, is that little piece of pseudo code is telling me things about values.
然后需要注意的是,这些伪代码告诉了一些关于值方面的事情,我需要一个浮点数。
Right, so the things we want you to take away from this are, get into the habit of using pseudo code when you sit down to start a problem, write out what are the steps.
好,这儿我想大家明白的就是,养成解决问题时先写伪代码的好习惯,把步骤都写出来,我想要告诉你们的是一个好的程序员。
And in particular, if I think about that problem - actually I want to do this- if I think about that problem, I'm going to write a little piece of pseudo code.
关于这个问题尤其要注意的是,实际上当我考虑这个-,问题的时候我想这么做,我会去写一点伪代码。
I will tell you that a good programmer, at least in my mind, may actually go back and modify the pseudo code as they realize they're missing things, but it's easier to do that when you're looking at a simple set of steps, than when you're in the middle of a pile of code.
至少我认为是这样的,如果他们发现遗漏了,一些步骤的话会,回过头去修改伪代码,但这当你面对一些大致的步骤时,这个过程就会比,面对一堆代码要简单的多。
And what line of code am I on now?
那我现在在伪代码的哪一行呢?
It's just some bogus language we made up that's kind of English-like, kind of look C-like now that you've seen this syntax, but it was just an arbitrary language.
并不是真正的编程语言,好比某种“伪英语“,或“类C语言“,你现在在语法中看到的就是所谓的伪代码,非常随意。
And get into the habit of using it to help you define what is the flow of control.
然后是养成用伪代码,来帮助你定义控制流的习惯。
Pseudo code. Now, you're all linguistic majors, pseudo means false, this sounds like code that ain't going to run, and that's not the intent of the term. When I say pseudo code, what I mean is, I'm going to write a description of the steps, but not in a particular programming language.
伪代码,基于你们都是学语言的,伪代码意味着不正确,这听起来就像是没法运行的代码,这可不是我们学这个的目的,当我说到伪代码的时候,我的意思是要对步骤进行一个描述,而不是某种特定的编程语言。
And then on the right hand side I++, we saw that in pseudocode with our socks example last week that just says increment I.
然后是最右边的i++,我们上周在socks例子的伪代码中,曾经见到过,不是么?只是代表i加1而已。
Last week we did the socks thing and that was in pseudocode.
上周我们写了一个socks程序,但那只是伪代码。
应用推荐