DAVID MALAN: Hi.
My name is David Malan, and this is CS50.
So I absolutely love this course.
This, for me, is my dream job, to be honest, now teaching this course,
because I took this course myself about 11,
12 years ago when I was a sophomore.
And I actually came in to Harvard not even
as a computer science major minded person, but I started off as gov.
I had exited high school thinking I liked history,
I liked constitutional law.
And so the natural progression once I got here
seemed to be to go into the gov department.
And I spent freshman fall, freshman spring,
even sophomore fall biting off a lot of the requirements for that department.
And it was really at the last minute, shopping period during sophomore fall,
that I decided, you know what, I'm actually
going to give this course a shot.
Because I've always been one of those geeky kind of kids
and I always liked playing with computers,
grew up with a Commodore 64 and an Apple 2 and a Mac and then PCs, eventually.
But computer science and computer science courses, I mean,
I actually remember looking around at some of my friends,
actually, in high school who were taking AP computer science,
and I thought they were a bunch of geeks, to be honest,
and I didn't actually even consider taking that course myself.
And freshman year when I arrived here, I still was of the certainly technically
minded sorts, but this course CS50 had this reputation,
and it had it for years of being ridiculously daunting, ridiculously
time-consuming, and overall scary.
And that-- quite honestly-- that reputation
scared me away from taking that course my freshman fall.
And this was, mind you, I was working as a UA.
And if a UA--
a user assistant-- if a user assistant was
sort of disinclined to take this course, well, I mean,
maybe there was something to that.
But finally, sophomore fall, I decided, you
know what, I'm still going to continue on this gov track,
I'm going to enroll in CS50, pass, fail, because it
was going to take the edge off the course, give me a bit of freedom.
And at the last day, literally the last moment,
I ended up going to the registrar and filling out
whatever paperwork was required to switch myself to a grade.
And I ended up switching that winter to computer science as my major.
And fast forward several years, I ended up
in graduate school in computer science, and then of all things,
I ended up, up here.
And it is really a weird role reversal now
to be up here, because it was precisely this course taught by a brilliant man,
at the time, Brian Kernighan who was visiting, and is
a pioneer in the world of computer science, that
turned me on to computer science and actually got me
into this kind of stuff.
And then it's not to say that students who take this course
all exit as computer science majors.
The computer science majors among you are by far the minority in this course,
in the single digits, maybe 10%.
Most of the students in this course are, in fact, non majors.
So why might that be?
Well, you often hear whether it's in high school or college
that this is one of those courses that teaches you how to think,
problem-solving skills.
But you know what?
There's actually something to that.
I can genuinely say, certainly as more and more years have passed
and the more comfortable I've gotten with this kind of stuff,
I absolutely approach life, dare say, a little more methodically
or algorithmically, at least in terms of what
goes on in my head when I'm thinking about some problem
or I'm trying to give someone directions, for instance.
I'm much more precise these days.
But even more than that, and the fun side
effect of courses like those in computer science,
is that this computer that all of you have, either in your laps right now
or on your desks at home, you, for the most part,
use these computers in such a way that you can only do with them what
someone else has empowered you to do.
Whether it's Apple or Microsoft or whoever
wrote some program that you're particularly a fan of.
And so when you finally, though, take a course, like in computer science, CS50
and actually learn how to program, it actually opens up
some really interesting, geeky, but dare say fun opportunities.
In fact, at the risk of living a little too long in the past,
I thought I'd pull up one thing that I'm very proud of.
And perhaps I've beaten this to--
I'm beating a dead horse for some number of years here.
But when I was an undergrad, there really--
well, there was an internet, so I can't go that far,
but there was no way of checking shuttle schedules at the time other
than that printed piece of paper.
And this was kind of a nuisance, of course,
to have to pull up a piece of paper to find out where you can go on campus.
And so at the time, students were really using
what was called fas.harvard.edu, which still exists, but most of your friends
who aren't in this room right now will never
SSH to ffs.harvard.edu, so to speak, though you all soon will.
But I wrote this program after taking 50 computer science 51, kind of on a whim.
And that program was actually not this one,
but it was this stupid program called Menu Boy.
So at the time, back in the day, there was like 495 menu,
which I don't know if it still exists.
Perhaps one of you can try this later and see who you get.
But it was this recorded voice from dining services that would tell you,
it would recite to you every morning what was on the day's menus.
And I'm like, all right, well Menu Man already
exists so I went with me Menu Boy.
And it was this Unix program that my pretty much, me, my roommate,
and my other roommate could pull up on a computer in our dorm room
and check what was on the dining hall menu.
Well, mildly useful.
That sort of evolved into what was called Weather Boy, which
did as you might expect.
That one was kind of a bust since we just
used to look outside the window and Mather Tower and that was sufficient.
So finally, I hit on, how about shuttle schedules?
The irony being, I never actually took the shuttle myself.
But long story short, I sat down with the printed shuttle schedule
and I said, all right, I'm going to do this just because I can, and invented
a program that I eventually ported to the web,
but it still looked like this in a nutshell, as you might expect.
You can, via a series of menus or shortcuts,
say, all right, I'm in Memorial Hall, I want to go to the quad after this.
Well, there we go.
If you're already sick of this course, you can go in one minute's time
and catch the shuttle out of here.
And this thing updates itself every minute.
So that's all fine and good, but not terribly sexy in 2007 and 2008.
So the next evolution of this for me was not so much the web-based version,
but was a version that actually allowed you to text message thing.
So if you want to play along at home here,
if you have a cell phone, if you dial 41-411.
And then what you have to type is a text message as follows--
S boy, for Shuttle Boy, and then the first few letters of where you are
and where you want to go.
So mem quad for instance, is what I'll type in here.
If you can actually see this here.
S Boy mem quad, it's a little small.
But if you go ahead then and hit send, if this program
I wrote last year for CS50 has not actually
broken in the past few minutes.
Let's see.
Whatever that is, we'll apparently tick the time away.
And oh, there we go.
And apparently, if you can read this, there you go.
S Boy says it's 1:21 and you can go mem hall to quad in 29 minutes at 1:50,
so we apparently just missed that last shuttle bus.
All right.
So all fine and good, but come on, we can do better than this.
And so just because I could and just because I had these skills finally
and this, perhaps, disposition, I thought, you know what?
There's so much freely available information out there now.
The shuttle buses as of last year started
having GPS transponders so that the shuttle services folks could track them
on campus.
And so I thought, you know what, I'm going
to see if I can tap into that data feed, integrate it in mash up form
with Google Maps, and late, one sad night,
was born Shuttle Boy the GPS version.
And I will be the first to admit, I still
think it's the coolest thing that those red dots move
as the shuttle buses move on campus.
Now it's not perfect.
So you'll quickly learn in this course what a bug is.
And so for instance, if I actually zoom in on this, yeah,
the shuttle is not right on Cambridge Common right now.
So it's not quite perfect, but I was at least still
kind of proud of that myself.
So beyond these kinds of fun things that come by nature with the ability
to program, I mean, you genuinely learn how to think
and how to approach problems differently.
Because a lot of what computer science is, it's not actually programming,
even though I've taught entire courses in the past
and we've surveyed students at the end of the semester,
what did you get out of this course, what did you learn?
And many of them in many courses have been--
I learned how to program in C, I learned how to program in Java,
and that's fine, and that's true, and that's valuable,
and that's interesting, but it's not necessarily everything.
Because one of the more interesting aspects of a course like this
is that in teaching you how to think differently,
it opens you to the possibilities of solving problems more effectively,
solving problems more efficiently, saving yourself time
by actually writing software or making hardware
that does things that would take a human much more time to solve on their own.
So case in point, I thought maybe we could humor ourselves as follows.
So a natural thing at the start of a semester
is you've got to take attendance or you've got to take roll.
So you start counting in the top right.
One, two, three, four, five.
All right, so we'll be here all day using this method.
So what's a marginally better improvement on that?
How could I count students in this room more quickly?
Take a picture and do it later, sure.
What else you got?
What's that?
So count them at the door.
In retrospect, that too would have been better.
What else?
Something simple.
Yeah?
What's that?
Oh, have everyone text a number and let my computer count.
All right, so that's even more sophisticated.
I'm going to go with what I learned in grade school
and just count people two at once.
So two, four, six, eight.
Don't try too hard.
I know, first day at Harvard here, but we don't need to go too far here.
And incidentally, let's get this part out of the way.
So this is a ridiculously large, if not intimidating room,
and we have microphones set up down there.
I'd much prefer if we can try to turn this course into something that
is a bit chatty, that is a bit informal, because I can't even
imagine the idea, of as a student, and even now as an adult,
walking up to a microphone to admit to hundreds of people,
so I'm kind of confused, I don't really know what you just said.
I don't see these kinds of microphones working too well.
You're welcome to use them, but let's see if we
can do this a little more intimately.
So my conclusion was I'm going to count people in two's.
So two, four, six, eight.
All right, so that's clearly better, because it's twice as fast.
But if we think a little harder about this problem of counting students,
can we do even better than that?
I mean, wouldn't it be a really cool thing
if instead of just doubling the speed with which
we can count students, or equivalently, halving the amount of time
it takes to do so.
What if our algorithm, our approach, our method, not only started off faster,
but as I went, it got faster and faster and faster?
I mean, it'd be kind of neat if I could start counting in twos, then
very quickly get comfortable with that start counting
in fours, then maybe eights, then maybe sixteens,
and eventually gets a little confusing.
But if you could build up momentum like this, bam,
we would be done counting students pretty darn fast.
So in fact, I can't quite do that on my own fingers.
So what I did was went ahead and put together an algorithm on paper here.
Because there's this other opportunity in this room to solve this problem.
We have not just me as the single brain or CPU in this room capable
of independent thought, but we have a couple hundred of you here
who can presumably be helping me out with this.
And so allow me to ask two things.
First-- this is also a very impersonal room,
you probably don't know all of the people around you.
So take a moment, right now, if you could,
turn to the person on your left, to the right, say hello,
house, concentration, all that stuff, and make a friend.
[INTERPOSING VOICES]
DAVID MALAN: All right.
All right.
OK.
Yes, they're very interesting next to you.
OK, now back here.
All right.
So you now have a friend, first of all, in computer science 50.
Now it's going to get a little more awkward, again,
for just a moment, because I need you all to humor me for a moment
and please stand up.
Step one, stand up if you would.
So there are more of you than there are of me.
You are all capable of counting, presumably, therefore
you are capable of executing this computer program.
It's pretty straightforward.
It's only got five or so steps here.
Four, if whoever standing in back doesn't move over to the side.
Step one is stand up.
Step two, think to yourself, I am the number one.
It's probably not a stretch for some of you.
All right.
Step three, go ahead and pair up with someone standing near you,
add your numbers together, take that sum as your new number.
A little sanity check.
If you're following along correctly, everybody's now the number two.
One of you should go ahead and sit down.
And repeat per these directions.
If you're standing awkwardly, look for someone you can pair up with.
Should be just a couple of people standing.
A couple people left.
Almost there.
What did you get?
All right.
There should be just one awkward person standing before long.
All right.
These guys are using paper and pencil, that is not very Harvard.
That's OK.
Just kidding.
I'd be doing it, too.
What do we got?
One here, one here.
We need a couple of people to pair off.
One here.
Three.
There's three of you.
All right, combine two numbers.
72.
Oh, OK.
And?
113.
So what's that?
Oh, and 119.
So what do we got?
What's the total.
I'm not going to embarrass myself in doing it up here.
What's our total?
What's the total?
What's that?
So the total comes to-- thanks to our diligent teaching staff--
399.
So close to 400.
And that probably took less time than it would--
oh.
[APPLAUSE]
400 it is.
So what can we take away from that?
Well, how many steps did that take?
Well, granted, each of these steps is like one big step.
It's kind of like one iteration.
You went through the process of finding someone, pairing up, taking on the sum
and then sitting down.
So if we group that together, conceptually, it's just one step.
Let's ask ourselves, how many such steps were there?
Well, maybe we can answer this by building from the ground up.
This is Excel, I'm just going to use it to do
some simple graphing for a moment.
So if there's two of you, it really only would
have taken one such step, one such loop or iteration,
because the two people pair up, one sits down, done, so one step.
If instead, though, there were, say, four of you,
well, that too would still only take not four steps, but just
two steps, because four people would pair, the two pairs would pair, done.
So just a couple steps there.
So if this number then increases-- so I'm
going to do a little formula just to save myself some time here.
If this pattern increases or continues along these lines--
whoops-- what just happened?
If this pattern continues along these lines where this is A three times two,
all right.
Let's copy that.
Paste there.
There we go.
So if that pattern continues, but in the right hand column,
this just takes us one step, this takes us two steps,
this takes us three steps.
So this takes us, A three plus one and B three plus one,
that pattern continues as follows.
So in the left hand column we've got how many students there are, potentially,
the right hand column, the total number of steps.
And this is kind of powerful.
I mean, look at what it's saying.
If we've got roughly 400 students, so somewhere
between 256 and 512 students, that only took--
felt like longer-- but eight steps, eight such iterations, maybe nine.
Well, let's take a look at what this actually feels like in the long run.
If I just quickly grab these numbers-- and this is not the kind of stuff
we'll be doing in this course, using things like word and Excel,
but it's useful just to illustrate this for a moment.
I'm going to produce one of these little plots, new sheet,
just to show you what this looks like.
And what we have on the x-axis here is number of students,
on the y-axis, the total number of loops or iterations.
Notice what happens.
Like, it kind of takes a long time for--
relatively speaking-- for small groups of students.
But look at what happens in the long run.
It feels like this algorithm, this approach, this divide
and conquer strategy seems to gain speed.
The bigger the problem gets, the more effective the algorithm becomes.
If we're out at say four billion students--
that's a big room-- so four billion students.
How many steps does it take to actually implement this algorithm?
32.
There's only 32 such steps to count four billion students, logistical issues
aside.
Well, let's see if we can't make this a little more concrete.
I don't really like to reuse material, but this one
seemed to be a popular one last year.
This is a pretty big phone book, right?
It's a few thousand pages.
And this lends itself to this same thinking, the same divide
and conquer approach.
Suppose that I wanted to look up Drew Foust-- so
[INAUDIBLE] Foust in this phone book.
Granted, it's the yellow pages, just she's probably not there.
But we'll pretend it's the White pages.
How would you, as a fairly intelligent human being,
go about finding someone like Drew Faust in the book here?
Yes?
What's that?
Oh, page one.
We're definitely going with the semi approach.
So page one, we have the A's.
Page two, still the A's.
Page three, and dot, dot, dot.
So right, the worst case scenario there, whoever I'm looking for
might actually be at the end of the phone book, certainly not on page one,
and that's going to take a good number of steps.
Probably a slightly more clever person is going to do what?
Right, you're going to probably start in the middle,
if only because it's easy to open a phone book to the middle.
You're going to glance, it and be like, oh, M happened
to be in the middle of the phone book.
Well, what am I going to do next?
Well, I already know that this was a pretty big problem a moment ago.
But I already know that Drew is going to be to the left.
I'm at the M's, which means she's not going to be over here.
And this is why everyone liked this last year.
So we can literally throw away half of the problem.
And now it's half as big.
Well, what do we do next?
Well, we can resort to that page flipping approach, or we can repeat,
we can recurse and do the same thing again.
Smack dab into the middle here, I happened to end up at--
freebee-- we happen to end up in the middle here, this is the Cs.
So yet again, I can literally take a bite out
of this problem equal to half of its current size, throw it away.
And in just two steps, we've halved and then halved--
which mean quartered the size of this problem.
So now extrapolate to some of the data here.
If that phone book were actually ridiculously
large with four billion entries, four billion pages,
how many times am I going to split and throw half of the phone book away?
Only 32 times.
What if there are not four billion, but eight billion people in that phone
book?
Eight billion pages.
Well, 33 steps.
And that's a really powerful thing.
And that just hints at the types of design problems
that come up in computer science and the types of work that ultimately come out,
as we'll see, the course's problem sets.
Now it's not all serious and focused on clever approaches.
So we have made a conscious decision this semester
to introduce as much geek culture to Harvard as possible.
[APPLAUSE]
Josiah Quincy and James Otis would be so pleased to be next to this right now.
So it all began, of course, 10 years ago when Shuttle Boy entered the Harvard
lexicon.
Now we're going to try to push some lolcats onto the community here.
I'll refer you to Wikipedia for more of a backdrop here.
But just in the spirit of this same, you know
what, I'm going to do something just because it's neat, just because it's
fun, just because I can.
And along the way, I'm sure I'll encounter some interesting problems.
I, in a moment, or in an hour of severe procrastination last night,
decided what our website needs in the course is a lolcat of the day.
So this didn't exist last year and this didn't exist on Saturday.
But I decided, who's not going to click on the lolcat?
And I will argue, I will put forth, that I bet a non-trivial number of you
make a habit, every time you start pulling up the course's website,
you're going to click on that link, even though it really does nothing other
than show you, right?
So stupid.
But how did I do this?
Well, I asked a friend of mine, all right, where can I get lolcats?
Well, it turns out that one of these sources, the canonical source,
is icanhascheezburger.com.
So that led me to this website here, which, if you really have a lot of time
to kill, you can search through-- let's see
if we go to the bottom, the 90 to infinity
and beyond pages that have been posted here over time.
But what I noticed, what caught my eye at the top of this page
is this little thing here.
So subscribe to an RSS feed.
Now this is something some of you might already use, some of you
might have at least seen this icon, even on cnn.com, New York Times,
reputable sites, it's not all geekery.
And long story short, what an RSS feed is just a big text
file, an XML file, similar in spirit to HTML,
which is something we'll use later in the course to make web pages.
And inside this big text file, it's just a lot of links.
Links to the current lolcat of the day, links to yesterday's lolcat
and so forth.
And I realized, you know what, if there's
this feed that the website itself lets people subscribe to,
well, maybe I can write a little program that just downloads that feed
downloads, simulating a user clicking that link,
analyzes all of that text looking for URLs, things like http, colon,
slash, slash, grab that image and then embed it
into our own website, along with a couple of more links,
so it then links back to the original page.
And long story short, that's all it took, was an idea and--
make it really juicy--
an idea and the means to actually implement it.
And thus was born lolcat of the day.
So more of those on an increasingly frequent basis.
So who is in this class?
So there has been, for years, a misconception, for instance,
that the course is filled only with those more comfortable, so to speak.
We adopted these euphemistic labels last year
to refer to those students who were, quite matter
of factly, less comfortable in a course like this with computers,
with the internet, with the idea of even being in a computer science course.
Then we labeled the opposite, which were those more comfortable.
Students, like many among you, who've taken AP computer science, who,
like me, grew up with computers and have been raring to go
with an actual computer science degree.
And then there's many of you who are somewhere in between.
And being computer scientists, we like to collect data, analyze data,
and then actually bolster our conjectures with actual numbers.
And here you go.
So as of last fall, 2007, the percentages of students in the course
roughly broke down as follows.
30%, certainly non-negligible, describe themselves as less comfortable,
the sort who during shopping period were not coming back Wednesday.
But fortunately, 30% of them did.
I'm among those more comfortable, 20%.
So also non-trivial, but certainly not even close to a majority
of the students in the class, because the majority really is made up of about
half--
a majority of the class is made up of people who are somewhere in between.
Certainly not the least comfortable, certainly not the savviest,
but they're somewhere in between the two,
and we suspect that those numbers would play out the same.
So those of you who are feeling a little less comfortable,
I thought I'd try to put you at ease, even before we
dive into things more sophisticated.
This, of course, if you know, is Senator Ted Stevens
of Alaska, who had the misfortune of being
lampooned by Jon Stewart and the likes.
A couple of years ago when he was quoted during a very, very boisterous speech
about things related to the internet.
So what I thought we'd do is sort of establish a baseline
as to what it means to really be less comfortable, because I think that will
perhaps put a few of you at ease.
So let me grab this.
It's about a three-minute clip.
Let's go ahead and pull up the following.
[VIDEO PLAYBACK]
- Oh, we got a bombshell for you tonight.
Oh, I am delighted, here.
Today's show is a good one.
Shawn Wayans, Shawn Wayans will be joining us.
We're very excited about that.
But I want to talk to you about this exciting thing I have discovered.
I want to talk to you tonight about the internet.
I'm going out on a limb here.
I'm going to stand up and be one of the first guys to say,
I think this is a keeper.
I think this thing is here to say.
Right now, two key internet related issues
are making the rounds in Washington DC.
One involves the Net Neutrality Act, which
would allow larger, more powerful corporations higher speed
access to customers, establishing a two tiered hierarchy amongst--
you know what, it's awfully complicated.
Why don't I let an expert, say the head of the Senate Commerce Committee, which
regulates e-commerce, explain.
- The internet is not something that you just dump something on.
It's not a big truck.
It's a series of tubes.
[APPLAUSE]
- All right, that might have sounded more like something you'd hear from,
let's say, a crazy old man in an airport bar at 3:00 AM.
Then the chairman of the Senate Commerce Committee.
I'm sorry, sir, I don't quite think I understand your dump truck tube
symposium.
Do you have something a little more practical for me?
- And if don't understand those tubes can be filled,
and if they're filled, when you put your message in, it gets in line,
it's going to be delayed by anyone who puts in that tube
enormous amounts of material, enormous amounts of material.
- And there you have it, folks.
There's apparently-- there's apparently an enormous amount of material clogging
Ted Stevens tubes.
Perhaps a little fiber optic cable might be the answer.
Stevens ended his lecture by offering a concrete example
of the problem we face.
- Ten movies streaming across the internet, and what
happens to your own personal internet?
I-- just the other day got internet was set by my staff at 10 o'clock
in morning on Friday, I got it yesterday.
Why?
- I'll tell you why, because the creek run dry is what happened.
And there's Comanches in the [INAUDIBLE]..
And the women of the internet.
Actually, why didn't Senator Stevens get it until yesterday?
Well, this is just a little bit of a guess here,
but maybe it's because you don't seem to know jack
about computers or the internet.
That's OK, that's OK.
You're just the guy in charge of regulating it.
[END PLAYBACK]
DAVID MALAN: So the segue there is if you
are feeling that you don't know jack about computers and the internet,
there's clearly people out there who know just a little bit less.
And we make this promise now that we will not publicly lambast you
as John did to Ted Stevens there.
In fact, where are people really coming from who take this course?
So almost half of the students who took this course last year
had no prior programming experience, 43%.
About the same number had a little experience,
whether it was a programming class or having tinkered or not.
And then there was only 10% of the class who had, quote unquote, a lot.
Who maybe took not only AP computer science,
but maybe taught AP computer science, or simply was certainly among even those
I sort of made fun of back in high school.
This, though, there's one other data point
we'd like to share as well, so gender.
So these were the numbers--
well, it's funny.
So these were the numbers last year, and I would actually
put forth that these are actually higher than they have been in years past.
And long story short, I don't know why there's this discrepancy, because it's
certainly not something that has just arisen,
but it's sort of been with computer science departments for some time.
We chatted with former female students in the course, some of the teaching
fellows, and there's certainly perhaps some societal trends at play here.
I think it's probably fair to say that it's not the case that guys
are better at computer science, we've heard arguments
like that put forth before.
So I don't know, but I can say that we, as a course,
will at least try to do our part to at least take a bigger bite out
of the larger slice there to see if we can't
try to equalize these numbers somewhat.
So whether you're male or female, know, incidentally,
that this Monday, today, and this afternoon, this Wednesday
and Thursday, we're going to be having some of these very casual, should I,
sessions.
So if you ultimately exit this course later this afternoon thinking,
I'm still not sure if this is for me, I'm still not
sure if I can fit this in, or really whatever your questions
are concerns are, the teaching fellows will be holding some casual Q&A
sessions at these particular times.
And you can, of course, if you're feeling a little uncomfortable even
beyond those, you can send me an internet
and we can talk more one-on-one.
So let's see if we can't now begin to level the playing field, just
a little bit.
Even if you don't know jack about computers and the internet,
you probably at least heard that the basic building blocks that run them are
bits, are the binary system, are zeros and one's.
So what does this mean and who cares?
Why is this useful?
Well, the easiest way to think about these basic building
blocks of computers is like little light bulbs or little state
machines that can either be on or off.
Here, for instance, is an off light bulb, back in the day,
when it was easier to turn the room's lights off
we would just turn the lights off and say zero, turn the lights on and say
one.
Doesn't really work well in this particular room,
so assume that this is our light bulb representing zero,
this is a light bulb that's on, representing a one.
Zero, one, off, on.
So if you now have this ability to distinguish
between two states, so to speak, the something that's on,
something that's off, which certainly you can implement clearly
with electricity, just by using something as simple
as a light bulb or tinier like a transistor or a capacitor,
if you're familiar with such terms, you can actually
use these as basic building blocks.
So how can you actually use just zeros and ones
to do everything that that computer is capable of, whether it's
sending instant messages, whether it's sending emails,
whether it's browsing the web.
Everything inside of this machine, this machine, the cell phones in your pocket
these days boil down to zeros and ones.
Well, how can you possibly represent such arbitrary information
using such simple bits of information?
Well, think back for a moment, if you will, to grade school.
So this number here 123 in the so-called decimal system.
Pretty straightforward.
All right, so why does that represent the number 123?
Well, if I recall, I was taught that this is what's called the ones column,
this is the tens column, and this is the one hundreds column.
Pretty straightforward.
Why is this the number we know as 123?
Well, that's because we have three ones, so three times one, plus two tens.
So that's plus two times 10, that's 23, plus one hundred, So one times 100.
And OK, didn't really get very far with that, but that gives me
what I know to be the number one.
But there was actually a process there.
Each of these digits, so to speak, from zero through nine
took on different significance based on the column that they were in.
Well, binary, the system the computers use, is really the same thing.
So up here, I've pre-populated the slide with different placeholders,
different column values, because in the world of computers
and the world of binary, where your only digits are not zero through nine
but just zero through one, is you just treat the columns a little differently.
So the right one is still the ones column,
but the next one over is not the tens column but the twos column.
To the left of that the fours, the eights, the sixteens.
So the pattern fundamentally is the same.
These seem to be powers of 10.
10 to the zero, 10 to the one, 10 to the two.
Here we have two to the zero, two to the one, two to the two, and so forth.
But that's all.
Everything boils down to the same system.
So for instance, if we have eight bits or eight light bulbs arranged in a row,
just because it's useful to think of bits as being in a clump
so that we can count higher than one, this set of eight off light bulbs
obviously represents the number zero.
Not all that hard.
This row here, instead, with the right most one on,
that bit is a one, because the light bulb is on.
Well, that thing just represents-- all right
we've got a one in the one column, so that's one times one is one.
But what about the next row?
Well, this represents two, because one of the bits is turned on,
is flipped, so to speak, to be a one in the twos column.
This is going to be three.
And then what's the pattern here?
If there were another row, how do I get to four?
Well, you flip one more up, you carry the one, so to speak,
and then the other two guys become off.
All right, well what about a little exercise here?
So this is what the same thing-- just replacing the light bulbs
with explicit zeros and ones.
How about this.
So you are in what zip code right now, freshman?
02138.
So on a piece of scrap paper, in your head, or not at all, what would--
how would we go about encoding 02138 in this particular example?
All zeros, I heard, excellent.
What about the next one?
OK, so I'll give you 10 seconds of an at home exercise.
And if you're finding this a little too easy, skip ahead to, oh, the eight,
do the last one.
So you're going to be putting on each of these dashed lines, in your head
or on a piece of paper, the value of zero or one.
02138.
All right, not so hard.
OK, so that's it.
02138.
Now realize, we're talking about bits for the most part here.
You're more used, probably, to talking about bytes and kilobytes and megabytes
and gigabytes and now terabytes.
Well, a byte is just eight bits.
And a kilobyte is just 1,000 bytes and so forth,
and we'll revisit these kinds of numbers,
particularly later in the semester when we start talking about data and such.
Now I thought I'd give you a little comic strip that
was actually printed in a newspaper.
If you chuckle at this, you belong in CS50.
So now you understand a little bit.
Wow, this did not go over funny at all this year.
Everyone last year thought this was hilarious.
If you're not quite sure what it means, maybe you
should ask the person more comfortable to your right or left.
So who cares about zeros and ones?
Who cares about the fact that we can represent numbers greater than one
using multiple zeros and ones?
Well, this is intentionally scary.
This is what's called the ASCII table.
So way back when, some people decided, you know what?
So that computers are useful and not just calculators,
but can actually display alphabetic information, symbolic information
and the like, why don't we use longer sequences of zeros and ones,
like entire bytes, for instance, and map them to say, letters of the alphabet.
So if you look down the middle column or the third column here,
you'll see this is the decimal column.
You can pretty much ignore most of the other columns here.
But notice that the decimal number 65, some years ago, was semi-arbitrarily
decided to henceforth represent capital A. Which is to say,
if a computer ever encounters on its hard drive
or in RAM a sequence of eight bits that, when
you do all the math with the placeholders and whatnot,
gives you the number 65, what that means is the computer should display not
the value 65 in that context, but the letter A. And thus
was born the concept of word processing and the ability
to actually communicate in English and other languages.
If we fast forward to 97, that was decided to represent lowercase A.
And you'll certainly-- no computer scientists
would memorize say, this entire chart, but turns out with just those two,
you can kind of bootstrap yourself and figure out many of the other ones.
But fortunately, computers generally do that for us.
Well, if you have the ability to count in binary, represent larger numbers,
in turn, represent letters of the alphabet, well,
how do you actually store these things?
Because certainly, our computers don't have millions of light bulbs, per se.
So what I thought I would do is take a video here,
which is a little cheesy with its voiceover,
but nonetheless, gives an interesting view inside of a hard drive.
[VIDEO PLAYBACK]
- The hard drive is where your PC stores most of its permanent data.
To do that, the data travels from RAM along
with software signals that tell the hard drive how to store that data.
The hard drive circuits translate those signals into voltage fluctuations.
These, in turn, control the hard drives moving parts.
Some of the few moving parts left in the modern computer.
Some of the signals control a motor which spins metal coded platters.
Their data is actually stored on these platters.
Other signals move the read write heads, to read or write data on the platters.
This machinery is so precise that a human hair couldn't even
pass between the heads and spinning platters.
Yet, it all works at terrific speeds.
[END PLAYBACK]
DAVID MALAN: And part two of that goes a little bit deeper.
[VIDEO PLAYBACK]
- Let's look at what we just saw in slow motion.
When a brief pulse of electricity is sent to the read/write head,
it flips on a tiny electromagnet for a fraction of a second.
The magnet creates a field which changes the polarity
of a tiny, tiny portion of the metal particles
which coat each platter surface.
A pattern series of these tiny charged up areas on the disk
represents a single bit of data in the binary number system used by computers.
Now, if the current is sent one way through the read/write head,
the area's polarized in one direction.
If the current is sent in the opposite direction,
the polarization is reversed.
How do you get data off the hard disk?
Just reverse the process.
So it's the particles on the disk that get the current
in the read/write head moving.
Put together millions of this magnetized segments, and you've got a file.
Now the pieces of a single file may be scattered all over drive's platters,
kind of like the mess of papers on your desk.
So a special extra file keeps track of where everything is.
Don't you wish you had something like that?
[END PLAYBACK]
DAVID MALAN: It's so educational up until that last part.
I did come prepared, incidentally.
If you were a little unnerved by all this talk
of low-level magnetic particles, I did bring this.
I don't think we really need it though.
[VIDEO PLAYBACK]
- This is the on/off switch.
[END PLAYBACK]
DAVID MALAN: So what's the takeaway there?
Well, inside of hard drives, there are these metal platters.
On those metal platters are magnetic particles,
and those particles, essentially, can be arranged say North,
South, representing a one, or South, North, representing a zero.
And out of those basic physical building blocks
can you begin to represent those logical entities, those conceptual entities
like zeros and ones and bits.
So enough on that for now.
What is CS50?
The course catalog description kind of scares with a bit of terms.
What does this actually mean?
Well, the course's expectations are to attend all lectures and sections,
complete nine problem sets, take two quizzes, and produce the final project.
There is no final exam in this course.
How are grades computed?
Most of the grade in this course is weighted toward the problem sets,
because that is by far where you will spend most of your time.
We are all quite familiar with the idea of either bombing a problem set or just
being a bad week or something to that effect.
So know that you will be able to drop your lowest
score on one of these problem sets at the end of the semester
when your grade is computed.
The quizzes and the final project are weighted as follows,
and you may take this course pass, fail.
Look to the courses FAQ section in the syllabus
for a little discussion on this.
Realize that this is--
the TFs can confirm or deny this more one-on-one,
this course is not so much hard, I think, as it is time consuming.
And that was the case when I took the course,
and I do think that's the case these days,
but more on that in just a little bit.
The course's website is at cs50.net.
More on that as time passes, since there's
a particularly interesting architecture as you'll
see underlying that this year.
Cloud computing will be the buzz word there.
What about books?
So there are no required books for this course.
You will get plenty of information, we assure you, from lectures,
sections, the internet, and so forth.
However, if you are the type of student who
likes the comfort of a book, who needs to have a book in order to take
a class, we do recommend a few books.
And we recommend them along two different tracks, so to speak.
So those of you who are a little uncomfortable or very uncomfortable
with the mere idea that you're in this core shopping it today,
if you decide to take it and want to start
the course with a bit of hand-holding and textual form,
know that this is the book that we recommend.
There is no shame in buying a book called The Absolute Beginner's
Guide to C, just realize that this book is not really a reference book.
You'll chew it up, learn it, and then that
will be it for that particular book.
But it's very good for gaining a bit of comfort early on.
For those more comfortable, so to speak, this
is the sort of book that risks putting you
to sleep if you try to read it from cover to cover,
but it's a wonderful reference.
And it's not really the type of book that you
would curl up in bed with and read from cover to cover, but rather,
turn to the chapter, turn to the index for whatever topic
is of particular interest to you there.
Do you realize that free, if not superior resources do
exist on the interwebs, and we link to those on the course's website
under Resources.
For everyone, we recommend this book.
This is a wonderfully fun book that goes more into depth
on things like those videos we just showed.
How does a hard drive work, how does an iPhone work, and things
like this, which are rather tangential to the ultimate goals of the course,
but are nonetheless interesting and certainly
help take the fear factor, or at least the unfamiliarity,
around some of the toys that we ourselves carry every day.
And for that 10% or even fewer of you who
were the true hacker-minded types in this course who
care about shaving milliseconds off of the running time of your code,
know that this is actually a really valuable reference book.
And for those types, frankly, a good curl up in bed
cover to cover kind of read.
I use this myself in grad school to optimize some research
code that I wrote, and it's a wonderfully valuable, geeky type book
to have.
So those are at the Coop, but don't tell them I said this,
you'll find them much cheaper online, at say amazon.com, which
is where the course website links.
So Coops not here, though we are, of course, on two cameras here.
So speaking of cameras.
So this course will take place here.
It is, however, filmed for students who either can't make a class
or who want to review some class.
Know that in addition to the courses lectures and these videos,
one of the teaching fellows will also take scribe notes during each lecture
and then those will be posted online within a few days, too, not only
as a valuable reference when it comes time for quizzes
or if you want to fast forward to certain parts
or maybe slow down certain parts during which I was confusing,
or fast forward through certain parts--
--take place on Mondays and Wednesdays, no lectures on Fridays.
But what we thought we'd do during--
--suggested in some Q-guide like forms that we
have tea with David once a week.
I don't really do tea, but I'll do lunch.
So what we thought we would do-- and we'll see if anyone comes--
is at least I would plant myself in one of the dining halls or the faculty club
or somewhere on campus on Fridays, during what would otherwise
be class time, to just do sort of casual office hours, grab a bite,
and see if we can't get a few people to come spend lunch time with me,
just so we know who to expect so that we can plan accordingly.
If you ever do take us up on such an offer,
email that address there just so we know who to expect.
It's not so much that we think we're going to be overloaded with requests
of people wanting to eat lunch with me.
So what about this thing?
So we are very technically minded people here.
And so last year, we started podcasting the course.
And what that means is these videos are available online
in QuickTime format, MP3 format, as well as in Flash format.
If you are particularly inclined, you can pull up, God forbid, me, on your--
is that good?
I still get a kick out of that.
But I don't know who would want to watch a computer science
course on an iPod or an iPhone, or at least admit to it.
I, frankly, if you can see, actually, lest
you think that I am completely out there.
So that's what I have on mine, here.
Besides that one video of me.
But know that that is possible.
More interesting than that, though, perhaps is
the fact that one, CS50 for the first time this year
will also be offered through Harvard's Extension School
to students who want to enroll, partake in the course remotely,
via the internet, wherever they are in the world,
and receive credit through the Extension School.
Because the course is podcasted, we also had
random people on the interwebs tuning into the course.
And we're going to take things one step further this year,
really in an effort to give something back, so to speak, to those out there.
In addition to the course being filmed and all of the handouts
and all of the problems that's being made available online,
we're going to try to take things one step further this year
and use technology to further package up a course like this and its content
for really, anyone who wants to turn in and bootstrap themselves out there,
who might not have the fortune, frankly, of sitting down in a room like this.
And we will make use of things called virtual machines, whereby long story
short, more on this later in the semester,
we will create images of computers that people-- anyone out there--
can download onto their own Macs, PCs, Linux boxes, double click an icon.
And what they will get inside of their own Macintosh or inside of their own PC
is a window inside of which is our own copy of, say Windows or Linux
or whatever operating system we decide to deploy so that they really
have their own sandbox environment with which to engage in the class.
And we will also make such images available to students
in the course, who, even though we provide cs50.net
as a course-wide computing structure.
If you are particularly geeky and so inclined,
you'll be able to really test out these fairly nascent technologies
on your own systems as well and administer your own Linux machine,
for instance, within your own Mac or PC.
So what about sections?
So sections and the course's teaching fellows
are an integral part of the core sections,
will supplement the courses lectures and dive into more depth
on problem sets and material.
For the first time this year, we're going
to borrow an idea from [INAUDIBLE],, which
is another class that meets in here, and that's about music,
and it too has a range of students' backgrounds.
The A sections, the B sections, and the C sections.
When I took that course years ago, I was in A or C,
whatever the people who don't know much about music were in.
We're going to borrow that same idea, and we're not going to use A, B, and C,
but describe them as sections for those more, those less comfortable,
and those somewhere in between.
And we'll take care of sectioning this Wednesday
or thereafter, more on that as time comes.
The goal for these multiple tracks is one,
we can handle it now, given that the course is sufficiently large.
And two, it's to provide not only the more comfortable people with a forum,
an environment where they can really ask those questions that might scare
the hell out of the less comfortable students sometime, or at least
annoy the less comfortable, even students somewhere in between,
but can further stimulate themselves by being
in a room full of other people who really
want to get their hands dirty with some technical minutia,
led by a teaching fellow who's just as, if not more
comfortable with that kind of stuff.
And on the other hand, we'll have other sections
that cater also to the comfort levels of students
who just don't have that background or that level of comfort
with that material.
So more on that later this week.
So the course's staff.
So this course's staff is perhaps bigger than the average class size at Harvard.
So we have over 50 people involved in the day-to-day operation
of this course.
Some of them are sitting here today who aren't shopping their own classes--
can the courses teaching fellows who are here stand up for a moment?
We're mostly grouped here.
Oh, wow.
[APPLAUSE]
So these are just a few of the faces that you will never forget.
[INAUDIBLE],, in 1996, was my teaching fellow, thank you guys.
And I have never forgot the day that sitting in the back right hand
corner of Elliott Dining Hall, he was taking time out of his day
to deal with me, who still didn't get these things called pointers.
But that was the day where things finally clicked for me.
And this is absolutely the course that long after lectures
are over and long after, daresay, you've graduated from Harvard,
will you remember your teaching fellow in this, and perhaps
a few other, courses as well.
[INAUDIBLE] is the course's head teaching fellow
and will be helping with the administration of the course,
a lot of the sectioning details.
And so she is a face that--
[APPLAUSE]
Many of you, I'm sure, will become well familiar with,
over time-- do know that in addition to myself and the other teaching fellows
and course assistants and anyone involved in the courses production,
know that you can turn to any of us, in particularly, [INAUDIBLE]
for questions you have, for concerns that you have,
particularly even this first week.
I think she'll be the first to admit that she was certainly, at one point,
among those of you less comfortable.
And so if you're feeling a bit of apprehension along those lines,
by all means, strike up a conversation with any of us.
So what else exists in the way of support?
This is perhaps the most beautiful you will ever see the Science Center.
So if you look at this photo online, the skies are bluer than they've ever been,
the grass is greener.
And you will spend time in the basement of this building for this course, where
we have dozens of computers that students
log into for one-on-one assistance with the courses problem sets
in the form of office hours.
More on that once we get to problem set one, really.
But we also introduced last year virtual office hours, whereby
you can log into the course's website, pull up
some platform independent Java-based software called Illuminate.
Log into what's really a glorified chat room, but one in which
you can click an icon to raise your hand, so to speak.
A little icon will flash on the teaching fellows screen.
And we can then, not only chat with you via this instant messaging
window on the bottom left corner, but also see what's on your screen,
and even, if you let us, take control of your screen
and help you troubleshoot whatever bug is hanging you up at that time,
whether you are at brain break in your dorm room or even off campus.
So we'll be using those as well.
So what do we expect in return?
So this is the course's workload.
This is the kind of course that you learn--
it's the sort of material that you learn only by doing.
In the course's lectures, I try to present
a mental framework for the week, introduce
concepts that give you a sense of what the course's content is about.
In sections, we'll elaborate on that, go into additional examples and details.
But it's truly in the course's problem sets
where you will take the most away from this course.
And even though, to some of you, particularly freshmen, might think,
my god, five to 10 hours per week on a class?
There are other extremes.
So computer science 161 years ago, when I was a senior,
I took, it was like 40 hours a week.
Now that's not representative of all of the computer science courses here,
but it at least makes this look like a walk in the park.
But the upside is-- and you can look to the courses syllabus and website
and even to past teaching--
current and past teaching fellows and students,
we like to think they're a lot of fun.
We'll give you a quick survey of them today.
But this is absolutely the type of the course where
if you do loan us some portion of your life for the semester,
we're pretty comfortable promising that you will not only get it back,
eventually, but also a lot more.
So more on that as time proceeds.
What, then, will we be doing in this course?
Well, in the first week and including today,
we'll bite off some of the basics.
And the course will start in a fairly friendly way.
Oh, this is an example of this interwebs technology.
Hi world is what we'll use this year instead of hello world--
more on that to come.
What we'll use in the course's first week,
namely Wednesday, is introducing programming itself,
by a way of a really interesting programming
environment that was developed a couple of years ago by MIT'S Media Lab.
So we will very quickly next week dive into the C programming language, where
we will spend much of the semester.
But just to set the stage, I thought I'd pull up this programming environment,
which literally allows you to program things
by dragging and dropping puzzle pieces that lock together,
if that makes logical sense.
This is not what programming, ultimately, tends to be about,
because clearly, this is not the most sophisticated program
that one might make.
But what it allows us-- what it allows you to do in the course's first week,
frankly, is one, hopefully have a bit of fun with actual programming,
albeit in a playful context.
But two, also give you a sense, frankly, of gratification.
It's very hard to impress people by typing a command at a blinking cursor
and then getting back some hello world kind of response.
Much more interesting is, for instance, something like this.
[VIDEO PLAYBACK]
[MUSIC PLAYING]
[END PLAYBACK]
OK, much more interesting for some definition of much more interesting.
That's all it does.
I will say, the music and the flashing lights,
frankly, if you watch it late at night, gets kind of trippy.
So you might want to pull that one up.
Let me pull up one that wasn't made by a student who then distributed
the software with Scratch, but rather, pull up this, which one of our courses
teaching fellows, now CAs, Andrew Berry, one
of Harvard's football stars, actually, made during our staff training
last year.
I love all of the teaching fellows, equally, of course,
but this is kind of my favorite.
So let's take a look at what Andrew did.
[MUSIC - THE WEATHER GIRLS, "IT'S RAINING MEN"]
(SINGING) Hi.
Hi.
We're your weather girls.
And have we got news for you.
You better listen.
Get ready, all you lonely girls and leave those umbrella's at home.
All right.
Humidity's rising.
Barometer's getting low.
How low, girl?
According to all sources.
What sources now?
The street's the place to go.
We better hurry up.
'Cause tonight for the first time just about half past ten.
For the first time in history it's gonna start raining men.
It's raining men.
Hallelujah it's raining men.
Amen.
I'm going to go--
DAVID MALAN: So we'll make that available on the course's
website for you if you'd like.
[APPLAUSE]
Let me ask, at the risk of putting you in,
what's by nature, a little uncomfortable for one volunteer, to join me up here.
I need one volunteer.
Yes, come on down.
What is your name?
Greg, OK.
Greg is going to join me up here for just a moment.
Greg, you have to be comfortable before you
walk in front of two video cameras and the entire internet,
being on the internet.
And we'll need you to sign a piece of paper from the lawyers after this.
But come on up.
So not only with this programming environment
can you create these animations, these interactions,
you can also take user input and actually create interactive games.
So for instance, this was made by [INAUDIBLE],,
one of our students, now CAs this year, or now virtual teaching fellows.
The rules are fairly straightforward.
This is Scratch Scratch Revolution, similar, of course,
to DDR, if you're familiar.
You're simply going to use the left, right, down, and up arrows,
so that as things are flowing on the screen,
you want to hit the key exactly as the colored arrow is lined up on the top.
Makes sense?
All right.
All yours.
Let's see how you do.
[MUSIC - KANYE WEST, "STRONGER"]
(SINGING) Work it, make it, do it, makes us, harder, better, faster, stronger.
Now that, that don't kill me, can only make me stronger,
I need you to hurry up now, because I can't wait much longer.
I know I got to be right now, 'cause I can't wait much longer, man, I've
been waiting all night, now, that's how long I've been on you.
You know how long I've been on you, since Prince was on Apollonia,
since OJ had Isotoners, don't act like I never told you.
You know how long I've been on you, since Prince was on Apollonia,
since OJ had Isotoners, don't act like I never told you.
Told you, never told you.
Told you, told you, never told you.
Told you, told you, never told.
DAVID MALAN: How about a big hand for Greg?
Thank you.
So we'll make that one available on the course's website as well.
And so that's how we'll spend not only this Wednesday in lecture,
presenting some of the interesting concepts that
arise as a result of that.
But also, to set the stage for problem set
zero, which this semester will similarly task you
with really taking that environment out for a spin
and doing something that is of interest to you.
In fact, for what we'll call a hacker edition, more on that in a moment,
we will also make available these little circuit boards which have sensors
built into them like this little slider, little sockets for alligator clips,
a button here, it's got a microphone as well, as well as
a couple of light sensor, too.
So that you can actually integrate not only human input with, say, fingers,
but also environmental input as well.
So we'll be curious to see what those hackers among you do with that.
The week after will be very rapidly dive into C. This programming
language called C, where we'll spend much of the semester exploring
the fundamentals of computer science, and in turn, programming.
In week two, we will continue that discussion,
but also talk about some real-world applications of the same,
focusing particularly on cryptography.
Focusing in week three, then, we will look at--
and week three will we then focus on some of those ideas
that I hinted at before, things involving phone books
and counting millions or billions of students,
searching and sorting, and actually trying
to get a sense of just how good or bad your program is
based on its running time, given some increasingly large inputs.
In week four, we'll look at data structures,
clever ways of implementing programs that
need to store more than just numbers and say, words in memory.
We'll also talk about some low-level details like memory management.
How a computer actually moves those zeros and ones around,
and what risks your computer is at when you, the programmer,
don't move those zeros and ones around very safely.
Many of the so-called hacks or compromises of websites and servers
these days often boil down, still today, to what are called buffer overflow
exploits, which relate directly to the world's popular use of C, C++,
and similar language, that puts you at risk, albeit,
giving you at the same time more power over your program of hackers actually
getting into your system.
Well, in week five, we'll introduce another element of realism.
I spent summer a few years ago interning for the district attorney's office
in Middlesex County, where quite literally, the local police would
bring in hard drives and memory sticks, and sometimes monitors and mice.
But we would then look at the data on those machines
and try to provide the prosecutors with whatever tidbit of information
it was they were looking for.
Truth be told, sometimes forensics is not as sexy as it seems to be on TV.
Sometimes we literally double clicked on My Documents,
and there was the evidence.
We, though, will dive a bit deeper.
In fact, this is an excerpt from one of the problem sets from the course
last year.
This was an image we made and embedded a secret murder mystery in.
If you think back to childhood, and if you're
kind of doing that thing where you focus your eyes,
trying to stare through the projector screen, it's not that thing at all.
So it's actually the thing where you get like that red piece
of cellophane plastic in like a cereal box,
and then if you hold the piece of red plastic over some otherwise red piece
of paper, a message pops through.
Well, we gave everyone a graphical image, a digital image like this,
and they then had to write a program that
simulated that red piece of plastic, so as to reveal
who it was that had done it.
And I think last year, it was Colonel Mustard
in the study with the candlestick.
So that was the solution to that problem.
In week six, we'll return our focus to data structures, talk about things
called linked lists and techniques with which
you can solve increasingly sophisticated and interesting problems.
We'll look in week seven at things called hash tables
and binary search trees, compression algorithms,
heaps and tries, as they're called.
In week eight, then, we'll be transition away from our world
and focus on C into one that is web-based,
where the web is clearly increasingly the place to be
when it comes to software development.
Google, for instance, has been a pioneer in terms of buying or implementing
things like Google Docs and spreadsheets,
and even Microsoft has begun to take those same initiatives.
So if you don't know it already, we will teach you how to make web pages.
XHTML, HTML, we'll teach you a little bit about HTTP and TCP/IP,
things you've probably heard about, but maybe
have not gotten your hands dirty with.
We'll introduce at that point PHP, and a database query language called SQL.
With these languages will we be able to transition the problem
sets from an interesting and powerful, but command-line environment,
so to speak, to one that is browser based, and spend a couple of problems
sets there.
In fact, in week nine, will we introduced
the notion or the context of mashups, which
is this increasingly popular phenomenon whereby people make
available different types of programming code online,
different data sets, Google being one of them, Yahoo and the like,
and you can take all these different data sets and all these different code
that other people have written and mash them up together
to do yet more interesting things.
A canonical one in the world of mashups is taking Craigslist
and taking Google Maps and actually overlaying
markers on Google Maps wherever there are
apartments that are available for rent.
But things are increasingly sophisticated these days.
Some of you might be familiar with Google Earth.
So Google Earth is this wonderfully fun tool
that I was actually introduced to a few years ago
when I was just auditing an archeology course here.
We can, for instance, go to one Oxford Street in 02138,
which is roughly where we are, it's the Science Center's address.
If you've never played with this program before,
I urge you to spend the next one or two days playing with it,
just because you can literally take virtual vacations in your dorm room.
Here we are hovering over the Science Center.
Using the controls here, we can zoom in, we can re-angle ourselves,
we can see some interesting 3D topologies there.
There's a link to this on the course's website.
But what Google recently introduced, for instance,
is not only their Google Maps API, with which I did things
like Shuttle Boy and the GPS setup, but they also introduced a plug-in
for web browsers for Google Earth.
And one of the things I thought would be fun to show
is something that we may end up playing with,
this notion of using Google Earth's plugin--
which I wonder if this is going to work here.
Oh, had such good momentum there.
Let's see if we can do it in IE, if it's going to work.
OK, no.
All right.
We're going to run this in the background and we're going to-- oh,
so close to having every demo actually work correctly.
So we might end up playing with one or more of Google's APIs
is the takeaway there.
If you haven't already played with something like this,
I urge you to play not only with Google Earth, or this slowly downloading
plug-in, but we'll also revisit that later in the semester.
And near course's end will we actually look a bit at hardware.
We will take for granted the fact that there is some machine underneath it all
that's actually running our code and in making possible
all the things that we do and talk about,
what it means to compile your code and what it means to be a CPU.
And in the course's second to last week will we take things up a notch
and talk about enterprise architectures.
Talking about, well, what do you need when you want
to go run, say, a tech-type startup.
What do you actually need to build, what do you need to wire together,
what are your alternatives?
We'll talk in this week about cloud computing and virtualization.
The idea that you don't need to necessarily buy computers
anymore and connect them, you don't need to buy hard drives and storage anymore.
You can rather pay someone else a few cents on the dollar
and just rent computing cycles, rent memory, rent space.
And in fact, that is what we'll be doing with cs50.net this semester.
Rather than use Harvard's own computing infrastructure,
we will literally pay Amazon about $0.10 an hour to use one of their super fancy
virtual machines and multiple such instances that we will virtually wire
together and create for you all the illusion of one computing cluster that
you can then connect to, to actually work on your problem sets.
And the neat thing about this approach is
that for problem sets that involve a particularly lot of computation,
a lot of use of disk, well, we just have to type
a few commands, double the number of computers,
quote unquote, that are actually in the cluster.
We can then handle that load for that week,
and as soon as the problem set's submitted, we turn off.
Those virtual machines, they're no longer ours but available
for someone else to use.
And we'll of course, in week 12, conclude the course.
Well, what about the course's problem sets,
where we'll spend most of the outside of class time?
Well, problem set zero will be released later this week on Wednesday.
Next week will we look at C and problem set one.
Crypto.
In one of the problems this year will you actually
try to crack passwords, so to speak, where you will implement software
with which to decrypt and/or encrypt information, sensitive information,
and see what gets revealed.
We'll look also at forensics.
So in addition to maybe doing that red cellophane tape thing,
I will also, likely, like last fall, take a stroll
throughout campus with my digital camera,
snapping photos of some interesting spots on campus
onto a normal digital-- like Canon digital camera with a compact flash
card.
Unfortunately, I will likely accidentally format that compact flash
card, like I did last fall.
I'll then make an image-- a forensic image of that compact flash card,
post it, essentially, on the course's website for you all to download,
and then write your own forensic tool with which
to go recover all of the JPEGs, all of the photographs, that for a noob,
so to speak, would otherwise be completely lost.
We'll look in problems set six at the idea of implementing not just a spell
checker, but the fastest possible spell checker.
Even engaging in a bit of competition, optionally,
with your peers, whereby we'll benchmark your code,
post the results on the course's website,
and see if we can't get you to obsessively fine
tune your code, right up until the time of submission.
Last year toward the end of the semester, the course's final problem
set was to implement what we called CS50 finance, which
was an e-trade like web-based program with which students, once they
implemented it, could get real-time stock quotes from Yahoo,
could be given 10,000 virtual dollars in their portfolio
that they could then use to buy stocks, sell stocks.
So it was an online portfolio management tool,
so we'll likely do something like that, again.
As well as in the last problem set introduced
JavaScript and object-oriented programming.
Likely the idea of mash-ups and do something similar in spirit
to what Shuttle Boy, for instance, was.
But the climax of this course is absolutely its final project.
So the final project will be your opportunity
to take your newfound skills and savvy with programming out for a spin
and actually make something that's purely of interest
to you, subject to just a few guidelines.
We'll encourage you, at that point, to build something that interests you,
something that's actually useful, something
that solves an actual problem, be it for this course, for your research,
just for fun.
But ideally, somehow impact campus.
In fact, next year, as most of you probably know,
the University is changing its calendar, whereby it's a good thing.
Exams will come before winter break, which
means there will no longer be this month of either slacking or stressing,
depending on the type of personality that you are.
But it does put a wrinkle in the course's 10,
15 year tradition of having a final project
in the course, because we tend to use reading period, if not break,
to actually allow you this opportunity to dive in to your own work of art.
So what we will do for the first and maybe last time ever
is culminate the course in what we're calling a the CS50 Fair.
Think back to middle school science fair, but not so cheesy with test tubes
and whatnot.
But rather, an exhibition where we book some really big space on campus,
get a couple hundred tables, a couple hundred power cords, maybe
a few dozen pizzas.
Maybe invite our friends at Amazon, Google, Microsoft, Facebook,
and the like to maybe bring some t-shirts, maybe some job opportunities,
maybe those little squishy balls.
And we will invite everyone on campus to see this semester's final project
submission.
So it's your opportunity to not only show off
your work to your fellow classmates, but also to others on campus as well.
Not quite sure what will happen with the final project in semester's future,
but we will certainly, I think, this semester go out with a bang.
So welcome to CS50.
We'll see you Wednesday.
[APPLAUSE]
[MUSIC - KANYE WEST, "STRONGER"]
(SINGING) Faster, stronger.
Now, now that that don't kill me, can only make me stronger.
I need you to hurry up now, because I can't wait much longer.