Introduction to course - Lectures - Programming Methodology- 1, Study notes of Programming Methodologies

Introduction to Computer science. Lectures of Programming Methodology. Prof. Sahami - Stanford University

Typology: Study notes

2010/2011

Uploaded on 10/04/2011

hollyb
hollyb 🇺🇸

4.8

(44)

431 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming Methodology-Lecture01
Instructor (Mehran Sahami):Alrighty. If you could have a seat, please, we need to get
started. There are still a bunch of people coming in the back. Come on down and try to
find a seat somewhere. If you can't find a seat, sit in the aisle as long as you're not a fire
marshal. Anyone here a fire marshal? Good. We're fine. Come on in and sit in the aisles.
So welcome to CS106A. If you don't think you should be in CS106A, you think you
should be somewhere different, now is probably a good time to go, not that I would
discourage anyone from taking this class. I think we'll have a lovely time in here. But this
class is CS106A or E70A, so if you're, like, "Wait. I thought I was in E70A," you're fine.
They're the same class; it's the same thing. No worries, okay?
There's four handouts. They're in the back. If you haven't already gotten the handouts
because you came in and you sat down, don't worry. You can pick them up on the way
out. They're the same handouts. They'll still be there.
So just a quick introduction. That's what the first four handouts actually give you. They
give you a little bit of an introduction to the class, what we're gonna cover, some logistics
for the class and some other stuff. I'm gonna go over all that today so we can sort of get a
good idea for where we're at, okay?
So just a quick show of hands before we get into a bunch of things in the class. This is
kind of an intro-programming course; well, it is. I shouldn't say it's kind of an intro-
programming course. It is an intro-programming course. And it's always good to get an
idea as to how much familiarity you may have beforehand, okay? So just quick show of
hands. How many people can recognize a computer that's on? Good, good. That's the
prerequisite for this class.
So if you're worried about how much previous experience you've had or your friend who,
like, worked their way through high school by programming for Google or whatever,
don't worry about it because all you need to know in here is basically either how to turn a
computer on or to recognize a computer that's on if you were to walk up to it and it were
already to be on, all right?
So but a little bit more seriously, how many people have actually used a computer for
anything? All right. I would expect most of you.
So now, we begin to bump it up a notch. How many people have used it for word
processing? Okay. Most folks.
How many people have done web browsing? Yeah, I won't ask you what you look at, all
right? It's just I don't wanna know.
How many people have actually created a web page? Okay. Fair number.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Introduction to course - Lectures - Programming Methodology- 1 and more Study notes Programming Methodologies in PDF only on Docsity!

Programming Methodology-Lecture

Instructor (Mehran Sahami) :Alrighty. If you could have a seat, please, we need to get started. There are still a bunch of people coming in the back. Come on down and try to find a seat somewhere. If you can't find a seat, sit in the aisle as long as you're not a fire marshal. Anyone here a fire marshal? Good. We're fine. Come on in and sit in the aisles.

So welcome to CS106A. If you don't think you should be in CS106A, you think you should be somewhere different, now is probably a good time to go, not that I would discourage anyone from taking this class. I think we'll have a lovely time in here. But this class is CS106A or E70A, so if you're, like, "Wait. I thought I was in E70A," you're fine. They're the same class; it's the same thing. No worries, okay?

There's four handouts. They're in the back. If you haven't already gotten the handouts because you came in and you sat down, don't worry. You can pick them up on the way out. They're the same handouts. They'll still be there.

So just a quick introduction. That's what the first four handouts actually give you. They give you a little bit of an introduction to the class, what we're gonna cover, some logistics for the class and some other stuff. I'm gonna go over all that today so we can sort of get a good idea for where we're at, okay?

So just a quick show of hands before we get into a bunch of things in the class. This is kind of an intro-programming course; well, it is. I shouldn't say it's kind of an intro- programming course. It is an intro-programming course. And it's always good to get an idea as to how much familiarity you may have beforehand, okay? So just quick show of hands. How many people can recognize a computer that's on? Good, good. That's the prerequisite for this class.

So if you're worried about how much previous experience you've had or your friend who, like, worked their way through high school by programming for Google or whatever, don't worry about it because all you need to know in here is basically either how to turn a computer on or to recognize a computer that's on if you were to walk up to it and it were already to be on, all right?

So but a little bit more seriously, how many people have actually used a computer for anything? All right. I would expect most of you.

So now, we begin to bump it up a notch. How many people have used it for word processing? Okay. Most folks.

How many people have done web browsing? Yeah, I won't ask you what you look at, all right? It's just I don't wanna know.

How many people have actually created a web page? Okay. Fair number.

How many people have done any kind of programming before? Fair number. All right.

How about how many folks have done actually programmed in Java before? All right. A few folks.

How about another language, C, C++, BASIC, anyone program in BASIC? Yeah, oh, I love — that was the first language I learned, and it was kind of like the warm and fuzzy, and I felt good. There was actually people who argued that if you learn BASIC as your first language, you're brain damaged, then you're just beyond help. But if that's the case, we're all in the boat together because I'm probably brain damaged as well. The truth is I probably am, but that's a whole different story.

All right. So one thing you should know kind of up front is actually this course is gonna be provided eventually somewhere down the line as part of Stanford School of Engineering Free Course Initiative, which means not only are we recording this course to broadcast to a bunch of companies and industry who are watching this course, but we're eventually gonna provide it free to the world.

So how does that impact your life? And on the average day, it doesn't at all. The only way it does impact your life is just so you should know, the lawyers told me to tell you that your voice, should you ask a question, may actually be recorded as part of the video. As a result, your voice may end up going out to thousands of people or millions of people in the world. If you have an issue with that, come talk to me. If you don't, everything is just fine, all right?

Don't worry. We're not gonna put your picture up or anything like that. You might wanna be on the video, like, "Hey, ma, I'm on TV." We decided that we're just gonna not show anyone actually on the video, but your voice may actually get recorded, okay?

Now, along those lines, you may also notice there are some microphones in the room. So when you wanna ask a question, please make sure to use the microphone because that's not only good for people in here to be able to hear your question, it's also good for all the folks that this is getting broadcast to because not only are we gonna broadcast to the world, but there's actually some folks who are sort of watching this live now in various companies in Silicon Valley.

So it's real important that you actually use the microphone, so just remember that. And every once in a while, I might get on your case and be, like, "Please use the microphone." I'm not trying to be argumentative or anything. I just wanna make sure we pick up all the audio, all right?

So with that said, a little bit of an introduction. That's kind of a way of background. I didn't give you any sort of introduction. So just to introduce myself, my name's Mehran Sahami. I'm the professor for the class. Don't call my Professor Sahami, way too formal. Don't call me Mr. Sahami. That, I think of my dad. And don't call me Mrs. Sahami, or we're gonna have issues, all right? So just call me Mehran. We'll get along. It's just fine,

But the whole point is that when you write an essay, it's not a formulated kind of thing. You're, like, "Well, what about five-paragraph essays?" Yeah, just block that from your mind. That was a bad time, right? That was just, like, '70s education at work. It's not a formulated kind of thing.

There's an art to writing an essay, right? In order to write an essay, you need to know a language. You need to know English or German or Hindi or whatever language you wanna use, but then you use that language to write an essay. Just knowing the language doesn't make you a good essay writer though. Being a good essay writer makes you a good essay writer.

So that's the same difference in programming and software engineering. Knowing the language, in order to be a good programmer, like a good essayist, you need to know a language to write your programs in, whether that be Java or C or C++ or whatever. Here we're gonna use Java.

But just knowing the language doesn't make you a good software engineer and doesn't make you understand what the principles are of writing good software, which is what you're also gonna get in this class in addition to the language, and that's kind of a key thing to stress.

So if you're sort of worried, if you were kind of looking around and you saw a bunch of people raising their hands when I asked, "Do you have any previous programming experience?" and some folks raised their hands, and you got a little worried and you're like, "Oh, am I gonna be in some sense at a disadvantage because I haven't done any programming before?" The answer, plain and simple, is no, okay? You're gonna learn everything you need to learn from the first principle because as a matter of fact, in some cases you might be in slightly better shape. That's not necessarily to say that that's the way it will be.

But how many people are Star Wars fans? Just wondering. Anyone? I'm talking about the old-school, original, like, three movies. Those were so good, and we're not — no George R. Binks here, all right? So if you remember — and sort of I'm a big Star Wars fan, and that's just a whole separate point. But in the second movie, Yoda actually said something which I thought was quite profound, which is he says sometimes you have to unlearn what you have learned.

And one of the things we actually find is that some people who are self-taught programmers, some of them are just fine, and some of them are very good. But some of them have picked up some really bad habits along the way, and it's like being a bad essay writer. And to go from being a bad essay writer to a good essay writer, in some cases, can actually be harder than from not being an essay writer to being a good essay writer because you have to unlearn the bad habits.

So if you're worried about, "Oh, I've had no previous experience," don't worry. You're okay, blank slate, you're just fine. And now if you're thinking, "Oh, I have some previous

experience. Do I have bad habits?" Don't worry. You'll be fine, too, okay? So it's all gonna work out.

So the next question that kind of comes up — hopefully that helps put some of your fears aside. Another one of the things is that we really strive to make everyone successful in this class, okay? At some other schools, people wanna do computer science or they wanna do an engineering major or whatever. And you come into the first day of class, and they say, "Oh, only one third of you are actually gonna make it through this program. And look to the person to your left and look to the person to your right, and only one of you will make it through." And you're, like, "Oh, man, that's real nice." It's not like that here.

As a matter of fact, we want all of you to be extremely successful in this class, which is why we have a huge course staff, which is why over years and years we've refined how we do a lot of the teaching in this class to make sure you have the best possible experience and to make sure that everyone gets through.

And the important thing about that is that you're not competing against anyone except yourself in this class. It's not like we're gonna have a curve and we're gonna say, "Oh, we have a certain number of "F"s and a certain number of "D"s and a certain number of "C"s." All we really have going into it is an expectation that when you get out of here, there's a set of stuff we want you to know. And if you know that stuff well, you get an "A." And if everyone knows that stuff well, everyone gets an "A." And I got no problems with that. Registrar might have a problem with that, but that's okay. You don't need to worry about that.

So you don't need to think about, oh, is someone else doing better than you or whatever. And we'll talk about issues of collaboration in just a little bit. All you need to think about is learning the stuff yourself as well as you possibly can, and you'll be just fine and you'll get a good grade, okay? So that's really all we ask, which is not a trivial amount, right? It requires you to really understand the material.

So another question that comes up is are you in the right place, right? This isn't the only introductory programming class at Stanford. And so I wanna spend a little bit of time making sure you actually are in the right place by going over some of the different options.

So right now, as you know, you're in CS106A. And CS106A, we're sort of happy over here, right? As a matter of fact, we're not only happy, we're happy and we're also a little bit loopy, right? There is no previous programming experience required, as I mentioned, right? All you need to know is basically if you can get to a computer and know how to figure out that it's on, you're in good shape.

But what 106A does is it's a real rigorous class. You learn programming in here, and you learn it in a way that makes you ready to be an engineer if you so choose to be an engineer. That's not to say you're all gonna be engineers. I would love for all of you to be

which is C++ and all of the other stuff you would have learned in this accelerated class, okay? So you still certainly have that course path.

So don't let anyone make you think — I know a lot of times, and especially for Stanford students, you come in here and you're, like, "Well, every class I took in high school was like an honors or an AP class, or if it wasn't an honors or an AP class, like, I had to tie half my brain before my head because I'm just that hardcore." And so everyone just wants to, like, do the most hardcore thing they can, right? And what I'm here to tell you is that you shouldn't necessarily think about it that way. You should think about it as where you feel most comfortable.

Some number of years ago, let's just say greater than 10, maybe 15, I was sitting where you're sitting right now, literally. I was in CS106A in Terman Auditorium as a freshman, okay? It was perfectly fine. It worked out. I went to grad school, did the faculty thing. It's just fine. It will open your doors to CS. You're not at any kind of disadvantage by starting here. So know where you've been, literally. Like, that seat right there was where I was most of the time. So just something to keep in mind in terms of the different options that are actually available to you.

Now, with that said, let's just assume for the rest of this lecture that this is the right place for you. And if it's not, well, afterwards we can kind of talk about it, or if you really are convinced now that it's not the right place, you can feel free and try to scramble over 20 of your classmates and actually leave the room, which is probably impossible.

All right. So a few other things you should know, some mechanics. So Handout No. 1, should you wanna follow along at home, is the class web page. And so all the stuff that we think of as course materials, including online copies of the handouts, things that you'll need to do for the assignments, announcements related to the class are all on the class web page, which is www.stanford.edu/class/cs106a. And because that's just kind of a whole bunch to remember, we make your life easy and so there is an equivalent form of the URL, which is just cs106a.stanford.edu, which is the easy thing to remember. You put that in, it'll take you to the class web page, okay?

And you should check that regularly because all the announcements and handouts — we'll give out hard copies of all the handouts in class, but should you happen to miss class for whatever reason, you wanna go print whatever copies of the handouts we're actually giving out, you can find them all on the web page, okay?

Now, there's this funky thing about units. So you may have noticed that this class is for three to five units, and that kind of brings up the natural question, "Should I take it for three or five units?" If you're an undergrad, you take it for five units, end of story. That's life in the city. Congratulations. Five units.

If you're a graduate student, you can have the option of taking it for three units if you want, if you're gonna run into some unit cap. It doesn't change the amount of work you have to do. Welcome to graduate school. Same work, fewer units. So that's just the way

life is. If you have a unit cap and you're a grad student, in three units you can take it if you want. You can take it for five if you want as well. If you're an undergrad, you take it for five, all right?

So why is it five units? And you might think, "Hey, this class only meets three times a week. How come it's five units?" Well, it actually has a fourth meeting every week, which is your section, and that's something you should sign up for. So how you actually sign up for your section is sections are at a bunch of different times. You don't sign up for them in Axess, even though they're all kind of listed in the time schedule. That's not where you sign up for them. In Axess, you just sign up for the class.

How you sign up for a section is you go to a website, cs198.stanford.edu/section and this will give us a list of preferences for section times that you wanna sign up for, and there's some matching process that goes on. It takes all your preferences into consideration with the whole system, and eventually you get an email by sometime early next week that tells you what section you're in. And section's 50 minutes, once a week. It's required to go to. It's actually gonna be part of your class participation grade, which we'll talk about in just a bit, okay?

When do these sign-ups happen? They happen between 5:00 p.m. this Thursday is when they go up. So if you try to go there now, you can't sign up. Remember 5:00 p.m. Thursday. So they're up, and then they're down at 5:00 p.m. on Sunday, okay? So make sure you sign up probably this weekend. If you're planning on being out of town this weekend, you wanna sign up before you go. Sign up early, but don't sign up often because you only need one section, okay?

If you're an SCPD student — every once in a while you'll hear me refer to SCPD students. That stands for Stanford Center for Professional Development. They are the folks in industry who actually take this class via broadcast. If you're an SCPD student, you're automatically enrolled for a section, so you don't actually need to do this, and your section will meet at — so for SCPD — and if you're wondering what an SCPD student is, you're not one, okay? So SCPD section meets Friday from 1:15 to 2:05. It meets live, if you wanna go there live, in Skilling Auditorium. But if you're watching it remotely, it meets on Channel E2. I know it seems weird to say it meets on channel — what does that mean? It meets on Channel E2, okay? That is grammatically the correct way of saying it.

All right. So there's a little bit more administrative stuff. Now, textbooks, right? Textbooks, there's nothing quite like the extortion that is textbooks. So there are two textbooks that are required for this class. Well, one's a course reader and one's a textbook.

The course reader is called, Karel the Robot Learns Java. You can pick it up at the bookstore. It's relatively cheap. It was actually written by Eric Roberts here. And surprisingly enough, the textbook for the class was also written by Eric Roberts, The Art and Science of Java, which is available now in your local bookstore, including the bookstore on campus, so you can go and pick up a copy of this.

explain the whole process in a handout. If you don't have your own computer, the public computer clusters on campus will have Eclipse installed on them, and so you can use Eclipse there. So you're sort of happy to go either way, okay?

Now, the important thing, remember I mentioned that whole notion of software engineering in the class, and that's something we take really seriously, so seriously as a matter of fact that when you turn in your assignments, one thing we could do is we could take your assignments and we could just kind of look at it and go, "Yeah, interesting, 'B.' Here you go. Thanks for playing." And you don't learn a whole lot from them. So in order to actually learn a lot from your assignments, we could take your assignment and write a whole bunch of comments on it and hand it back to you. Even that's kind of not enough.

What really is a little bit more that makes it more fun is every week after you turn in your assignment and your section leader looks it over and grades it, you'll actually meet with your section leader for about 10 to 15 minutes every week or every time an assignment is due to actually go over in something referred to as interactive grading.

And it's a chance to sit there and talk with an actual human being about what's good in your assignment, what are some of the things you need to work on, what are some of the software engineering principles you need to develop. And that way, you can really sort of get more detailed information and be able to ask questions to develop yourself as a programmer as well as get help if you need help, okay?

And that's in addition to going to section, going to class and all that stuff. So it's another 15 minutes a week. You'll actually schedule that time with your section leader on a regular basis when you're gonna have interactive grading or just affectionately referred to as IGs because at Stanford, everything's just short and we just can't say, like, psychology; we have to say psyche. So it's IG. Just remember that, all right?

And then how are these things graded? So the other thing we could do is I told you we could just write "B" and hand it back to you. But we found that that's not really great because people get all wrapped around the axle about the grade.

And so for a while, we did numbers and we're, like, huh, why don't we give a number between 1 and 20? And so what happens there? People get all wrapped around the axle about numbers.

So then we thought, huh, what was a happier time when we were in school? I remember when we were in school, and we used to get back assignments and they had, like, smiley faces on them. Well, we can't do that because then it doesn't appear to be a rigorous Stanford class.

So instead of the smiley face, we come up with something else, which looks surprisingly like this. It's kind of involved to actually draw, so I need to erase the board to do it. Check. That's kind of the beginning of our grading scale, okay?

And the way our grading scale works is we start off with a check in the middle, which says this is a pretty solid program. It meets all the requirements for the program. Maybe it's got a little problem here or there, but it's a check. Then we have sort of two grades on the two sides of it: check plus and check minus.

Check plus is, like, solid. You did a great job; you got everything right; things look good, a nice style in your program, nice software engineering, and the program works flawlessly. Good job. This is like total "A." Check is kind of like, yeah, you're sort of there. It's kind of like "A" minus, "B" plus, maybe on some occasions "B." But it's kind of like it's pretty good work; you're in pretty good shape here. And so a lot of grades in this class ends up being check pluses and checks, and if that's the case, you're perfectly fine grade-wise.

Check minus, as you can imagine, this is kind of thinking about "B," "B" minus. It's, yeah, there are some slightly more significant problems with your program.

But that's not where it ends, right, because we wanna be able to even shoot for in some sense bigger gustoes. There was a plus and a minus. So plus is like, oh, nice job, kind of a hearty pat on the back. If you get pluses all the way through on all your assignments, you're in a pretty good candidate to get an "A" plus.

And minus, like, just take good over here and replace it with bad, it's kind of like, oh, bad times, right, or maybe, you know — but even there was, like, more significant problems with this program or just the style on the program is just really bad. But even there, we don't stop. And you're, like, "Come on, man. Like, I thought the whole reason was to simplify this." Don't worry.

And it gets even better because we have a plus-plus and a minus-minus. And at this point, we've run out of board space, so we can't go any further. But a plus-plus is just outrageous, right? It's the kind of thing — so this is the kind of thing your section leader can't actually give you without coming and talking to Ben and I first because they get a program that just goes — it has to actually exceed the requirements for the assignment. It's by a long shot. Like, you'll get all your assignment requirements, and what we encourage you to do is you can do a grade assignment and get everything right and have good style, and you'll be in this category. And for the later assignments, you may be in this category if it's flawless.

But we'll actually — if you want to go for the plus-plus, go beyond the assignment requirements. And the way we think about the plus-plus, it's a program that makes you weep in a good way. It's just like your section leader sees it, and they're just, like, this is so good, I've gotta show someone else. And they come and show Ben and I, and we're, like, sitting there looking at this on a monitor, and, like, tears are just welling in our eyes, and there was, like, soft violin music playing in the background and we get out the wine and cheese.

But something happens like, oh, it's a tough week, you've got midterms in other classes and you got this assignment due or whatever, that's a good time to use it. So we just trust you. And most people, we actually encourage you not to use them because it just makes you fall behind in the class.

Because we trust you and we give you these two up front, getting extensions beyond your two free class days is virtually impossible because we sort of up front said, hey, it's your responsibility. We're giving you two freebies. We're not gonna give you a third extension. Imagine if you had to come ask us for three extensions. By the third one, we'd be, like, okay, what's going on, which is why we don't necessarily give extensions beyond these two.

The only time we might give an extension beyond the two free ones is for something major, like death in the family or, like, serious medical problems that might require surgery or something like that. Every once in a while, unfortunately, that happens. I hope it doesn't happen in this class. But those are the only kinds of things that we give extensions to beyond the two free late days.

Importantly, don't ask your section leader for extensions. They cannot grant you extensions. Only Ben, who has all the power in this class, can give extensions, which is why you should get to know Ben and then hopefully you won't need to talk to him about extensions, okay?

So other thing to keep in mind is that three days late is the max. Beyond three days late, which is basically one class week, if you think about late days being class days, we will not accept an assignment. And the reason for that is at a certain point, you're so late, you're better off just doing the next assignment, letting the old one go. So to sort of enforce that policy, after three days, we don't accept that assignment late anymore. It's just gonna be a zero if it's not turned in, okay? And that just kind of forces you to keep up.

Couple other minor things, well, I shouldn't say they're minor things. They're actually kind of important. Exams: There's two exams in this class. There's a midterm and a final. Both of them are, well, I shouldn't say both. The midterm is out of class. It's from 7:00 to 8:30 p.m. on Tuesday, October 30. And it's on the syllabus. It's there. It's on the syllabus; it's on Handout No. 1. We repeat it multiple times. The date will eventually be announced when we get close to the midterm.

But if you have a conflict with this time, you need to send me email, okay? You can send me email a little closer to the midterm because I'll announce it again for people who have conflicts. But since it's an out-of-class exam, you need to send me email if you have a conflict. I'll get all the constraints from people who have conflicts and try to schedule an alternate time if there's enough people with conflicts. But 7:00 to 8:30 is when you need to know about the midterm.

And to make up for the fact that we have an out-of-class midterm, I actually give you sort of a belated free day, which is the Friday of the week of the midterm, we don't have class to make up for the fact that we made you come to the midterm outside of class. But the midterm's an hour and a half, and we can't compress time. If we could, we'd have different issues. We can't compress time and fit it into a 50 minute class, which is why it's out of class, but you get a free day for it, all right?

Last but not least, few things about grading. Grading, one of those things as you might be able to tell from this little board over here or something, if I didn't have to do it, I wouldn't do it because honestly, as corny as this sounds, I just believe in the love of learning. Like, I think if you're passionate about something, you just go do it and you learn it. But I'm naïve, and so that's not the way learning always works. So sometimes we actually need grading to make sure that learning takes place.

And so this is how your grade breaks down: Forty-five percent of your grade is on the programming assignments, okay? Fifteen percent is the midterm, which we'll just call the mid because we like to abbreviate everything. Thirty percent is the final. It's a three-hour final exam in the regular final time slot for this class.

If you think or are under the delusion that you should take two classes at the same time, that's a bad idea because their final exams are at the same time, okay? So you should not take two classes as the same time because our final exam is scheduled for — I believe it's December 13, which is a Thursday, 12:15 to 3:15. That's the regular final exam slot for this class. And any other class at the same time will conflict with that slot. Thirty percent of your grade is the final.

And that, if you add it all up, it's not just that I'm bad with math. It's because 10 percent of your grade is actually participation. And this is things like did you go to your interactive grading sessions? Did you regularly attend section? Did you participate in section? Did you participate in class, right?

And so, in order to help you participate in class, there's a little incentive to participate in class, which is sugar in the afternoon. So someone raise their hand. All right. Yeah, sometimes I'm not a good shot. And this will tell you, if you're sitting in the back of the room, I can't throw a Kit Kat back there because they're a little too light. Oh, yeah, sorry. If you sit in the back of the room, the roof prevents me from actually being able to hit you. So if you want the food, come up. But if you ask questions in class, hey, that's a good time. It's just a little way to be able to reward you for actually participating in class or to keep your blood sugar up if you need it, all right?

So that's participation. It's 10 percent of your grade, and as a matter of fact, at the end of the quarter, I ask every one of your section leaders to actually tell me how much you participated in class, and some of them just say, "Oh, this person was wonderful. They came every time. They participated. It's just a great thing." And that helps your grade out a lot, okay?

You can actually copy someone else's program and say, "I copied this program from Mary Smith." And I'll look at that and say, "They cited it," and it will warm the cockles of my heart. And Mary Smith will get full credit, and you'll get a zero because you copied your program from Mary Smith, but it's not an honor code violation because you cited the work, okay? So the bottom line is keep yourself safe and cite your collaborations. And I guarantee you most of the time, you'll be just fine.

Now, you might wonder why do I make such a big deal about this. And the reason I make a big deal about this is for a while, thankfully it's not true anymore, but for a while, the computer science department actually had more honor code violations than the rest of the university combined. Take everything else in the university, put them all together, they were like over here. And we're, like, we're computer science, which is not a fun distinction to have, let me tell you.

And you might wonder why is that? Is that because computer science people are just mischievous and dishonest? No. It's because it's easier to catch honor code violations in computer science. We have a whole bunch of tools that allow us — then we take all your programs and we run them through this tool, and it compares them not only to everyone else in here, but, like, to everyone from the last, like, X years where X is the large number of people who've ever gone through the classes, right? And it's an extremely good tool from finding where honor code violations happen, from where they don't. And it doesn't find spurious violations.

To be honest, I've never lost an honor code case. When I find an honor code case, it is blatant. And you take it to judicial affairs, and they look at it, and they're, like, yeah, this is blatant. And I take it to the student, and every student I've ever confronted them with never said, "No, no, no. I didn't cheat." They said, "You caught me," okay? So it's blatant.

It's not like, oh, there's some little line in it, "Oh, am I gonna need to worry about an honor code violation?" Remember those rules, you have nothing to worry about in this class. It's people who go and, like, fish out printouts from the recycle bins and copy other people's code that are the people we catch, right? It's blatant cheating that we catch. But we catch it. We catch it all the time. So I hope, I pray it doesn't happen in this class.

But the reason I make a big deal about it is historically if I look at the evidence, it happens and we catch it. And when we catch it, we're required by the university to prosecute. And I feel bad because usually it's someone who just made a bad call, like, they were up way too late the night before working on something else, and they're not thinking straight. And rather than just taking a late day or turning in their assignment late and getting a slight penalty on it beyond their two free late days, they decide to cheat. And that's just always the wrong call, okay? So you just don't wanna put yourself in that situation. So I get real serious about it for a moment, and hopefully it won't be an issue and we can just kind of go on, okay?

So with that said, that's a whole bunch of logistical stuff. Any questions about the logistics of this class or anything I just talked about? Uh huh?

Student: You had briefly mentioned the late penalty.

Instructor (Mehran Sahami) :Oh, the late penalty, good point. So remember our little bucket scale. If you go beyond your two free late days, every day you turn in an assignment late beyond those, it drops down one bucket. So let's say you already used your two free late days on Assignment No. 1. And on Assignment No. 2, you turned in something one day late and you would have gotten a check normally, it becomes a check minus. So that's how it is. It's one bucket per late day beyond your two free ones. Uh huh?

Student: Are the sections first come, first served?

Instructor (Mehran Sahami) :Yeah, the sign-ups, well, they take into consideration your preference, but part of your preference is to do the match is first come, first served. So you wanna sign up early. Oh, thanks for your honesty. As a matter of fact, I dig honesty, all right? Any other questions? It's just honesty's cool. Uh huh?

Student: How much time should we plan on studying [inaudible]?

Instructor (Mehran Sahami) :Oh, good question. How much time should you plan? And this is something that I say for classes in general at Stanford, which is not always true, which is take the number of units that a class is, multiply it by three. That's how many hours you'll spend per week in that class, total, on average. So what that means is in 106A, a 5 unit class, you multiply by 3, you get 15. Five of those hours are roughly spent between class, section, interactive grading, other stuff. That means on average about ten hours a week will be spent on your assignments in this class. Again, that's an average.

Sometimes when I go to computer science conferences, I sit there and joke around with plans. And we're, like, "Oh, how long did your assignments take?" And I say, "Oh, on average, ten hours." And what I really mean when I say on average 10 hours is they take between 3 and 45, okay? It's a large variance event, right? Ten is the average. Some people take a really long time. Some people get through it really quickly, but that's about the average you can plan for. Uh huh? Another question?

Student: [Inaudible] late days [inaudible] class days?

Instructor (Mehran Sahami) :Yeah, all late days are class days, so the free ones — the halfway mark's really my reach. That's about it. All right.

So I do wanna give you your very beginning of an introduction to programming before we sort of break for the day. How are we doing on time? And so in order to kind of see this, there's a few things that we wanna keep in mind.

Actually, let me show you a little picture, okay? Sometimes when we talk about writing programs, we talk about debugging programs, right? How many people ever heard the term debugging or bugs in programs? A bug in a program is an error in a program, so

gonna start with Java. We're gonna start with something even sort of simpler than Java because as I mentioned, sometimes what happens in computer science is people learn all the features of some language. And they think just knowing the language makes them a good software engineer. And they get so worried about all the features of the language that they don't kind of think about the big picture.

And so there was a guy named Rich Pattis, who oddly enough was actually a grad student at the time at Stanford, and he said, "You know what? If we're gonna teach computer science, when we first start out, why don't we have people not worry about all of the different commands of the language and all the different things they can do? Let's start with something really simple so you can learn all the commands real quick. And then you've mastered everything there is to master about that language, and you can focus on the software engineering concepts." And it turns out to be a brilliant idea, which has actually been adopted by a bunch of people.

And so Rich, who's a wonderfully friendly guy — sometime if we get him to come to Stanford, I'll introduce you; he's just very nice — came up with this thing called Karel the Robot. And the term, "Karel" actually comes from Karel Capek. Anyone know who he is? Oh, free candy. Uh huh?

Student: He coined the term, "robot."

Instructor (Mehran Sahami) :He coined the term, "robot." He was a Czech playwright who actually wrote a play called, "RUR," which was about robots. And the word robot actually comes from a Czech word, the Czech word for work. And so the robot is named after Karel. And some people say Karl, which is kind of actually closer to I believe if — I don't know if there's anyone who speaks Czech in the room — but closer to the actual pronunciation. But we say Karel these days because it's kind of like gender neutral, okay?

And so Karel the Robot is basically this robot that lives in a really simple world. And so I'll show you all that you can meet Karel the Robot. He's friendly; he's fun. I'll show you Karel the Robot. So we gotta get Karel running. He's at the factory. He's getting souped up. We're energizing Karel. You gotta add some color to it. Otherwise — all right. We're begging for him. Come on, Karel. There he is. Oh, yeah. That's Karel the Robot. He looks like one of the old Macintoshes if you remember the original Macintoshes that look like a lunch pail, except he's got legs. One sticks out his back. That's just the way it is.

And the way Karel works is he lives in a grid. To you, it may not be exciting, but to Karel, it's way exciting. So Karel lives in this little grid, and the way the grid works is there are streets and avenues in the grid. Streets run horizontally, so this is First Street, Second Street, Third Street. And then over here, we have avenues, First Avenue, Second Avenue, Third Avenue, Fourth Avenue, Fifth Avenue. It's kind of like Karel lives in Manhattan if you wanna think about it that way, okay? So Karel always is on one of these corners. So right now, he's at the corner of First Street and First Avenue, or we just refer to it as 1 1 if you wanna think about sort of Cartesian coordinates, right? But just think of them as streets and avenues. That's where Karel lives.

And Karel can move around in this world. There's a bunch of things that Karel can do. He can take steps forward. He can turn around to face different directions, and he can sense certain things about his world. So there's some things that exist in Karel's world, okay? Things like walls that Karel cannot move through, right, so his world has walls all around it that he can't go through, so he can't fall off the end of the world. And there's other walls like this one if Karel were over here, he can't step through that wall.

There's also something referred to as beepers in Karel's world. And what a beeper is, is it's like a big diamond, okay? But what a beeper really is, is basically just some marker that he puts in the world. You can think of a beeper like a piece of candy. And Karel just goes around, like, putting pieces of candy in the world. As a matter of fact, not only does he put pieces of candy in the world, he carries around a whole bag of candy.

So he has a beeper bag with him, and sometimes that bag has a whole bunch of beepers in it; sometimes it only has one beeper; sometimes, it's sad Karel, and he has no beepers. But he's still got the bag. There just don't happen to be any beepers in it. So he can potentially, if he come across a beeper in his world, he can pick it up and put it in his bag, or he can take, if he's got beepers in his bag, he can take them out of his bag and put them places in the world. And corners in the world can have either zero — if they have no beepers, they just appear like a little dot — or one or more beepers on them that Karel can potentially pick up, okay?

So any questions about beepers or Karel having a little bag of beepers? And that's it. That's Karel. That's his world. His world, we can make it larger if we want. We can put in walls in different places. We can put beepers in different places. We can have Karel be in a different place.

But starting next time, what you're gonna realize is with this extremely simple world, there's actually some complicated things you can do. And after about a week — so this first week, we're gonna focus on Karel — you'll notice that Karel is actually a very nice, gentle introduction into Java. And a lot of the concepts that we learn, sort of software engineering concepts using Karel, will translate over to the Java world, okay? So any questions about Karel or any of the other logistics that you've actually heard about in the class?

Alrighty then. Welcome to 106A. I'll see you on Wednesday.

[End of Audio]

Duration: 50 minutes