Sie sind auf Seite 1von 16

[ Music ]

[ Laughing ]
[ Music ]
>> Yeah.
[ Applause ]
>> My name is David Malan and this is CS50. 77% of the people around here in thi
s room have no prior experience and that was the same way last year with your 49
4 predecessors all of whom accomplished the sorts of things that you saw depicte
d in those screens there. There's a lot of misconceptions about computer science
that it is dominated by folks with their heads down at computer terminals toili
ng away, completely anti-social. A reputation that it is dominated by men and no
t so much women, and yet these are things that are changing. In fact, last year
alone we had a record number of women in Computer Science 50, up to 37%, almost
40, and I don't doubt before long that we will be at 50/50 perhaps even this yea
r here too. And realize too, that if you're thinking what the hell am I doing in
a computer science class, realize that same emotion is probably going on in may
be 77% of the people to your left or to your right today. But indeed, there's a
whole gamut of comfort levels that we have in this course and these are statisti
cs that are consistent throughout the years. Last year 46% of the students in th
is course declared themselves as being among those less comfortable. There's no
precise definition for that but you kinda know it if you're in that bucket and p
erhaps some of you have already just slapped that label on yourselves. We had la
st year 42% of the students in the class being somewhere in between less comfort
able and more comfortable with 12% of the class being those types who may very w
ell have been programming since they were 10 years old or who took AP computer s
cience, but we have all sorts of demographics in the class, and as you'll see to
day and on Friday, there are a number of ways in which all students in this clas
s can approach it and ultimately succeed as in that imagery there. And in no sma
ll part that's because of the sheer size of the teaching staff this course has.
Seated in front of you are only those TF's and CA's who are skipping classes rig
ht now, but indeed we have some 87 teaching fellows and course assistants on sta
ff, many of whom you will meet over the course of the semester. Now what is comp
uter science? We've started this class in recent years with a little demo involv
ing tearing a phone book and you might've heard about this sort of thing before
and it's a little hard to keep doing the same bit even though it might very well
send a very compelling, we think, pedagogical message. But I just found a huge
stack of phone books in [inaudible] in the computer science building this year,
so I thought we might as well do justice to last year's phone book by actually h
aving some of our own team members here answer a question of this form. So a pho
ne book of this size has, you know, some 1,000 pages in it. And this is a fairly
tedious problem to solve if you're looking for something very small, a needle i
n a haystack so to speak. And so if you're looking for, let's suppose these are
not so much yellow pages but white pages with people's names in them, someone li
ke Mike Smith, well you could certainly start at the beginning and turn to the n
ext page and you could see that you're on the A's. You could see that you're on
the B's and the C's and then so forth and my god some 600 700 pages later, we mi
ght happen across Mike Smith, but if we could perhaps have about every third TF
and CA here stand up, perhaps we can do something a little more compelling than
that and send home the first such message of the day as to what it actually mean
s to do computer science and to solve problems, as we say in the course catalog
description, more efficiently and more effectively. Those TF's and CA's who now
have handbooks, phone books in their hands, if you could please stand up and let
's see if we can't have the audience here too answer a bit of, here we are, let'

s see do you wanna just keep passing these down, otherwise this is gonna take al
l day. Why don't we have each of these guys solve this in what's probably a much
more intuitive way. I'll hang onto one for myself and of course anyone from the
audience probably now can point out that my algorithm, my procedure that I prop
osed a moment ago starting at the beginning and turning to the right, turning to
the right, might very well be correct. And indeed it is correct but it's kind o
f stupid, right? Because clearly we can do better than this. So anyone in the au
dience, what would a reasonable human being do to find Mike Smith in a phone boo
k of this size?
>> Tear it in half.
>> So te- tear it in half. So we'll get there. So you'd look roughly in the midd
le right? You sort of haphazardly pull it on into the inside. So if our voluntee
rs here standing with phone books could do exactly that, odds are, Matt you ende
d up at what letter in the alphabet?
>> M.
>> M, indeed which makes sense 'cause it's roughly in the middle of the alphabet
and so Mike Smith is now clearly to the right so perhaps our TF's and CA's coul
d demonstrate exactly how we can chop this problem in half now.
[ Laughing ] Most. . . perhaps most of our staff can demonstrate this. So now we
've got a problem that's half as big, right? Now we have the M's through the Z's
and so we might dive in again and so the staff might split the phone book in tw
o yet again and now we've gone from 1,000 pages to 500. We're about to go now in
stead to 250. So if you'd like to iterate here again and tear. So now we're down
to just 250 pages and if you guys want to repeat and repeat and repeat, after j
ust a few tearings of this, only around 10 in fact, should they finally reach ju
st a single page and on that page should ideally, if they were paying attention
to the pages that they were tearing be someone, [laughter] and I don't know what
's going on here [laughter] would be Mike Smith.
[ Applause ] So thanks to our team here. These are just a few of the faces you'l
l meet over the course of the semester. You're welcome to sit here the entire le
cture, that's fine, but in a moment we'll need just two of our team. So what did
this really do for us? Well we went from a problem of size, again, 1,000 down t
o a problem of size 500 to 250 and this is a very powerful thing. We're not just
taking one page at a time but rather we're taking huge, non-trivial bites of th
is problem out at any given time. So what does this actually mean? Well, let's c
onsider another example and, whoops, let me zoom ahead to an algorithm here so t
hat we can get the juices flowing among the audience here as well. So every year
it's a real pain to do attendance in a room of this size and it would take me f
orever, much like it would take me forever to find Mike in this phone book, I co
uld start sort of like your grade school teacher would and do one, two, three, f
our, five, six, and seven, and finally we'd get up to N, the total number of stu
dents in the room. Now what's a modification to that algorithm that you probably
learned say in middle school or in high school. How could we speed up that algo
rithm very easily, very mindlessly? You count by two's right? Instead of doing o
ne, two, three, I'm pretty good at counting even numbers so I can do two, four,
six, eight and so forth and so if we were to plot this just very simply on a cha
rt, if I said that my original algorithm was just counting one at a time and the
re's N students in the room, well that algorithm's gonna take N steps, N seconds
, N minutes, N operations, whatever the unit of measure is. But if I start count
ing in twos, well I can double the speed of this algorithm and that's pretty goo
d but my god it feels like there's room for opportunity here at the right-hand s
ide. And though I'm jumping around and spoiling some of the imagery, let's see i
f we can't paint this picture as a group as to how much faster we can count ever
yone in this room than I could. So if you would humor us, the staff of 50, if ev

eryone in this room could now stand up and think to yourself the number one, go
ahead now and execute step two, pair off with someone near you, add your numbers
together and just one of you should sit down.
[ Audience chatter ]
>> Do we know what the total is roughly?
>> What's that?
>> Do we know what the total is roughly?
>> [Inaudible]
>> Oh god, I don't know.
>> Can you try to figure it out in the next 30 seconds?
>> [Inaudible]
>> Okay.
[ Audience chatter ]
>> So those still standing should continue pairing off. . .
[ Audience chatter ] And we see just a few folks still standing. . .
[ Audience chatter ] It's at this point where the demonstration starts to get a
little awkward 'cause either the people get far away or the ri- arithmetic gets
difficult. [laughter] How many folks do we still ste- have standing? I see one,
two at at the top, you two up at the top can pair up, you three up at the top ca
n pair off. Anyone else down here still standing? You two. What what's your numb
er here?
>> 52.
>> 52 plus?
>> 91.
>> 52 plus 91 and what do we have in the balcony?
>> Balcony, 119.
>> 119 total or just you?
>> [Inaudible]
>> 172? Anyone else still standing?
>> [Inaudible]
>> Okay yeah?
>> 159.
>> 159. Uh oh. I didn't hit plus, now we're up to 17,000. [laughter] Anyone else
? We're gonna fake the rest of this.

>> [Inaudible]
>> 45 which puts us at 18,000 [laughter] and the total should indeed be, did our
teaching staff come. . .>> Yeah, 570.
>> 570. So plus, wait plus?
>> 121.
>> 121?
>> Yeah.
>> Okay so the the preface for this demonstration historically is that this algo
rithm tends not to work so well in reality, but there, if you consider it on a t
heoretical level how much faster that could, how much faster that should have go
ne, well indeed if I were still counting like this and there were, let's say 500
people in this room, my hand would've had to point at 500 people individually,
or better yet maybe 250 total iterations; but how about your all here? There's 5
00 people in the room, but on every iteration of this algorithm, this procedure,
this program, call it whatever you want-- half of you were sitting down. So it'
s much like this same phone book example. 500, 250, 125, and so forth and so tha
t begs the question how many times can you divide a room full of 500 people in h
alf? Well, feels like it's only around nine if you do out the math and you kind
of ignore rounding errors and so forth you'll get down to a single, lonely, awkw
ard volunteer standing in the middle of the room ideally containing that number,
and I simply facilitated here by merging some of these numbers together. And th
at's a powerful thing because if we go back now to where we started, counting so
rt of like in grade school, and then we upgraded to twosies in middle school, bu
t now we have something fundamentally more powerful and that's this notion of lo
garithmic growth as opposed to something linear-- linear implying the straight l
ines there, logarithmic, this is sort of the end game when trying to implement s
omething well, and that will be a theme of this course. Not just getting somethi
ng to work, 'cause right, I could fine Mike Smith the old fashioned way but it's
not slow, it's not efficient. I'm gonna go use some other website, I'm gonna go
use some other program that performs better and solves problems more efficientl
y for me. Well the other thing about computers is that they're not all that, act
ually I did have one snippet here, let me pull this back. Wimbledon. So you migh
t be familiar with the notion of tennis and these tournaments that happen each y
ear, and in Wimbledon we have some, what is it 128 people participating in a giv
en tournament? And that tournament actually goes fairly rapidly because when you
're playing tennis of course you're playing against another person, and so every
time a game is played and if you're assuming single elimination, you get to hal
ve and halve and halve and halve the number of players participating until you h
ave ideally just one winner at the end of the game. But imagine now how we can a
pply this idea of divide and conquer, taking a problem and splitting it in half,
and then in half and then in half whereby we're not doing anything new and diff
erent each time, we're doing the same darn thing again and again but the problem
is rapidly approaching the solution, just one. So I looked it up on Wikipedia e
arlier today and there's about seven billion people on earth right now. Well you
know what's a pretty powerful thing? We could actually have a worldwide tennis
tournament where all seven billion, maybe lets even round up to eight billion pe
ople, could participate and how many rounds would that actually take? Well, how
many times can you divide roughly eight billion people in half? Well you go from
eight to four, four to two, two to one, one to a half billion and so forth. Wel
l you know what, we could knock off this global Wimbledon tournament after just
33 rounds of play. Now, admittedly we'd need a whole lot of tennis courts to be
doing this all in parallel and simultaneously but that's the power of actually t
hinking through and actually coming up with algorithms that are much more elegan
t and efficient than what might otherwise be obvious. The problem though is that

computers need to be told what to do and we've all gotten frustrated by compute
rs when they don't behave as expected and that's usually not even your fault, bu
t the fault of some programmer who made some mistake, who didn't anticipate some
condition, or made some assumptions that the user then kind of flaunted. Well w
hat's an example? Well if you look up most any cooking book, well a cooking book
will typically start with a recipe in step one something like put egg in bowl.
Well here's a bowl, here's an egg. It's kind of assuming a few things. That's no
t in fact what the author intended, so we need to be more precise right? We need
to make m- we cannot make so many assumptions. If we want the computer, if we w
ant the cook to do what we want him or her to do, we need to be more accurate an
d we need to think about how best to express those things. Now you've probably n
ot had the fun of filling out your own tax forms, but by contrast, the world of
federal taxes is very much the opposite. You get these crazy worksheets that are
now available in PDF form or you can use software like TurboTax and the like, b
ut if you just glance at this sort of thing you'll see that it's ever so precise
. For instance, it asks you to check a box and input a number in row five, in ro
w six, in row seven, and then it explicitly says in row nine, add lines five thr
ough eight. In other words, the process of taxes is actually, though overwhelmin
g, much more precise. It doesn't just say add up what you earned this year and l
et us know, right? It's much more precise than that. So perhaps we could do some
thing like that along the lines of something more familiar and less daunting tha
n taxes. In a moment I'm gonna go ahead and play some background music and let m
e ask that you humor us here too by pulling out a sheet of paper and writing in
no more than one, maybe two minutes, an algorithm, a ste- a set of procedures, s
ome number of steps line by line with which you could instruct a computer or a h
uman or just a friend to make you a peanut butter and jelly sandwich and assume
only that you have a jar of peanut butter, a jar of jelly, a loaf of bread, and
a knife. You have those as your ingredients and so if you would, take just one m
inute or two to write out this algorithm and we'll see how well we have done.
[ Pause ]
[ Music ] I'll let it play at least once more.
[ Music ] Let's do one more iteration.
[ Music ] And go ahead and finish what you're working on. I'm gonna need a coupl
e of volunteers. How 'bout you two lovely contestants? Come on up. And how 'bout
you folks who have not been prepped on the staff? Yes I see two hands, how 'bou
t in the red shirt here and some of someone from this side, someone from this si
de. . . more interest. More interest. I'm not seeing the, how 'bout you with you
r hand the highest? There. Ri- yup, you who just turned around. Yeah, come on do
wn. There'll be ample opportunities during the remainder of the term. So, now th
ere's still an opportunity for some participation here. I need two people's algo
rithms that they actually wrote down, all right? Better be good. Thank you.
>> Preview it, it's right there.
>> Okay. Not gonna get this back if that's okay. And one more volunteer.
>> [Inaudible]
>> All right. All right these'll be very short demos. All right, so we've got fo
ur of our volunteers here, only two of whom I actually know. So let's see your n
ame is?
>> I'm Daniel.
>> Daniel. David. All right this is Rob, Zmyla and. . .

>> Lisa.
>> Lisa. David. All right so I just so happened to go to the supermarket before
this example and this was actually inspired by my fifth grade teacher who at the
time, I'm pretty sure did not intend this to be any sort of demonstration in th
e pedagogy of computer science and the ideas behind algorithms, but really just
how to teach 10 year olds how to follow directions. Well let's see if we can't g
o borrow the same spirit of this since I was well equipped here to go and pick u
p some loaves of bread. So we've got some bread for each of you. [bag rustling]
All right.
[ Pause ] We've got some jelly here and a knife as promised.
[ Pause ] We've got knives for each of you. And lastly, the final ingredient wit
h which to see how well these algorithms performed-[ Pause ] [laughter] All right, so let's see how our two volunteers here did. So
I'll go ahead and be the advisor. You all should be behaving in exactly the sam
e manner that a computer or a robot, let's say, would actually interpret these a
s making no assumptions. All right, step one, go to the Annenberg lunch table. [
laughter] Okay. All right let's try, let's start with the other one and see wher
e this gets us. [laughter] So, step one here is take two slices of bread from th
e loaf.
[ Laughter ] Incidentally, I should've said this before, you have to be comforta
ble appearing on camera and on the internet as we do this. Okay. All right step
two, apply two tablespoons of jelly on both halves.
[ Laughter ] Step three, apply two tablespoons of peanut butter in the same way.
[ Laughter ]
[ Applause ] Step four, join the two halves
[ Laughter ] And step five, perhaps coupled with a round of applause, have fun.
[ Applause ] So, thank you very much to our volunteers. The the sandwiches are y
ours. So, suffice it to say that there's room for improvement in something like
this. And this might seem like a ridiculous visual but the reality is when it co
mes time this semester to instruct a computer to do something, you'll be surpris
ed just how often and how bad you are at that when you're doing this, most likel
y for the very first time-- when you're doing this for the very first time. And
so among the lessons that will become ingrained over time honestly is truly how
to think more carefully, how to think more precisely and in turn, how to express
yourself -- if you can just take the tables with you-- how to express yourself
more methodically so that the person hearing your counsel, the person hearing an
d taking your instructions can actually implement them correctly. Now let's come
back to this notion of numbers and this notion of solving things more efficient
ly, and this notion of dividing and conquering and really the notion of things t
aking more time or less time-- [laughter] all attention is clearly focused right
here right now isn't it?
[ Pause ] Okay.
>> We have an algorithm too.
>> No problem. Very nice. All over the internet this is now. All right thank you
to the team. So consider this, suppose you were asked, and let's pick a volunte
er up front here since you just caught my eye. So we can have this conversation

right here. I will hand you a million dollars, I will write you a check right no
w for a million dollars or instead you can have a penny today but two pennies to
morrow, four pennies the next day but just for a month. Which would you prefer?
>> [Inaudible]
>> Take the pennies.
>> All right so right, frankly, whenever asked in life to make a choice between
something that sounds good and something that sounds stupid, take the stupid thi
ng because there's probably a hidden lesson in there and indeed there is. If we
consider this-- oh I just reneged didn't I? So consider this-- actually we did c
ome prepared. Can't quite cover it today, but this'll get me through the week I
think. [laughter] So why do I suggest we can't quite cover that? Well let me jus
t open up something like Excel. Let me say now and just once that Excel is not c
omputer science, but we'll use it simply because it's a nice way of just doing s
ome numbers real quickly. So suppose that on day one I were given a single penny
and on day two I get twice as many and then twice as many. Well I can do a sill
y little Excel formula here where I just say times, times two, and then I can ju
st repeat this and repeat this and repeat this and repeat this, and this is gett
ing tedious so let me just highlight all the way up to say 31 days in a month an
d his paste, and by the time I get up here you might very well have made the rig
ht choice. In fact just to make this point ever so clear, let's go up to formatt
ing-- this too, not computer science-- let's go to currency, okay, just so we ca
n see this a bit more visually, and my god! You banked 10 million dollars from t
hat deal so, three weeks ago. So it's quite extraordinary what happens and what'
s the relationship here? Well the actual math behind all of this and the actual
thinking is actually the same; whereas before we were dividing, dividing, dividi
ng, and dividing in half again and again and that allowed us to solve something
much faster than with some simple, if naive, approach, the implications are the
same in reverse. So if you actually do something foolishly, or in this case with
out thinking, the cost can certainly pile up over time. And so one of the other
themes in the course, and in programming more generally is going to be about the
amount of time it actually takes for your programs to solve problems. Every one
of us has probably gotten angry at our computers at some point 'cause of the st
upid spinning beach ball or hour glass or something like that that means it's th
inking or doing something. Well it's probably not doing it all that well, and on
ce you get to the point of implementing the next Facebook or Google.com, you've
got to be better than just linearly searching through all possible pages on the
internet in order to find some search term of interest to you. Well this sort of
works in the s- in a similar way too, and I mentioned here Facebook-- you're fa
miliar with the notion of the six degrees of Kevin Bacon perhaps whereby you are
probably connected to someone else via at least six friends. So I might be frie
nds with Alice, Alice with Bob, Bob with Charlie and so forth and at some point,
one of those people in that relationship is going to know Kevin Bacon of all pe
ople. But what's the implication of that? Well you can actually feel this all th
e more these days with Facebook and the like because even if I imagine something
quite simple-- suppose I have just 100 friends. Well that's actually in Faceboo
k terms these days actually relatively low right? But we'll start at that partic
ular point and I'll see if I actually multiplied, let's say the previous cell up
there by 100 again, the idea being well if I have 100 friends, those friends, l
et's assume for simplicity, have 100 friends and their friends of friends have 1
00 friends, how much does this blow up? Well let's actually do this for six degr
ees, up to six and my god, by the time you get six degrees away, no wonder you k
now Kevin Bacon because you have a trillion people in your social network. Now b
ack in the day a few years ago when Facebook belo- began only at Harvard and was
initially only available to Harvard students and then nearby universities, they
actually had a neat feature where they would show you a graph, a visualization
of your friends and your friends of friends and then they ripped that out and re
moved it altogether and at best these days maybe you have some kind of relations

hip with friends of friends, because to actually transitively continue this out,
I mean my god you end up knowing everybody on Facebook and more people than the
re actually are in the world at this point. And so these numbers start to build
up, both upwardly and downwardly. Well along those lines, let me tease you with
this. So we have a lot of friends that Facebook being that it did in fact have i
ts origins here and I thought I would tease you with a little image here. What w
e thought we would do this year is invite some of our friends from Facebook back
to campus to some of, CD50 TF's no less, to help us explore some things like th
is. I won't leave this on the screen for too long. It will be in a PDF online on
the course's website if you'd like to noodle through it further, but this is an
example of a puzzle, and it's hopefully non-obvious and this too doesn't necess
arily relate to computer science per se but more generally to the solving of pro
blems. And that really is what this course is about. Though we will use programm
ing as a tool to solve problems, the course at the end of the day is about reaso
ning through, taking inputs, producing outputs, and figuring out the solutions t
here too. Now what's the relevance here? Well our friends at Facebook have kindl
y offered to take us all out, or some subset of us, out to dinner on Friday. Mor
e on that in a little while via email this week, but they'll also be joining us
on Saturday. And if of interest to you, from roughly 12 to 3 p.m. this Saturday
will we have the first ever CS50 puzzle day sponsored by Facebook. If this is of
interest to you, just go at some point today to cs50.net/register and the way i
n which this will work is you will arrive, you'll be fed, you'll then be challen
ged with a handful of PDF's or printouts of seven prod- p- puzzles similar in sp
irit to those but each quite distinct that somehow spell out a seven letter word
that's in fact going to be a seven letter word on campus. And if you then go se
ek that out and do that quicker than everyone else, you will win some fabulous p
rizes, among the first prizes for teams will be some $50 gift certificates, $25
gift certificates for the runners up, and for anyone who participates will there
be on a raffle basis a wii given to anyone randomly who partakes, irrespective
of performance in the puzzles. But, so that this is inherently a social activity
and not a whole bunch of individual people hunkered down solving puzzles on the
ir own, you'll be required to bring at least one friend, ideally someone from ou
tside this room, outside taking CS50 this year, but up to a maximum of four team
mates. So if you have some block group, blocking group friends or some link-mate
s or the like with whom you would like to do this, we'll post more details on th
e course's home page at cs50.net, but do take care to register because seats wil
l be limited, and if an interest in the idea of dining with me and some of the T
F's and CA's this Friday night, go to the cs50.net/rsvp and we will, if necessar
y, lottery things off so that you don't need to all be doing this now, especiall
y since there's not so great wi-fi in Sanders, we'll actually follow up via the
website and randomize things as needed. So more on that by Friday. So speaking o
f Facebook, a number of you found your way here or to other classes today via th
is tool of ours, the course's own shopping tool called Harvard courses that live
s at that URL there. So this tool happens to be integrated with Facebook which,
to be honest, is remarkably easy to do these days. And indeed, many of our own s
tudents do this toward term's end so that you no longer have to implement the no
tion of registering for accounts or remembering yet another username and passwor
d. You can integrate with Facebook and any other number of providers like Google
and use their own usernames and passwords without you yourself seeing them. Wel
l the upside of this too is that we too get to see network effects of shopping f
or courses and hopefully you found it to be a little more efficient than traditi
onal approaches. Now with that said, let me personally apologize to any of you u
sing the tool between 8 p.m. and midnight last night. I was sitting down prepari
ng for a lecture and got an IM from one of our TF's, OMG Harvard Courses is down
. That then delayed the preparation for this lecture by about four hours while w
e responded to the sudden spike of interest the night before shoppi- the night b
efore classes began and actually figuring out what courses you want to shop. But
we thought we would share some fun facts, at the moment this particular tool, i
f familiar with it, has some 2,500 Harvard undergraduates using it over the last
week alone. The not- the total number of courses across your shopping lists col

lectively as of this morning at eight was about 25,000. Particularly fun was to
see statistics like the average number of courses that your friends are shopping
is actually only around seven but this is highly variant. This, again, is the a
verage number of courses people are gonna try to check out this week and next. T
he maximum this year which broke last year's record is in fact, 125. Now you mig
ht think that's an outlier worthy of just dismissing, but rather, the runner-up
was 123. So you are in good company if you are that 125. But not to dwell too lo
ng on Facebook but really to use it as a point of departure for just how applica
ble how things like computer science and programming more generally are, oh and
I did have one more fun fact I should probably share. So turns out that if you l
ook at the means by which people are using the imbedded calendar if using this t
ool, the most popular time to be busy is between 3 p.m. and 7 p.m. presumably be
cause of sports and extracurriculars and the like, but I daresay we looked cl- a
little closer at the data and the second most popular time to be busy is [laugh
ter] note, no 9 or 8 a.m. classes it seems are of interest. So what are some of
the opportunities here? Well besides doing things and building things that relat
e to the tools that you yourselves use, you can actually still make things that
are just as, say technological. And as you'll see over the semester, with relati
vely little complexity, the margin of return of spending just a few weeks and th
e months in a course like this is that you learn how to build things that you ta
ke for granted as using these days and you take for granted as being accessible
to you in your pocket, but it's remarkable as those images suggest just how much
your predecessors accomplished over the course of just three months. One of the
tools we built out has a course for students to use before the Harvard courses
tool was this one, a much simpler tool that simply took what traditionally was i
n PDF and paper form alone, the Harvard shuttle schedule, and allows you to look
up things well, I'm in Mem Hall, I'd like to go to the quad, so I might click t
here and click there and now you can see the next shuttles when they depart. Now
this is becoming underwhelming these days but indeed this was a huge improvemen
t when the alternative was just paper. But you can do cool things too, and as we
look ahead in this course to the final project, know that you'll be able to mak
e things like this. If you don't mind, just have to make a quick call. I've got
my thing plugged into the overhead here.
[ Pause ]
>> This is CS50. For Shuttleboy, press one. To start over, press nine. . .
>> So I've pressed one.
>> What is your origin? For quad, press one. [Inaudible], press two. Boylston, p
ress three. Lamont, press four. Mem Hall, press five. To start over, press zero.
>> So I'll hit five.
>> What is your destination? For quad, press one. [Inaudible] press two. To star
>> Let's go to the quad.
>> The next shuttle leaves in seven minutes at 2 p.m. and then at 2:10 p.m., 2:2
0 p.m. and 2:30 p.m.
>> So there's your exit strategy if you're getting bored already. Well that numb
er was 617-BUG-CS50, and what's exciting about this is not so much that, because
Frankly you can use SMS, you can use a plastic piece of card to look up numbers
more quickly than the phone might recite, but that service alone that CS50 uses
for that called CS50 voice is a tool that you yourselves can use at semester's
end if you would like to build tools that actually make outbound calls, and or r

eceive inbound calls and respond to some input. And that's all possible thanks t
o this notion of what's generally called an API, application programming interfa
ce. And these have been entering now even the co- the public lexicon. To use an
API generally means to use data or to use functionality that someone else has im
plemented so that you yourself can stand on their shoulders and integrate really
helpful, really cool, really useful functionality into your own program without
reinventing that wheel yourself. You can liken it to the act of building a hous
e. You could go out and chop down trees. You could go out and melt glass and mak
e windows, but what do you do instead? You go to a store. You go to Home Depot.
You buy planks of wood, you buy sheets of glass, and you integrate those pre-fab
ricated components into your own work so that your contribution to the whole pro
cess is the final output and you care less about the al- the underlying details
of implementation. Well, let me go ahead in just a moment here and bring up our
head teaching fellow Matt Chartier and also our other head Rob Bowden to say a q
uick hello. Rob you'll recall was the guy with the special loaf of bread earlier
. You'll have to talk into my chest over here [laughter] [inaudible]. [Inaudible
] okay. . .
>> Less awkward. [laughter]
>> Yes, much better. Hello everybody, my name is Matthew Chartier. I'm a senior
in Kirkland House and a concentrator in computer science. I've also TF'd CS50 fo
r the last two years and am returning for this year, this time in the role of he
ad TF. I'm very excited to be back with the course in this capacity this year to
help David organize everything and to make a wonderful experience for all of yo
u just like the experience I was treated to freshman year coming in. My role as
head TF is essentially going to be a point of contact, both between David and th
e rest of our teaching staff but also between the TF's as a organization, as a s
taff, and all of you. So if there are any point during the course where you have
any issues that you you don't really know how to reach out to, I'm the person y
ou want to reach out to for that. Contact me at heads@cs50.net. You can also rereach either David or Rob here at that address. Just to talk a little about the
course because I'm waxing nostalgic a bit now looking out over our first lectur
e for I suppose the last time and remembering when I came in freshman year and t
ook CS50 for the first time. I came in without any prior experience. I had no fo
rmal training in CS. I'd maybe mucked around a little in a couple languages just
'cause I was curious but didn't really get anywhere with it. And coming into CS
50 at the time thinking about concentrating in something maybe like physics or g
overnment, I found a whole new world opened up to me. I was exposed to exactly w
hat computers could do and how powerful these simple programming languages, just
typing statements in text files and making them do something could really be, a
nd how exciting it could be to work in that sort of environment and to really ma
ke things happen with these machines we do every, we use every day. I also found
something else. This isn't just an intro course, it's sort of an experience and
an institution, and if you don't think that yet, I assure you that by semester'
s end you may have a new perspective for what exactly happens here. CS50 is one
of those rare courses at Harvard College that is challenging, populace, elaborat
e, and fun enough to really create a sense of community amongst the entire cours
e and to create something that's not only useful for you, but memorable. It's ce
rtainly been memorable for me and I can't wait for one more ride with this great
course, and I hope that you have the same experience. Thanks a lot and I'll pas
s the mic off to Rob.
[ Applause ]
>> I'm Rob from Kirkland House. I'm a junior and this is my second year TFing CS
50. You know we've really tried to make this course so that you don't really fee
l like you're doing work, you feel like you're having fun. You really get this s
ense of accomplishment when you finish a problem set. How often do you take a co
urse where when you finish a problem set you can show it to your roommate and th

ey can play a game, or you can give a URL to a friend back home and they can see
what you've done. So, like Matt, like Matt said, this course does have a cultur
e and I just want to encourage you to really get into it 'cause it's so much mor
e fun that way. And especially for the largest chunk out, of you out there who a
re less comfortable, there's no reason to feel alone even if you get frustrated.
We do have this staff of 87 people. We're all here to help you make this class
the best it can be. So I hope you have a fun semester.
>> Believe it or not-- thank you both-- believe it or not I started out in life
as a, thank you.
[ Applause ] So for what it's worth, testament to just how fun this particular w
orld can be, I started out life here as an undergraduate in 1995 and was heads d
own into the government department thinking I'd come in ha- having liked things
like history and [inaudible] in high school and such and so I didn't really thin
k about exploring a bit beyond my own comfort zone. And indeed, CS50 then and to
some extent still now, as well as computer science more generally, has this sor
t of daunting reputation that it's not so much for the uninitiated, but rather f
or those who've been doing it since the beginning of their life. But that's inde
ed not the case. That 77% statistic has been quite consistent and so it wasn't m
yself until sophomore year that I finally got up the nerve to actually take the
course but I took it pass/fail. I enrolled because I thought I'm on this track t
oward government but I'm gonna finally get up the nerve to actually dabble in th
is course. And long story short, just the end of that semester did I declare my
concentration as CS, that I end up, my god, doing this here today for the same c
ourse I once took. But that's not, to be clear, the goal in this course. Most of
the students, about oh just over half of the students that take 50, it is for t
hem a terminal course in that they don't go on to take other courses in computer
science, but they parlay those skills and the savvy they derive. And of course
like this, back into the social science, the humanities, the physical sciences w
here they have large data sets or large volumes of information that they need to
analyze or process. Or even in the more familiar world of running student group
s, and you want to be able to send out a mass mailing to 1,000 people. My god, d
oing it manually isn't so fun using a tool like Microsoft Word and Excel so you
can do better than that if you do it yourself and you have the savvy with which
to do so. And that's ultimately too, some of the take-aways of a course like thi
s. So a hello here to CS50 as to what to expect. So in terms of expectations, th
ey're fairly straightforward-- attending lectures and sections, submitting nine
problem sets, taking two quizzes, and a final project, the images of which are c
onveyed by the fair and Hackathon alike. In terms of grade, this is one that's p
articularly close to my heart; I am not a fan in general of grades. I think they
tend to do more harm than good. There is value in that they certainly help moti
vate, but that of course can be to a crippling degree. And so we've tried in rec
ent years to send the message quite ardently to do what I myself did to put that
toe in the water and to explore what for many of you are indeed unfamiliar wate
rs by taking it, if you so choose, pass/fail. You can do it letter grade or pass
/fail. We go so far as to provide you with these pink change of grading status p
ass/fail forms at either end of the lecture hall and I'm happy to sign study car
ds for which you might like to do that. Do ultimately consult the syllabus for s
ome fine print as to what courses can and cannot count for concentration credit
if you do take it pass/fail, but undoubtedly if on the fence or a little bit ner
vous about putting that toe in the water, taking a course as I once did, pass/fa
il, and then having the opportunity to change your mind up 'til the fifth Monday
of the term is a wonderful way of kind of getting past that initial fear of fai
lure, whether failure is an E or a B, but to actually give you that comfort to t
ry something new. So toward that end of sending the message, we actually have a
tradition in the course of having cake in just a few minutes. We decided we'd pr
int and emblazon on each cases, on each cakes the message we'd like you to take.
We have one in chocolate, one in vanilla, one with some vanilla and chocolate.
[laughter] Maybe don't eat the fourth cake, but that one too will await you befo

re long. But what is the course ultimately about? It's mostly about the hands-on
aspects in lectures where we present concepts and ideas and try as best I can,
to get you excited and in- genuinely interested in some subject. But undoubtedly
the work and the experience in this course derives from your working on the pro
blem set. But know that, so that's the appeal to both those less comfortable and
more comfortable alike, most of the problem sets we issue in two different edit
ions so to speak; a standard edition that's targeted at 90% of the students in t
he course, and then typically a hacker edition which ultimately covers the same
sorts of material but from a more sophisticated, a more challenging perspective.
Asks you to do a bit more in terms of sophistication because those hacker editi
ons assume more. So realize too that though I might focus verbally on this 77%,
there is a non-trivial number of 12% of the class that indeed have been programm
ing since they were, say, six years old, or just took one course in AP computer
science, or didn't even do that, but just kind of feel that they're ready for so
mething new. So realize that there are these disparate tracks within the course
that appeal ideally to both. Moreover does the course provide some number of lat
e days that you can spend during the semester. Inevitably, life happens and you
need to, for instance, deal with some midterm or some other classes deadline, so
realize you'll have some flexibility whereby you can spend late days on certain
problem sets. And moreover, there's also the circumstances where life just real
ly gets in the way and just a week doesn't go so well and so ultimately toward t
he end of the semester, at the end of the semester will we drop your lowest scor
e. And again refer to the syllabus for any fine details. And where can you go? W
ell in this black box here CS50, and what's been exciting for me having been her
e years ago studying the same subject is that this chart, this flow chart whereb
y every arrow from CS50 means what course you could take right after CS50 for wh
ich 50 is the only prerequisite, you can go off in directions of more programmin
g or theory or math or graphics or networking or hardware or, with some bias, iP
hone programming this spring-- a new course that I myself will be teaching. And
so the only prereq for that too will be 50. And so this is to, testament to just
how much you can do and that the marginal return of some knowledge and some sav
vy in this world of computer science is indeed quite empowering. Now for those o
f you who might have shopped the course last year or heard from some friends wha
t's in the course, we like to introduce every year as many new and exciting thin
gs as possible and so for the first time this year will we be transitioning away
from what historically was a very server side centralized architecture where al
l CS50 students would run a program on their Mac or PC, it doesn't matter what O
S you use, you would connect to some central server where software would await y
ou there. Well more fun these days now that most everyone has particularly moder
n computers is the ability for these computers, believe it or not, to run not ju
st Mac OS or Windows as you currently are, but to run yet another operating syst
em inside of a window on your own computer. And not this old school approach of
like having to reboot your computer and then it changes operating systems. Doubl
e-click an icon and walla, you're running an operating system called Linux which
is what we'll happen to use. But it will look, the CS50 appliance in a window,
like just some other desktop. You'll have a little CS50 menu instead of a start
menu in the bottom left-hand corner. You'll be able to navigate through the very
user friendly type tools that we'll introduce you to, all of which can be found
in the real world. So nothing here is just simulated for the purposes of academ
ics in the course. You will be equipped throughout the semester with real-world
sort of de facto standard tools that you'll use in your own fields, whether comp
uter science, humanities, natural sciences, anytime you need a computer to solve
some problem. We'll also, for those more familiar, perhaps for those more comfo
rtable, introduce you to things like terminal windows and SSH and we'll introduc
e you also to graphical editors with which to write code and the odds are, this
looks completely cryptic right now, and indeed, if you're among that 77%, you mi
ght not have ever seen a program's source code, the thing that the human writes
to make the computer do something. This is one of the simplest programs a human
might write to just make the computer do something stupid, like say hello world
on the screen. But this year too, for the first time, will we always introduce f

or those familiar, what's called an IDE, an integrated development environment,


so that if at term's end you actually do want to be among those who goes off and
interns at Microsoft or Google or Facebook or in Wall Street, to actually use s
ome coding skills to apply them to some real-world problems, know that this term
more so than ever, you will be very well equipped with what's out there. Anothe
r aspect that's changing this year for the first time is office hours. For 20 so
me odd years, office hours have gotten overwhelmed, and this is back when the co
urse was smaller and when you would sign up for office hours, one on one assista
nce with the TF's and CA's by writing your name on a piece of paper that's tacke
d to the wall in the science center. Well, what we're going to do entirely is re
boot these. So if you've heard the reputation which was quite true for some year
s, that office hours are slow and you end up waiting some amount of time, we're
hoping, being computer scientists, that we can now fix this. So one, we are goin
g to exit what was once a very magical, wonderful place to spend an evening, but
move ourselves from the basement of the science center and it's fluorescent lig
hts to four ho- to dining halls on campus to coincide with brain break whereby t
his year's office hours will be Mondays and Tuesdays and Wednesdays and Thursday
s, 9 p.m. to midnight whereby we'll have not just half a dozen or so TF's and CA
's on duty at once, but 10 and 20 at a time. And we've coordinated with the mast
ers of Pfoho and Lowell and Leverett so supplement brain break so that there's p
lenty of food for you and the residents. But, we can do better than that. What w
e will also have done, thanks to one of our TF's Tommy MacWilliam, over the summ
er, is we've implemented our own version of say the Apple Genius Bar tool. For t
hose of you who might own a Mac or have been to an Apple store, you know that th
ere's this bar of geniuses that help you with your computer problems. And so rat
her now than have students working at these older work, computer terminals in th
e basement of the science center, we'll all gather more socially if you so choos
e to partake, with your laptops in the dining halls working alongside your frien
ds who are not even taking computer science who are just there for some food or
to write some p set, but to raise your hand when you need help on problem sets t
his year, you'll instead not scribble your name on the board but instead you'll
log in to cs50.net. You'll raise your hand by telling us what are you working on
and what's your question, and then you like Harry, Ron, Hermione, Gilderoy and
others here will appear on the staff screen so that we know who now has question
s, and they're ranked in order of who raised their hand first, but also they're
color-coded. And you'll find that this tool allows you to communicate to others
in the D hall what you're in fact working on. And you'll see per the course's sy
llabus on academic honesty which we'll discuss before long in weeks to come, tha
t you are allowed to collaborate and to discuss problem sets with friends so lon
g as the line of here's my code, why don't you take a look at it, is not crossed
. So more on that in the time to come but the hope here too is to make the exper
ience of taking computer science and solving problems evermore sociable so that
you actually do learn from each other and benefit in that way. Now meanwhile, mu
ch like the Apple Genius Bar has a greeter, so will we. We, we know a little som
ething about programming, or at least Tommy does, and so we've bought ourselves
an iPad and so what you'll see at CS50 office hours this year is a greeter, so t
o speak, who isn't gonna awkwardly say hello to you upon entry at office hours,
but rather when you raise your hand virtually, he or she on the CS50 staff will
see that, oh, Alice has a question and then Bob. On the right-hand side of this
same iPad app will the staff member see that Professor McGonagall and Sprout and
Flitwick and Snape are currently on duty-- the TF's and CA's who are there wait
ing to help you one on one. We will tap Alice on the left and Snape on the right
. Alice's computer screen, her own laptop will flash a message up, will play a s
ound, and will communicate to Alice that it's her time with Professor Snape. So
we thought we would completely overhaul office hours toward an end of providing
you with the most support structure possible. What about lectures? Here we are t
oday simply painting the trajectory for the semester but joining us as well, alb
eit it virtually with these cameras in the room, are not only the Harvard extens
ion students who have been enrolled in the course for some time, but for the fir
st time this year will MBA students at HBS be allowed to take CS50 as an [inaudi

ble] course for credit. So literally at this moment, we have, well in 10 seconds
the HBS students will see me waving my hand because they're seated in a lecture
hall across the river taking now CS50 albeit from afar. Similarly do we have st
udents from Belmont High, Watertown High, taking the course for the first time s
o that they too can dive into a world that their own schools might not necessari
ly offer in the same form. And similarly is this course available as what's call
ed open courseware so that the entire world can indeed tune in, use the CS50 app
liance and learn at their own pace. So what's in store for the next several week
s? Well this week in particular we will introduce some of the basics, the ideas
of programming and computer science itself. We'll focus in particular on a graph
ical language called scratch, but more on that to come. Next week will we dive i
nto a language which called C. It's the C language that I implemented that silly
little hello world program just a moment ago. And even though it really might l
ook like Greek to you now, you very quickly-- trust me-- will acclimate to this
environment. And those common mistakes you'll make initially, not quite typing t
he right commands, will very quickly become old hat. In week two will we transit
ion to more domain specific topics, not so much low level details but how do we
now use these skills to solve real-world problems? We'll talk about cryptography
and encryption, the arn- the art of scrambling information so that things like
your name and your social security number and credit cards are all entirely secu
re. The week after we'll talk more about algorithms and these things called data
structures. I actually intentionally picked an algorithm for counting students
that doesn't require a huge amount of sophistication, just requires a whole lot
of brains, a whole lot of CPU's to execute it once, but it was still pretty simp
le. But when you get to the point of implementing Facebook or Google or any tool
that's popular on your computer, you need typically to muster more intelligent
resources for it and we'll introduce you with those particular tool sets. In wee
k four will we continue this conversation and talk about things like memory mana
gement and how computers actually do what we command them to do. We'll talk in w
eek five about another domain specific area: forensics, the art of recovering or
making sure you cannot recover sensitive information on your screen whether it
is some financial information or photos or documents or anything that you do or
do not want to be recovered. In week seven will we introduce mo- yet more sophis
ticated data structures so that you're equipped to solve even more sophisticated
problems. In week eight will we transition away from C and to something more, l
et's say, modern. Something more familiar that of the web world. So by the end o
f the semester will you be able to make, certainly your own websites, but not ju
st with html and CSS, the languages with which you just make static websites. We
'll talk about PHP and SQL and Javascript so that you can actually make things m
ore dynamic. In week nine we'll continue that conversation as well as in week 10
, but it's really in the week's problem sets that you will dive in. In sections,
will be this year, particularly more hands-on. Sections are led by our team of
some 40 teaching fellows and there'll be any number of sections that won't start
until week three of the course, but more on that next week. But realize they'll
be a combination of conceptual coverage as well as hands-on activities with you
r own laptops. But the p sets themselves are what make things quite memorable. O
n Friday will we look at this graphical language called Scratch and you'll progr
am for the very first time, I bet quite intuitively, by dragging puzzle pieces,
little graphics that interlock only if it makes sense to do this and then that.
And you'll be able to make, in just two days, your own graphics and games and in
teractive art in the context of this particular CAT based world. Next week will
we, in problem set one last year did students then transition to that language c
alled C and implement the basics of programming, talking about things like loops
and functions and jargon that will very quickly become familiar. But once we ha
ve just a couple weeks under our belt can we start to play thi- with things like
cryptography. In week, problem set two last year did students have to write the
ir own cipher, an algorithm that encrypted and decrypted information so that you
might indeed send a secret message to someone across the room. In problem set t
hree last year did students implement the game of 15, this otherwise silly party
favor that you might've gotten where you move those numbers up, down, left, rig

ht within the context of a computer. And in that week in particular for our more
comfortable students, the hacker edition challenges you not to implement this i
n such a way that a human can play, but rather to implement the computer to play
itself and solve this problem no matter what the arrangement of the board is in
itially. In problem set four last year did students implement Sudoku using a gra
phics library with which you could get colors and lines and more interesting use
r interfaces. In problem set five last year did I stroll across campus and takin
g photos of people and places and things and like a doofus I accidentally format
ted my digital camera's compact flash card. But never fear, I made a forensic im
age of my camera whereby we then gave every one of those 494 students a file ins
ide of which were all of the bits, all of the 0's and 1's that composed the jpeg
s that I had taken of things on campus. We handed it out and they wrote software
with which to recover those photos. And for brownie points, once they had recov
ered those photos, they then went and recovered the people who'd been photograph
ed and we challenged students with a fabulous prize that if you photographed you
rself with each of the faculty members who happen to be in the otherwise deleted
photos you would win some fabulous prize. So we had a couple of sections compet
ing for that prize in the end. In problem set six last year we implemented a spe
ll checker, but a spell checker that was actually a bit competitive whereby if y
ou wanted, on an opt in basis you could challenge the so-called CS50 big board,
and run your code in such a way that we ran it through a whole bunch of tests an
d then reported on the course's home page how much memory you were using and how
many seconds your program took to load in 150,000 English words, to spell check
the King James bible, the Austin Powers movie script, and a whole bunch of othe
r sample inputs and what was fascinating about that particular p set that year i
s that because of this optional competitive aspect, we never had people working
so hard. Because folks would go to dinner, they'd be number two on the big board
or thereabouts, they'd come back and their roommate had been toiling away and n
ow they'd been bumped down to place 10. And so the sort of social aspect there e
nabled people, sort of incentivized people to go back to the drawing board to ou
tdo their roommates. In problem set seven last year did we have students impleme
nt CS50 finance, their own version of like an E Trade like website that's integr
ated with nearly real-time stock quote data with Yahoo Finance so that you could
buy and sell stocks and get nearly real-time stock quotes with your very own to
ol. Now we also ran a simulated stock competition where we gave all 500 students
10,000 virtual dollars to play with. I did not implement that big board all tha
t well since m- a couple of our students, who are now on staff, crafted out of t
hat 10,000 virtual dollars, I think 20 billion a week or two later. So there wer
e some holes in the system. In particular when you use something like Yahoo Fina
nce, which you're not paying for, when I say nearly real-time I mean there's lik
e a five or a 15 minute delay. Problem with that of course is that you can see t
he future by just watching TV seeing what the stock price is and you still have
15 minutes to buy the stock that's about to go up. [laughter] So there are some
real-world issues in at least our simulation there of fun. And in problem set ei
ght last year did we challenge students to implement CS50 shuttle which integrat
ed a website that students wrote with a plug-in by Google called Google Earth wh
ich allowed them to implement their own shuttle service whereby you could take,
open a web browser here, you could then go to your keyboard and start driving ar
ound campus like this, the goal being to pick up the TF's and CA's whose heads a
re looming large here in the distance, put them in your shuttle and then bring t
hem back to their particular house. So there's the Inn at Harvard. Let's see if
we can make our way to the quad here. All right [inaudible]. Take a l- right her
e, and a left here, shortcut through the grass [laughter]. All right we're on Ga
rden Street now. Registrar. And here we are, little shortcut to Pfoho [laugher]
okay. And there we are at Pforzheimer's House. And so that was a tool that our o
wn students implemented last year for the climax of those, that year's problem s
ets. So what resources exist to empower you yourself to make sure you s- can suc
ceed? Know too, in addition to sections and lectures there are these things call
ed walk-throughs, these optional sessions once a week that walk you through how
to get started on a problem set so that when you read these PDF's and stare at t

he screen and you have that very common question with any homework, my god where
do I begin? Well these walk-throughs that are videotaped and led by the staff w
ill walk you through the process of getting started. And in terms of the communi
ty that Matt hinted at before, know that very shortly you will have swipe access
to the CS50 lounge which looks a little something like this and has such amenit
ies as a Wii, and an Xbox and PS3, some foosball tables there, a candy machine a
nd for those familiar, a cat in the ceiling. So [laughter] know too that the cou
rse's website will become your window into the course and rather than just put v
ideos of lectures up there on the screen we like to do something a little differ
ent and transcribe all of the words that might come out of my mouth so that you
can search these lectures and jump around by clicking the transcripts that appea
r there on CS50 TV. But it's these images that you should keep in mind. Of the C
S50 fair and the CS50 Hackathon, the course culminates in this final project tha
t is entirely your own to devise, and when you implement your final project it w
ill then be on display to-- last year, some 2,000 students and faculty and staff
across campus. And these are the kinds of images you saw just a moment ago. Thi
s was the CS50 Hackathon which toward semester's end and about a week before the
final project is due, we as a class will be invited to drive down in the CS50 s
huttle, literally, to Microsoft's campus at NERD. N-E-R-D which is a brilliant a
cronym for New England Research and Development and spend on evening from 8 p.m.
until 7 a.m. in a space that looks a little something like this. Take away toda
y that 77% of the people around you have no prior experience and you too can acc
omplish the sorts of things that you've seen on display here so that your faces
too will look a little something like this over the next several months. But for
now, cake awaits you outside. This is CS50 and we'll see you on Friday.
[ Applause ]

Das könnte Ihnen auch gefallen