Programming Methodology (Stanford). Lecture 8 / 28

Материал готовится, пожалуйста, возвращайтесь позднее

Instructor (Mehran Sahami): Alrighty. Welcome back to yet another day of CS106a. Couple quick announcements before we start – so first announcement, there is one handout which I’m not sure if it’s here yet, but it will be here momentarily if it’s not here now. You can pick it up on the way out. I think Ben might have just been delayed on the way in. So there is one handout; hopefully, you can pick it up on the way out if you didn’t see it back there now. It’s already posted online as well. So if you don’t get it in class, you can get it online, or you can get it – there’s the Handout Hangout as we like to refer to it, which is a bunch of file folders on the first floor of Gates where there’s hardcopies of all the handouts that get left over from class.

So another quick point, it’s still a little early to talk about plus pluses because some of the programs that you’ve written are, sort of, simple enough that it’s difficult to, sort of, way overshoot what we’re expecting, which is what we want for the plus plus, but I just want to say a little note about plus pluses just because pretty soon that’s, hopefully, what you’re gonna be going for. If you think you’re gonna add extensions to an assignment beyond the basic functionality, what we ask is that you do two versions.

You do one version that is your nice, clean, well-decomposed, commented version that is everything that you would need to do to do the assignment well done just as the specification suggests, and then do another – create another file, or you can just copy this file that you started with and start working on that. You might need to give it a slightly different name for the class like, “My extended version of this,” or whatever, and that’s where you should add all your extensions.

And the reason we do that is because sometimes in the past when people have added extensions to their assignments, they’ve inadvertently made things, in terms of software engineering, really ugly that they didn’t mean to, or they ended up actually breaking some piece of the basic functionality because they were trying to do something way more complicated. And so that’s why we ask for two versions if you’re gonna go for the plus plus, so we know you were able to do all the basic stuff and do it cleanly, and then if you want to add extensions, we can look at those extensions, and if the extension happen to break something along the way, you won’t get penalized because we’ll have your basic version as well. So if you’re going for the plus plus, two versions of the program that you want to submit for the plus plus, the basic version that has all the functionality, everything nice and clean, and then whatever you’re gonna do for the extension.

Alrighty. So with that said, time to get into the real meat of things, and we’re gonna do a little bit of review of what we talked about last time. Remember last time we talked about our friend, the method, and one of the things we said about method was, like, a CD player was like a method, and part of the idea was it had this generalization capability, that it had some parameter of the CD you put in, and out came music, and the music that came out depended on the CD that you actually put in.

Now part of the reason, besides just getting generality, is this notion of information hiding.