>> David: Welcome, my name is David Malan and this is CS50.
And, this is not your typical high school computer
science course.
This course is a little something special.
And it's not because I'm teaching it.
it's because this is one of, we like to think,
those rare courses that actually squeezes your brain so much
and your schedule so much
that by semester's end you genuinely feel smarter.
So, that was the way I felt
when I myself took this course back in 1996.
I was a government major
at the time here living in Mather House.
And, I.
[ Cheering ]
As are the other, the five others there.
So, I was a government major at the time.
And I was a government major
because I'd always liked history.
I liked constitutional law in high school.
And so, I set off on this path freshmen year doing what I do
best, doing what I knew I liked.
And I'd always been a bit of a geek,
I'd always babbled with computers.
But, I myself, perhaps ironically in retrospect,
I'd always viewed the guys who were taking computer science
in my high school, my friends as the real geeks.
And yet, finally did, sophomore year I take this little course
called CS50 which actually had scared me away my own
freshman year.
And I was a user assistant at the time.
So, I was certainly already qualified, at least,
to be among those, those geeks
who I made fun of in high school.
But, I was scared.
There is, it had this reputation at the time and perhaps still
in part that it was a, it was a scary course.
It was a lot of work.
It was hard and yet, it's one of those things where, my God,
the bark was far worse than its bite.
I found myself sophomore year, for the first time,
actually finding homework fun.
And I'm not saying this just to pitch this course to you.
this was a genuine realization for me.
Now, I think, at one point, I did cross the line
to true geekdum where I actually used to look forward
to Friday night because I could curl up in front
of my little MacBook and work on CS50's problem sets.
So, at that point, I think I had clearly cross the line.
And, our goal in this course is not to turn all of you
into that person, but, just to say
that there's a little something special about this course,
a little something special about computer science
in general especially these days.
And, the more acclimated we've all got into technologies,
the more toys we carry around in our pockets
that are themselves computers.
I mean, my iPhone is actually a higher performing computer
than my laptop was in college.
You can do a lot of neat things with these things.
And now, most of us in this room,
probably just use other people's software, other people's tools,
other people's solutions to problems because we go
to iTunes, we download some app from the app store
and walla we can do something really neat.
But, by the end of this semester,
you can be the person doing that problem solving.
You can be the person solving some problem, building that app,
that piece of software, that tool that, either,
one just amuses me, amuses you.
for instance, controlling, say, your iTunes library
from with your apartments clearly an app
that already exists or you can find shuttle schedules more
easily for instance.
So in fact, one of the very first things I did
after taking CS50 was again, it was probably
at this point Friday nights and Saturday nights,
there was this opportunity at the time
where Harvard was running shuttle buses.
And, to this day, they still have printed schedules.
But, there was really no means online of finding
out when the next shuttle was.
Now, I didn't care, because even though I lived
in Mather I wasn't among those who generally took the shuttle.
But, I had a lot of friends in Pfoho for instance.
And one of them asked me, I think in at one point.
[ Cheering ]
Okay Pfoho's better than Mather apparently.
So, one of my friends kind
of got me thinking maybe I can write a little program to kind
of help my friends check the shuttle schedules.
And thus was born the awkwardly named shuttle boy,
this piece of lexicon that has stayed around for some number
of years at least among some of the upperclassmen.
At the time, this was this little command line program
similar in spirit to Dos.
It was running in a UNIX environment.
So, it wasn't very sexy at all.
You just typed a couple commands and it told you
when the shuttles were.
Well, these days it's a little more sophisticated.
And, it's actually represented of precisely the types
of projects that students in this course end
up making by terms end.
So, this is version four, some 15 years later, of Shuttleboy.
Seems Google Maps is being a bit slow there.
But, for those of you who have to get out of here after class
and go, say, from Memorial Hall and need
to go up to, say, the Quad.
Well, you can either leave in two minutes if by,
this really isn't working for you just yet,
or you have as many other options as you might like.
And, coming soon, we can pitch this from CS50,
it will be the same capability by SMS.
You can text Shuttleboy via phone.
You call Shuttleboy.
CS50's phone number this year, well,
amazingly this was available, 617-BUG-CS50.
So, that will debut soon.
So don't call it just
yet because I've gotten reprimanded for,
right now it's being routed
to our system head teaching fellow's cell phone.
So, you'll just get him if you have questions
about the shuttle schedule now.
But, that will soon be implemented.
So, other things, actually, that we ourselves spent this summer
on really in preparation for this semester was a whole bunch
of other problems that we wanted to solve.
For instance, there's a whole lot of stuff that goes
on in this campus on a given day.
And in fact, put another way, there's a whole lot
of stuff going on at this campus
that I certainly never take advantage of.
And, even though I'm now overwhelmed with how many things
that are going on, on campus,
I still seem never to find the time.
But, walla, even there, CS50's lecture.
That's where you is, so this was a, this was a program we wrote
to aggregate all of the events on campus.
And this has been something that other students
in this same course have tackled on their own.
And, we've working with other entities on campus
to really make this happen.
But the point to CS50 this term is that all
of these little programs we've been working on whether this one
or whether one for aggregating all of Harvard's news
in one place, all the Google News,
all of these things are going to have what are called API's,
application programming interfaces.
And this is just fancy speak for the capability
of letting other people, people in this room,
actually doing something with that same data.
So, by terms end, if you decide
to implement the final project related to news or events
or maps, well we, at least as a course,
will make that all the more easy this year by providing you
with an interface; a sort of function, so to speak,
software that you can use in your own projects to go above
and beyond where students, perhaps, have gone in times past
because this framework has not been in place for them.
And again, this all began, for me at least,
some 15 years ago implementing Shuttleboy.
I then emailed my friend Ken in Pfoho.
I said hey what do you think?
Is this useful?
He mailed it out on the Pfoho open list and walla,
all these years later I'm apparently still milking
this project.
And the neat thing about it, and this is where too a course
like this in engineering and computer science, I think,
is a little special, is that, when you do your home works
and when you do your projects in this course, you know,
many of them, yes, you'll put aside and not really use again.
But, some of it, you will.
And there's this really powerful thing, at least for me,
this really exciting thing, when you make something
and other people actually care, other people don't just smile
and pat your on the back and then sort of go
about their own lives.
They actually use what you made in their own lives even if it's
for something as silly or as simple as just finding
when they can get out of here
to catch the next shuttle to the Quad.
So, by terms end, that's one of the goals for this course;
to empower you guys to just identify some problem whether
it's on campus or hopefully well beyond campus,
and actually use your own skills, your own mind and solve
that problem in some part, technologically.
So, this is also a course as we say in the syllabus
and the courses official description that teaches you how
to think and it teaches you how
to solve problems more efficiently.
Well, what does that mean?
Well, when you've got 600 megahertz in your pocket
or three gigahertz under your desk at home,
you can solve a lot of problems efficiently just
by shear brute force.
But, there's a lot of problems in this world,
whether it is searching, say, Facebook's network
or the internet via Google,
that it doesn't matter how fast your particular computer is,
there's no way in hell you're going to search billions
of web pages quickly unless you actually approach this
problem intelligently.
You don't just search, for instance,
a huge list of all the web pages on earth from top
to bottom looking for something related
to whatever search terms you're looking for hopefully Google
and presumably Google and Facebook and any
of these large entities have a lot of smart people thinking
about how they can find data more quickly,
how they can process information more efficiently, and,
how they can just generally return results more quickly
so that you can do yet,
more interesting things with these devices.
And so, what do we mean, though, by how, teaching people how
to think more carefully, more algorithmically.
Well, this little visual always seems to go over well.
And, it seems to be memorable.
And I was even asked just yesterday by a former student,
oh are you going to do the phonebook thing again.
And I pretty much on the spot decided alright sure we'll build
a phonebook thing.
And he asked me when you tore it in half right,
I was like well yeah technically we tore it in half but not
in the way, in the computer science way will I be able
to tear this thing in half.
And so, here was the problem that we presented for some time.
So, here's the phonebook.
It's got at least a thousand or so pages.
And the simple goal at hand very real world is to find,
say, a person in here.
So, Mike Smith, last name starting with S. So,
I'm a typical human, I pick up this phone book.
And anyone out there, what would you, a typical person,
do to start finding Mike Smith, obviously not knowing
in advance what page he is actually on.
Right, so you go roughly in the middle, right.
And at this point in the story, I'm probably in the N's or M's,
you know, roughly half way through the phonebook.
Turns out, the last time I did this example I somehow found
myself in the escort section.
So, it's actually not equally balanced between A through M
and N through Z. But, today, we are, in fact, in the M's,
alright so, now I'm at the M's.
But what's my takeaway now just
as a normal human off of the street?
Where do I go next for Mike Smith.
[ Inaudible] And so, just probably on this half, right,
because S comes after M. And so, herein lies the visual drama.
That's not really tearing it in half, right.
I kind of cheated down the center.
But, we now know that Mike is at least not in that half.
We can literally throw half of the problem away.
And I'm left with the problem that's fundamentally still the
same thing, find Mike Smith in a really big book.
But, the problem is now half as large.
If it had a thousand pages before, now it's got 500.
You know what, I can do the same thing again.
I can kind of recursively or repeatedly do the same thing.
Now I'm not quite at S. I'm at T. And so,
oh I went a little too far.
But, I know now that Mike is not to the right, there's going
to be some class someday where I just can't tear the dam thing,
I bet.
But now, I know he's not to the right.
So, now the problem has been quartered.
So, I've gone from a thousand to 500 to 250 pages.
And again, if you continue the logic, continue the mathematics,
I'm chopping this problem in half, in half,
in half until finally I'm either going to not find any Smith's
at all, unlikely, or I'm going to find the one I'm looking for.
But, that, then, begs the question, is this any better
than the simple approach of just saying, you know, A, nope, B,
no, starting from left to right going linearly through the book?
Well, instinctively yes.
It's going to be a lot faster.
But, how much less?
Well, if I have a thousand page phone book or let's say 1,024
for those of you who like powers of two,
how many time might I have to split this problem
in half before finding Mr. Smith?
>> Ten.
>> David: So, ten, right.
If you have 1,024 pages and you split them in half, in half,
in half, in half, I do that ten times which means I go
from 1,000 pages to the person I'm looking
for in just ten pages turns.
And that's kind of neat, but, you know, if you think
about it you've been doing this all of your life.
It's not that dramatic.
But now, that the phonebook isn't just for Boston,
it's for the entire US or the entire world
and this thing has billions of pages in it,
so imagine a phonebook with four billion pages.
How many page turns am I going to have to do maximally
to find Mike Smith in a four billion page phonebook?
>> Log base two.
>> David: So yeah, if you're kind
of the math type this is log base two.
But, if you think four billion to two billion
to one billion, so a half a billion.
I mean, that actually goes whittles itself
down pretty darn fast.
In fact with 32 halvings of the phonebook even
from four billions, I'll get down to one page.
And that's when this stuff gets powerful, I think.
That's when these ideas get compelling
when you can have a four billion page problem
and in 32 steps you can find the person you're looking for.
And so, that's what we mean when we say that you'll learn how
to think more carefully, more algorithmically,
more intelligently about solving problems.
And the returns are huge when you can actually do this,
and again, to this point of the Googles
of the world the Facebooks who have the luxury
of having huge datasets.
You've got to approach these problems
in this way otherwise it's simply not going to work.
Well, what's what did the student actually recall?
I, we like to do things that are a little bit silly sometimes
to sort of take the edge off
of what is otherwise a lot of new material.
And so, he actually, this former student sent me this link
which I went ahead, just for kicks and then regretted it
at the end, pulled up on uTube here.
So, I thought I would share what a non-computer scientist means
when he tears a phonebook in half.
[ Laughter ]
[ Silence ]
[ Inaudible ]
>> You know over 200 pages, nice clean line, legitimate tear.
[ Laughter ]
>> David: so, I suppose, his way works too.
So, what I got out of this course all those years ago is
yes, Shuttleboy, and then yes a degree in computer science,
and then yes a PHD in computer science.
And that's not what we're trying
to turn most students in this course into.
Most of you in this course are not going to go
on an major in computer science.
Some of you might minor, but for some
of you this will be a terminal course.
And that's perfectly fine because this course is, in fact,
structured in a way where even if you just pay your dues
for several months and you really focus in
and you really take as much out of this course as you can,
you will, in fact, be well equipped to go back
to your world of economics, biology, psychology,
applied math, and actually make use of what is ultimately
as interesting a course as we hope to conceptually
as it is fundamentally practical.
And that too is something that's perhaps a bit rare to find.
I thought I'd share a few comments that students
from last fall put in this past years cue guide when asked
about what would you like to tell future students.
Well, if you haven't already looked at these comments,
one student said this course will take a fair amount
of your time up.
but, if you put your work into a whole new world, a whole,
if you put the work, if you put the work into, alright,
so this is his grammar not mine, so if you put, put in the work,
a whole new world will open up to you.
Amazing how much I learnt in only 12 weeks.
Another student wrote, you better take this
or you're going to regret it.
Another wrote, a little more bluntly, it will kick your ass
and leave you feeling great.
And then finally, this one is perhaps something I can only
show in writing, but, second from the bottom here.
[ Laughter ]
So, I'm not sure if you have many friends
who took this course but we kind of did a lot of damage
to last year's students.
We introduced, at the start, several lectures, a few quizzes,
a couple problems sets, this notion of lolcats.
You can't see what I can see here
but in a moment you will see a young man named happy cat
who is the leader of the so called lolcat.
This is one of the stupid internet forwards
that I think frankly the dichotomy
between these two gentlemen here and what we now have
on the screen is perhaps.
[ Laughter ]
One of the most inappropriate uses of this theater to date.
And, why don't we make a little more real a little more personal
this notion of actually solving a problem more efficiently.
A simple problem on day one of any school is to sit down
or stand up and start counting the students,
right roll call of sorts.
Well, the most naive but nonetheless,
very correct approach that a teacher could take is one, two,
three, four, five, six, seven,
and we'd be here quite some time.
So, what's a marginal improvement on this even
that you might have done as a kid?
How do you count people faster?
And, don't start reading off my own instructions?
What would you have done as a kid?
Start counting twos, right, like so I'm pretty good at two,
four, six, eight, ten, 12.
So, that's something interesting right.
So, how much of an improvement is that there?
So, it's obviously a factor of two.
It takes me half as much time.
But, you know what, as we'll find throughout this semester,
big deal, like speeding up your running time by just a factor
of two is not all that interesting
because the analog here in the computer world is
that I'm a CPU I'm a computer, well heck,
if I just wait 12 months, 18 months,
I the computer will just be able by nature, by the number
of gigahertz I have in me to be able
to count people in this room faster.
So, these kinds of, these kinds of linear speedups like factor
of two factor of three, even factor of ten, who cares?
Right, we can throw hardware at the problem.
We can wait things out.
We can develop faster machines.
But, intellectually, yeah that was kind of clever
but it didn't really fundamentally change
the problem.
I'm still going from left to right, front to back.
It's really the same algorithm.
But, I offer that we can do better.
We can do smarter than this
and do fundamentally a faster implementation.
But, to demonstrate this,
we need you to humor us for just a moment.
And it's at this point
where it'll be me talking less and you talking more.
But I do need you to execute step one together,
which is if you would humor us, please stand up.
The directions here on the board, you know are, okay,
a couple of you have to sit down.
Those of you in back, there we go, alright.
Thank you.
So, the program here is before you.
You are now the computers executing this program.
It's fairly self explanatory at this point.
Yes, you should be number one.
Get it? Right, many of you are probably thinking this already
anyway, first freshman year.
So, think to yourself, you're the number one.
So, step three here, pair off with someone standing,
add your two numbers together and adopt that sum
as your new number and we'll do a sanity check.
[ Noises from crowd ]
Do you know how many we have?
>> [Inaudible]
>> No [inaudible].
>> We need to have an answer key.
[ Silence ]
>> Yeah.
[ Noises from crowd ]
>> David: At this point the algorithm should be
winding down.
[ Noises from crowd ]
Maybe we should have gone with my approach after all.
>> 43.
>> 163.
>> David: Ooh arithmetic in front of 300 plus people.
[ Laughter ]
What's our final tally going to be?
>> 180.
[ Laughter ]
>> 1,200.
>> 386.
>> David: 386, and are you the last one standing?
Is that everyone?
Do you know the answer?
>> What?
>> David: Do you know what the answer is?
We didn't bring an answer key with us so,
386 is in fact precisely the right answer for the first time.
[ Cheering ]
[ Applause ]
That's okay.
[ Applause ]
Very, very nicely done.
So, what was the takeaway
because that definitely felt a little slower
than my very simple
but nonetheless very correct approach of just going onesies
and twosies and just getting it done with from left to right.
But, what did we really just do there?
Well, if there were roughly, let's say, 400 of you standing
at one point, and then half of you, very quickly,
from what I could tell, wanted to sit down.
So, half of you sat down, we went from 400 to 200 then
to 100 then to 50 then to 25.
So again, there's that same divide
and conquer idea we had with the phonebook.
Again, with every iteration we halved the size of the problem,
we halved it, we halved it.
So, in theory, your algorithm should've been much faster
than my linear approach because my approach would've taken say
400 steps or maybe if I'm slightly clever 200 steps.
But, yours would've taken far fewer, right from 400 to 200,
100, 50, 25, 13, six; so fewer than ten steps
in the end versus my 200 or 400.
And there's the germ of a really interesting idea.
And yes, mathematically what you just did was something that's a
little logarithmic in nature by log base two,
we divided in two and two again.
And we'll revisit this later in this semester.
But therein lies again a very intelligent implementation.
And, we are just scratching the surface
of the very clever the very intelligent efficient approaches
to problems that we might ultimately solve.
So, who are the people you just chatted with if briefly?
A common concern in a course like this is that everyone
to the left of you and everyone to the right
of you must clearly know more than you.
Well, that's absolutely not the case.
And in fact, in recent years,
this course has made a concerted effort to reach
out to those less comfortable, so to speak.
And by that, we mean not people who've never touched a computer
before because that's really hard to find
around here these days, but folks who use email,
use Facebook, maybe even right now
but are not necessarily quite sure what to do
when something goes wrong or when they are asked
about anything technological, you know, the hands go up
or they kind of push the hardware
to a friend who's perhaps more versed in it than they.
Well, these are some statistics from last year's semester.
So, when asked, when we asked our 400 so students last year,
you know, what is your level of comfort coming into this class,
well 34% wrote themselves down as among those less comfortable.
So, if you have come into this room and are still thinking now,
that, you know what, this term less comfortable describes me,
know that you are in very good company.
But, realize too that, if you're coming in this course
with a background in computer science and you were really
that geek in middle school and high school who was writing code
and teaching yourselves languages, well that's fine too
because there's definitely a nontrivial sized audience
with that background as well, about 13%, last term.
And then, there's everybody else, sort of someone
who doesn't think they're less comfortable,
they definitely don't think they're more comfortable
but they're just in a course to get something out of it.
So, realize this course does draw quite the spectrum
of students.
And, to put this in more concrete terms, 71% of students,
last year, had zero courses behind them.
So, if you're entering this course thinking oh everyone
who takes CS50 was a computer science whiz
in high school, it's not the case.
Most people are presumably just interested in it.
And a few, yes, absolutely have taken some courses, some,
or at least one person last year had taken five
courses previously.
So, we definitely have some outliers but again the meat
of the curve is in those lower values altogether.
And another interesting statistic we shared
over the past couple of years is the gender ratio.
So, historically, at least in computer science, there is a bit
of a male female skew.
I couple of years ago it was much more marked than last year.
So, we're almost now at the %40 level.
And if I can throw down a gauntlet just for the sake
of having a third pie chart next year,
that's even more equitable.
I would point out that there's absolutely no reason
from the courses perspective that males
and females shouldn't be enrolling
in this kind of course.
In relatively equal numbers and realize to 38 percent,
48 percent, we're actually quite pleased to see that we're almost
at that, at least, statistically even value of 50%.
So, if you are, in fact, female, do rest assure too
that this is not, in fact, a male dominated class.
Well, this just so happens to be CS50's 20th birthday.
I, well thank you.
[ Cheering ]
[ Applause ]
That's very nice of you because we brought cake
for you actually.
And so, when you exit here later today,
you'll actually get a chance to meet many
of the courses teaching fellows who'll be lingering
in the hallway.
And yes it'll be a nice sort of incentivized way
of meeting the teaching fellows.
But, we do take a trip up to a little bakery
and again consistent with the course is playful nature while
nonetheless is expecting nontrivial amount
of work while we're having that fun.
But, we do have one of these cakes for you.
[ Laughter ]
So, if you're laughing that's actually good because even
if you're among one of those less comfortable
at least you're aware of it.
Those of you in the 14 percent might prefer this flavor.
[ Laughter ]
And then, if you don't know what the hell is going on right now,
we also have this for the rest of you.
[ Cheering ]
[ Applause ]
So, those are being chopped up into pieces outside as we speak.
So again, let's take things up a notch
and at least introduce some basic tenant
that we'll then take for granted
in the remaining of this semester.
So, we all probably know that computers ultimately boil
down somehow to zeros and ones, these things called bits.
What does that mean?
Well you can think of it frankly as a light bulb,
a bit is a light bulb that's either on or it's off.
It's a switch, it's either on or it's off.
Now, computer scientists generally think of off
as the number zero arbitrarily and the,
and the notion of on as one.
So, if you throw a light switch
on that's one turn it off that's a zero.
Or, equivalently, turn the light on that's the value
of true turn it off that's the value of false.
So, these are just synonyms.
At the end of the day, yes, all computation, all stuff that goes
on underneath the hood in a computer does ultimately boil
down to zeros and ones.
And, when you stop to think about it,
it's pretty dam remarkable what the world has done
with these basic building blocks including some
of the devices you're holding in your hand.
Well, why are zeros and ones useful?
My God, even in the real world we
at least have ten digits, zero through nine.
Why so limited?
Well in hardware terms it's very easy.
It's much easier to represent two states, right.
If computers are plugged into the wall, usually,
you have this easy source of binary nature.
It's either on or off.
Electricity is flowing or it's not.
So, that's kind of one of the initial reasons
that the world went with just zeros and ones in computers.
But, you can use them as building blocks.
So, this actually is a little small on the screen here
but we can count in binary or we can represent anything we want
in binary just as we can, say, decimal, just as we can,
even in fact, with alphabetical letters.
And so, here's the quick system.
In just a couple minutes time you'll now know how to count,
how to write, how to speak binary much
like your own laptop.
Well, you have, in the world of binary, sort of just
like grade school columns or values.
So, in grade school we learn this is the ones column this is
the tens column, the hundreds column and so forth.
In other words, why is the number we know
as 123 the number 123?
Well, my teacher taught me this is the ones column,
this was the tens, this was the hundreds.
Well what did that mean?
Well, to figure out what the total value is
of what is otherwise the string of digits,
just hash marks on the board.
Well, we have one 100, so that's 1 times 100
and then plus what two 10's
so that's 2 times 10 plus three ones, so that's 3 times 1, okay,
so I seem to have gotten back to where I started.
But, this very simple process of just multiplying the digits
by the value of the column is exactly what binary is
all about.
But, in binary you use powers of two not powers of ten.
So, here's a series of eight light bulbs.
Computer scientists like to use values like two and eight and 16
and 24 and 32 because they're all generally convenient values
to use.
So, when we talk about eight values
in sequence this is like called the byte.
And these days we rarely talk in just bytes,
we talk megabytes gigabytes and terabytes these days.
But it's all ultimately the same thing.
Here's eight bits AKA one byte, just simple jargon.
So, all of these light bulbs are off.
So, the math is actually really easy.
So there on the right, though it's small to see,
is the one's column, the twos, the fours, the eights,
the 16s, 32s, 64s, 128s.
Alright, maybe it's hard to memorize at first
but it's just multiplied by two from right to left.
So, you can always recreate this.
Well, they're all off so that's 0 times placeholder,
0 times placeholder.
So, this is the number 0 represented in binary.
In other words, how do you write the number we know
as 0 in binary?
Well, one, two, three, four, five, six, seven, eight,
and technically just like in decimal,
all of these leading zeros, they don't add anything
to the formula they're just there
because we arbitrarily decided we want eight
of these things in a row, right.
If they're physical objects, we have eight
so they've got to all be off.
So, we could've just gotten away with one zero.
Well how do you represent the number one?
Well, instinctively you're going to throw one of the switches.
You're going to turn a bulb on.
So, there is the number one because we now put a one,
a light bulb that's on, in the one's position.
How are we going to represent two?
Well, we're actually going to throw two switches now at least
versus this state, we have to turn
on the two's column turn off the ones column
and now we have the value of one in the twos column.
So, that's the total value of two.
Now, a quick mental exercise; what's going to happen
with the next sequence?
How do I present the number three?
Well, I need one from the twos column,
one from the threes column and ah ha.
So, now I've incremented that one.
And now, this same basic pattern repeats.
What's the number four?
Well let's see, I just need a one in the fours column
and then zeros in the twos and ones.
So then, it continues that way.
And, it's just this sequence of steps.
And in the notion of binary is really not all that complicated.
At the top there we have eight zeros.
Below that we have seven zeros and a one.
Below that we have six zeros, a one,
and a zero and that's binary.
Now, thankfully, we computer scientists, we programmers
by terms end are not going to often be writing in binary,
talking in binary, thinking in binary
because we've built many layers of the traction on top of that.
In fact, people rarely talk about bits except
in a networking context they talk about bytes
because one bit, not that useful,
eight bits these days still not that useful,
but at least eight bits,
one byte is at least getting us toward more useful units
of measure.
But, when we start looking underneath the hood,
when we do certain problems such as look at files
and look perhaps at network traffic,
it will become interesting
to know how you're representing data because you're going
to have to figure out how to display that same information.
And, in fact, we, if we only have zeros and ones,
how do we go about representing, say alphabetical letters?
Well, we're going to have to have some mapping
between binary and letters.
But that's as of yet unclear.
But to hammer this point home and to give me a break
from speaking at, I thought I'd pause for a moment and see
if we can't recruit eight volunteers,
one byte eight people.
Can I get eight people for whom it is not too awkward
to come on up.
good, good one, two, three, four, five, six, seven,
eight very enthusiastic eight, come on down.
So, you all, for just a moment here, oh and you have
to be willing to not be on the internet because there is
in fact a camera in the back of this room.
So, turn back now if you don't want to be on the,
hello mom, in perpetuity.
So, let's see, you here will be the 128th column.
And let me ask that you simply hold this before you.
And actually, if you could scooch this way just a little
bit, then I will get out of your way.
You'll be the 64's column,
you shall be the 32's column and the 16's.
32's, 16s, 8's, 4's, 2's and 1's.
All right.
So perfectly lined up with the place holders from before,
but we need a little bit of mapping, so a quick set up.
We just need an arbitrary way of mapping binary numbers,
which really could be converted very easily to decimal numbers.
So we need a way of converting numbers to letters
if our computers are actually going to show us emails
or type URL's or actually display non numeric information.
And, in fact, there is a system for that, it's called ASCII,
an acronym whose meaning is not
so interesting, but whose utility is.
This is just a mapping from letters to numbers
and there's actually a lot more numbers on the screen,
and you guys, don't worry, aren't going to have
to test yourselves with this in just a moment.
But there's a mapping between numbers and letters
and I'm just going to get us started by pointing
out a couple of these.
The numbers of interest right now are going to be,
whoops, are going to be this.
Whoops. So in this column here, I can't seem to zoom
in simultaneously, we have decimal.
Dec for decimal.
And then we have the character on the right hand side.
So if I hop over into this column, thought it's a bit small
on the screen, the number 65 represents what letter?
Capital A. And the number 97?
Lowercase A. All right.
So those two alone, right, so do not go home and try
to remember ASCII chart.
Come quiz time, do not try memorizing an ASCII chart.
Memorize two, 65 is capital A and 97 is lowercase A.
And from there you can bootstrap yourself to all
of the other alphabetical characters.
But all this chart says, and I just downloaded this chart
from ASCIItable.com, this is a standard that's been
around for many, many, many years,
but most computers still use it.
What we now have is a means
of encoding alphabetical information using what's
ultimately numeric.
So if these guys are just switches, light bulbs,
computers, we can actually convey messages.
So each of you has some hints on the back.
We're going to have three rounds here where these guys are going
to spell out in English, in ASCII,
a very short message, a three letter word.
It will involve them either raising their hand,
thereby representing a one or just standing there awkwardly,
thereby representing a zero.
So why don't we proceed immediately with round one
and you can either raise or not raise your hands.
So the audience doesn't get off the hook.
What number are they currently representing?
66. Right.
Not hard because we have a one, a hand up in the 64s column,
a hand up in the 2's column.
64 times one plus two times one is 66.
They're representing the number 6,
which means the first letter is B. So not too bad, right?
Round two.
First letter was a B.
[ Laughter ]
>> Seventy Nine.
>> David: Can someone second that?
Yes. All right.
So 79, which means it's now an O. So B,O.
There's a third letter.
Actually that is kind of, yeah.
Third round.
Third and final round.
What number is this?
I heard an 87.
Someone else agree?
All right, yeah.
This is in fact 87, which maps to,
and this is a very clever set up at
which point you all B, O, W, it's bow.
Very good.
So actually besides that little souvenir,
that was not a very enthusiastic applause,
so I'll take care of you.
So we do have a little something for these guys here now
that they just appeared
on center stage doing perhaps the geekiest thing they could.
So maybe if we could humor them if only
because I'm feeling a little bit awkward now.
A little round of applause for these guys here.
[ Applause ]
All yours.
All right.
Thank you very much.
So, so, it turns out that we can take this one step further,
but you are now entering a community of people
who understand things like this.
[ Silence ]
It's slowly spreading, yes?
[ Laughter ]
It's not cool that you understand this now.
So we've already done some damage here today, but yes,
there is now such a thing as geek humor
that you might just catch a little bit more on to.
So what are we going to do throughout this semester?
So there's 12 weeks, zero index, so 13 weeks in total.
You'll find throughout the semester
that computer scientists tend to count starting from zero
for reasons that will soon become clear.
But what we're going to do this week, starting this Friday,
is introduce you to programming.
Now you may already be coming at this course with a background
in the same, and that's perfectly fine,
but we'll also be able
to introduce some more sophisticated topics
than are typically covered, things like events
and threading, so just to toss out a couple
of buzz words for those unfamiliar.
But what we're going to do is not dive
into what the typically traditional language like Java
or C++ or C sharp catch phrases that you might have heard
in the past, but we're going to use a programming environment,
a graphical programming environment
that was actually developed by MIT's media lab.
And this is an environment that allows you to program,
quite literally, by dragging and dropping puzzle pieces
that fit together logically
that lets you implement these things called loops
and conditions and Boolean expressions
and you can actually, on day one, after this Friday,
write a program that actually some
of your friends might care about.
So in yester year, say
when you've taken a computer science course in high school,
odds are one of your first programs was the equivalent
of hello world, like wow mom,
I just made the computer type some characters on the screen.
It's a very underwhelming experience.
Much more interesting is it to implement a little something
like this, as one of last year's students did.
So I give you the work of a former classmate.
It's a love story, of sorts, about dancing cookies.
[ Music ]
So this was actually from a student
who had never programmed before.
And just to give you a teaser of this interface,
and we're only going to use this for one week time,
really to get the comfort levels up
and to really get folks excited
about what you can actually make these machines do,
this is an environment where you'll be programming by,
for at least a week, just dragging
and dropping puzzle pieces that fit together,
as we'll see, in a logical fashion.
And it lets you do fun, silly things quickly.
And for any of you who are a little bit familiar with things
like Java and C++, it's usually a good semester or two
or three before you finally get to start writing something
that another person might actually enjoy watching.
Well, in week one of the course, or the second week, zero index,
where we dive into a little more traditional environment.
In this course we'll spend much of our time
on a language called C. This is one
of the earliest languages that, unlike Java,
actually gives us much greater access for better or for worse,
to manipulating hardware and actual memory,
and we can do a lot of damage with that.
In fact, any time you read of web servers being exploited
or computers being hacked into,
very often to this day it's the result
of people having run software in a language called C or C++
without sufficient care given to what are called buffer overruns
or lengths of arrays, so some fairly technical concepts
that are not that hard to understand,
but there's been a lot of humans making a lot of mistakes
for years and with this language we'll actually understand some
of those security implications.
But each week, typically,
we'll introduce also an interesting domain
that will inspire that week's problem set.
So we'll also take a look this week at the field of cryptology,
cryptanalysis, the notion that you can encipher information
in such a way that people can't read your messages,
but if clever enough perhaps you can, in fact,
crack what are otherwise secret messages.
In week three we'll then look at some basic fundamentals
of computer science like searching and sorting
and we'll actually look at this notion
of recursion, how to debug things.
In short, we'll take things up to the level of problem solving
and not so much about mere syntax
and implementing short little cookie cutter programs.
In week four we'll introduce more sophisticated
problems still.
What does it mean to manage memory?
What does it mean to run out of memory?
What does it mean to actually segfault,
if you've heard this expression, and odds are you haven't,
but very bad things happen and frankly
by terms end you'll understand terms like my code segfaulted
which actually is generally not going to be a good thing.
But then again, we'll introduce some domain specific stuff.
So actually one
of my internships during graduate school was to work
for the local Middlesex County District Attorney's office doing
forensic investigations in a digital sense.
The local Mass state police would bring
to our office hard drives and floppy disks and sometimes
for no reason mice and keyboards.
And we would be tasked with finding evidence.
Now it turns out, maybe just an FYI, that the criminals
in Cambridge, Massachusetts, at least,
not necessarily that clever.
Very often our forensic analysis boiled
down to booting the computer up and double clicking
on the My Documents folder, and therein laid the evidence.
But what we'll do this week is give you a sense
of what it actually means to store information
on a hard drive, on a flash drive,
and why can't otherwise private information be disclosed
to third parties when you drop off a computer to be repaired
or even when you discard it.
Well someone might very well be sifting
through those hard drives and it's really not that hard
to find data if you know how to look for it.
Well, in week five we'll look
at more sophisticated data structures, tools and techniques
that you can use ala phone books
and ala searching huge data sets much more intelligently.
And the week's problem set will task you competitively
to see just how fast the code you can write is
and how little memory you can use.
Toward terms end though we'll take things up to a higher level
in terms of programming languages and put C behind us
and introduce a web programming language known as PHP,
one of the popular languages these days.
Much of Facebook is still written in PHP,
at least outward facing, and it's just a very easy language
to learn quickly once you already know another.
So with PHP we'll be able to solve problems
and implement websites that do interesting things.
The news site I showed you, the events site,
the shuttle boy site,
all of those all happen to be written in PHP.
But by no means is that prerequisite.
What you'll also find throughout this course is
that you're not going to exit this course knowing C. You're
not going to exit this course knowing PHP.
Those are not interesting skills to claim, but knowing how
to program, knowing how to use data structures and algorithms
in an interesting way, that's a compelling story.
Even I, all these years later, throughout college
and graduate school, the only time I ever learned a language
was probably in CS50 where it was still taught in C and CS51,
which is one of the successor courses.
Everywhere along the way since has been go learn this language
and then work on this problem set
because computer science is not supposed to be
about here's a language, let's spend seven weeks teaching you
where the semi colons are.
There are much more interesting ideas out there.
Databases, for one.
And in week two we'll introduce you
to this query language called SQL that'll allow you
to store information in databases
and actually implement some fairly interesting
final projects.
The week after we'll look
at what's called client side programming,
doing interesting things on a user's computer,
taking advantage of their CPU cycles,
doing things ala Google maps and these websites
that actually use JavaScript,
which is actually a language we'll introduce
to let you do client side things, make more interesting,
more sophisticated user interfaces, but at the end
of the day have to be really mindful when implemented
of a lot of sticky issues like network speeds,
network performance and security.
So it's not about again just coding something up that's fun
to use or pretty to look at, but actually thinking
about the design that'll be the interesting process.
And then, the end result aesthetically will often be a
really neat toy to show yourself or a friend.
And then we'll look at hardware.
We're going to take for granted
that there are these physical boxes throughout much
of the semester that will do what we tell them to do.
But how are they doing that.
So we'll actually take a peak under the hood and talk
about what a compiler really is, what a CPU really is
and actually consider what's making all of this fanciness
from stupid YouTube videos on down possible.
So what are the expectations?
Attending lectures and sessions,
completing nine problem sets assigned roughly weekly,
two quizzes, the final project and there is
in fact no final exam.
Grades, it's always a question, broken down as follows here.
You can take the course pass-fail.
But let me say it here, and I've said it many times.
I personally care relatively little about grades.
I think they are a wonderful, well,
they are a useful pedagogical tool with which to motivate
and unfortunately sometimes de-motivate, but you'll find
in this course that at the end of the day it's more
about seeing how far you can go from weeks zero to week 12,
as we say in the syllabus than it is
about absolutely ranking all students in this course.
So if you're coming into this course among those less
comfortable, though a large demographic do not assume
that that's automatically putting you in the lower third
of the so called distribution.
At terms end do I sit down with the TF's and discuss each
and every one of the students.
We take into account where a student came from,
what kind of trajectory they were actually on and so
at the end of the day please focus more on, and I don't mean
to sound too grand, the process of learning
and less on the numeric's.
And you'll actually see that we grade problem sets,
in particular, very coarsely, whereby along three axis,
you will get a score of 1, 2, 3, 4, or 5,
where 3, is in fact good.
3 is not C. 3 is good, 4 is better, 5 is best.
But more on that as the problem sets are released.
So the course's website is where you will find, as in most cases,
a whole lot of useful things, if not silly things, too.
And we have the luxury, as computer scientists
of implementing it ourselves.
So over the course
of the semester you will see various new features
rolling out.
You'll find out over the course of the semester
that the bulletin board is a wonderful place,
certainly in the course of this size,
to turn when you have questions about the problem set,
questions about some computer science concept.
You'll be able to check your grades, download all handouts
in advance of lecture typically will I post the slides,
if you're the type who wants to scribble on notes.
But as you've seen, usually I shy away from long lists
of details and more like pictures of cats
and other visual cues.
So you'll find, too, that we will provide printouts of code
when we actually think it particularly advantageous
to write right on the paper.
Software, videos will be available, usually around 1 to 2
to 3 days maximally after each lecture.
So the courses are being filmed and every lecture will go online
in various formats including QuickTime and MP3's
for downloads to iPods and such.
And also you will find a link
to download what we call the virtual terminal room,
which as you'll see is related to virtual office hours.
Books are expensive and in the computer world also not
that useful.
They are on the shelves of the coop, although we're told
that last year they ordered like 120 books for the course
and 30 were actually purchased, but this perhaps speak
to the fact that there are places like Amazon.com,
so if you are the type who actually enjoys the sort
of support structure that a book provides, if you like to read
up more than say a course's typical materials offer,
by all means, procure one or more of the books
that we recommend here and discuss more
in detail in the syllabus.
But realize there are so many resources
that this course provides in printed form
and electronic form, and my God,
there's the whole internet out there.
Books are not something that are required
for this particular course.
Lectures, in general, will be Monday's and Wednesday's,
except for this Friday and next Friday,
simply because of shopping period and Labor Day.
So we'll meet this Friday, next Wednesday, next Friday,
but there after this is just a Monday, Wednesday course.
So this little visual cue here is to remind me that yes,
we do distribute videos in QuickTime formats, MP3's,
fun ways that you can, if you're actually this type,
maybe in the 14 percent, watch a computer science lecture
on your iPod, but it reminded me that at terms end last year,
the course culminates in final projects,
in which students can design most anything they want,
and we actually had some students tackle some
iPhone applications.
Some one of these at least is now in the Apple store.
It's called Rover.
It's been adopted essentially by Harvard agencies
and it's the iPhone version
of the unofficial guide to life at Harvard.
They did a brilliant job.
I bring this slide up too, just to point
out what other technologies might very well be
down the road.
Some of you may have seen this before,
but just to give you a teaser of apparently what's
in the pipeline, I thought I would offer this brief
distraction here.
[ Music ]
>> With the MacBook wheel, Apple has replaced the keyboard
with a sleek, touch sensitive click wheel.
Apple CEO Steve Jobs introduced the product yesterday
at the annual Mac Expo.
Senior product innovator says the MacBook wheel will make
typing a thing of the past.
>> At Apple our philosophy is create products that are simple
to use and nothing's more simple than a single giant button.
>> Gilman showed me how the revolutionary new
computer works.
>> Gilman: Just open the intuit-type alphabet menu here,
scroll to the letter you need and center click to select it
and click again to capitalize
and repeat this process for each new letter.
It couldn't be simpler.
You could also let the predictive sentence technology
complete the sentence for you.
>> Gilman says the MacBook wheel has also simplified organization
of files, so searching your hard drive will be a snap.
>> Gilman: Just press both sides of the wheel concurrently
and center click and there, you have an alphabetical list
of every file on your hard drive.
Everything is just a few hundred clicks away.
>> Apple is calling the MacBook wheel the most intuitive product
every designed.
>> Here at Apple we like to think
that we're giving customers features they don't even know
they want yet.
>> While the MacBook wheel won't hit the shelves for another 3
to 15 months, many apple users already have it
on their wish list.
>> I'll buy almost anything [inaudible] and made by Apple.
>> Alex [inaudible] was one of the lucky few to get to try
out a MacWheel and spent 45 minutes typing an email
to his friend.
>> I never really realized how much I hated keyboards
until I saw this thing.
>> I like how it automatically says, sent with a MacBook Wheel,
so people automatically know you have one.
>> With a price tag of just under 2600 dollars
for the lowest end MacBook Wheel, it is an investment.
But the super thin laptop features numerous innovations,
like the new ultra thin hummingbird battery,
which can power the MacBook Wheel
for a fill 19 minutes before needing to be recharged
and the computer is virtually unbreakable unless dropped
or hit.
But Apple isn't resting on its laurels,
Bryan Gilman says they're already hard at work
on the next generation of the MacBook Wheel,
which will be four ounces lighter due to its lack
of streaming hard drive or wheel.
For the Ugly news Network, I'm Jeff Tate.
>> Thank you for that, Jeff.
It remains to be seen if the wheel will catch
on in the business world where people use computers
for actual work and not just dicking around.
Moving on, police warn.
>> David: So I've seen that thing
at least a half a dozen times now, including once
at like two a.m. last night and I was scrolling down on YouTube
and literally like an hour prior,
some guy in all seriousness posted, just a wheel?
That's the stupidest product I've ever seen.
[ Laughter ]
And then the rants ensued in the thread thereafter.
So besides lectures there are also sections
and it is your teaching fellow
and the course's course assistants that you will get
to know very well over the course of this semester.
Sectioning won't begin for a week or so's time.
More on that in the lectures to come.
But know that the course will have several different tracks
of sections, much like First Knight's has for music.
Sections targeted more at those less comfortable,
those more comfortable and those somewhere in between.
And we also offer most Sunday nights before a problem set is
due on the following Friday is what we call code walkthrough's
where one of the course's teaching fellows will lead a
session targeted specifically at the week's problem set
and will help you answer the question where do I begin,
how should I approach this?
And that too will be filmed and made available online
and always linked on the course's website.
So this course has a huge staff.
Our staff is larger than Harvard's average class size.
We have over 50 people involved in the production
of this course on a weekly basis.
Some of them teaching fellows who hold sections, grade work,
hold office hours and more.
Course assistants who are former students, who are offering
on a volunteer basis in fact multiple hours of office hours
in the computer lab per week.
System administrators, folks doing all
of our AV and video production.
Someone who will actually be taking notes for you.
So it is actually my opinion that scribbling
down almost every word that someone
like me says is not a very good use of one's time.
It's much more interesting I think to actually engage
with what's on the screen, what's being presented.
And so what we will do as a course is post PDF's online
within a couple of days of lectures of scribe notes,
which is essentially an authoritative version
of course notes, unedited, but documenting what went
on in lecture that day, thereby hopefully freeing your minds
and pencils from jotting information down.
We have some of our team here.
Most of our team is actually shopping courses.
But if a few of your guys would like to come on stage
for a moment with our head teaching fellow
and assistant head teaching fellow.
Allow me to ask the latter to say a quick hello.
And as these guys come up in absentia allow me to say
that also on staff this year besides the folks you see here
are Alex, Alice, Andrew, Batul, Charlotte, Chris, Dan, Dan,
Daniel, David, David, David, Derek, Dev, Didi, Doug, Drew,
Erica, Fil, Glen, Greg, Janice, Jason, Jean, Jeff, Jesse, John,
John, Jonathan, Jordan, Josh, Karim, Kelly, Ken, Kent,
Kyu Bok, Lee, Madhura, Marta, Matthew, Michael, Michelle,
Mike, Mike, Nathan, Patrick, Peter, Peyton, Rose, Saba,
Sanjay, Shannon, Stacey, Ted, Wellie, Yair and me.
So our course is teaching fellows and course assistants,
Cansu and Yuhki, would you like to say a quick hello?
>> Hi. It's definitely a great honor
to be back here for the third time.
And if you're one of those who are like less comfortable.
[ Laughter ]
I think I can [inaudible].
Okay.
[ Laughter ]
If you're one of those [inaudible].
There's no need to be afraid.
I walked in here two years ago with no experience what so ever,
and I thought that I was like dumb and I was sure
that I was going to fail the class.
And I came back for the third time.
I did not fail the class.
This course is great because it has such a good community.
As you can tell by the names listed by David.
All the CA's and TF's are here to help you.
So if you have any questions at all, just come up to us.
Not taking this class because it's hard is not a good excuse.
So, hi.
>> [Inaudible].
>> Hi, so well both as a student and TF,
I've really enjoyed being a part of this course.
And even though it's a course that requires a lot of work
from you, we've put a lot of work in to it for you as well
to make it as enjoyable and as fun as possible.
So, we really hope that all of you stay and take part
in this very special experience.
>> Thanks.
>> David: So you will find, thank you, all of you,
you will meet them in the hallway
in just a few minutes as well.
So you'll find that this course, perhaps more
so than many is very much a shared experience.
This is not a competitive course.
This is not your premed course.
This is a course which ultimately yes is
about doing independent work, as you'll see each week
by way of the problem sets.
But you can't help but to get close to someone
when you're fighting with some bug and banging your head
against the computer screen proverbially to try
to track down some bug.
And I think you'll find that past students will concur
that you exit this course with a lot
of friends among students and also on staff.
So where does that happen?
Well, within office hours in the basement
of the science center there's some large computer labs
and we pretty much take them over five nights a week.
These won't start for some time, and this, to be honest,
is perhaps the most beautiful picture
of the science center I've ever seen.
[ Laughter ]
It does not look like that on the inside.
But it is a place where a good percentage of students do choose
to spend time to get one on one assistance with each
of the week's problem sets.
Each week we will offer more than 100 hours of assistance one
on one in the science center per the schedule
that will eventually go online.
And for those of you who live, say in the quad, or in Mather,
or who just don't want to trek all the way
to the science center to ask that quick question,
we also offer what are called virtual office hours,
much like remote technical support where you'll be able
to log into a glorified chat room, in which yes,
you can type back and forth with a TF or a CA,
but you can also share your screen or share control
of your mouse with them subject to your consent
so that they can help you troubleshoot any problem
or any question you have remotely.
To give you a sense of what's involved in the course,
these are statistics from last year.
So you will, I think it's quite fair to say,
work your ass off in this course.
But per my promise from the start,
this is one of those experiences
that I don't think a typical student regrets.
If you flip through, for instance, the Q Guide forms
that are all on the course's website, you'll find that only
by putting in the time to a course
like this do you really exit having felt
like you got something out of it
and frankly might very well even have emerged even smarter.
So what does it mean to actually write programs
and implement problem sets?
Well, the first problem set last year,
a quick retrospective here,
was to implement your very own programming scratch.
And we spend just the first week there, and the goal is
to implement your own game or animation or art
or anything that appeals to you.
In week one, then do you implement some basic C programs
to get acclimated to some more traditional programming
environments at the command line,
at Linux so you get comfortable with some of these basics
that will certainly serve you well in the long run.
Last year's Problem Set 2 was about cryptography.
We gave students the opportunity to implement some ciphers,
some algorithms that let them encrypt information.
And we also offered some students the opportunity
to do the opposite.
Each problem set, many problem sets,
as you'll see are implemented in two editions.
A standard edition that we expect almost everyone to do,
say 90 percent of the class.
And then a hacker edition, which presents the material
from a more sophisticated angle,
expects perhaps a bit more clever work
for those more experienced,
and for this one did those students get handed
in the hacker edition pre existing user names
and passwords in encrypted form and they had to figure
out what those passwords for.
We actually got into trouble for this a few years ago because all
of the sudden FAS Computer Services saw
like 50 people running a crack program on nice.fas.Harvard.edu,
so they now have been given a heads up for programs like that.
Last year students implemented the game of 15.
Not all that much fun to play as a party favorite,
moving the numbers up down, left, right,
but a real stepping stone
to implementing something interactive
that involves a human and the hacker edition
for this one had students implementing God mode,
which actually solved this thing for the human,
maybe cheat mode is the more apt term, in Sudoku,
which was a step up toward that, where we provided the students,
you, with a framework with a whole bunch of code
that you needed to first understand before taking things
the final mile and implementing some
of the remaining functionality.
And then we dabbled in forensics and this grew
out of a real world experience between me and a friend.
For this problem set last year, this buddy and I,
who he being a particularly good photographer,
strolled around campus and we shot photographs of unique,
non obvious, but identifiable places on campus.
And this was using his digital camera.
All of these JPEGs got stored
on a digital flash card or what not.
And then I accidentally formatting the thing,
or erased it.
Well, it turns out formatting something or erasing something,
usually means neither.
It just means doing a little bit of work
to make the human think their data has been erased,
when in reality it hasn't.
It's just been forgotten.
And so we tasked last year's students with writing a program
in C to actually recover these photos for my friend.
We gave everyone a forensic image, so to speak,
a big file representing that compact flash card, and they had
to recover the several dozen photographs.
And they also had to solve this little murder mystery.
We provided folks with this image here.
Those of you who've seen this before might be doing
that squinting thing right now where you're trying to look
through the picture, well you look pretty awkward,
because this is not a magic eye puzzle.
This is just random red noise
that actually has behind it an actual message.
And it turns out, I think it was Colonel, let's see,
I've got my little solution here.
Last year it was Colonel Mustard
in the study with the candlestick.
And this was the murder message recovered by students
who wrote code to do so.
And then in Problem Set 6 last year.
We challenged students
with implementing the fastest spell checker possible.
What do we mean by that?
Well, we handed the students a big text file containing 140
plus thousand English words, and we said write a program
that loads all of these words into memory, but very quickly
and very efficiently can tell us yea or nay,
is this document perfectly spelled or are there errors?
And what we provided was a testing framework, a harness,
that students, if they wanted to compete, could run their code
against some benchmarks, against some testing programs
that we wrote.
And then, ranked on the course's website from fastest
to slowest were the running times,
the amount of time it took for each student's code
to actually execute, complete opt in.
It's by no means required.
And we took a bullet for the team and made sure that one
of our own teaching fellows intentionally, I think,
was at the very bottom of the list.
So, there was definitely a lower bound.
But the odd, the funny thing was we saw this
in the cue guide evaluation, this problem set of all things,
was apparently the one that people sunk the most time into.
Not because it took any longer than all the other p sets,
but they would come back from like dinner, look at the board,
and realize dam my friend, my roommate just ever
so slightly inch higher than me and so it incentivized people
if only to one up their friends and roommates.
In Problem Set 7, last year, we asked students
to implement their own E*Trade like website, whereby you had
to create a website using
that language call PHP a database called mysql
that actually lets people log in and then manage a portfolio
of stocks, buy stocks quote unquote,
sell stocks quote unquote, get stock quotes.
And from where?
Well, we have the students; we had the student patch
into Yahoo Finance where they grabbed merely the Real time
stock quotes to actually simulate the process
of buying and trading stocks.
Unfortunately some students, perhaps some economics majors
or just folks with too much free time figured
out last year how to gain the system.
So, even though we gave everyone 10,000 virtual dollars,
I think our winner turned teaching fellow this year
actually, right don't push them away make them one of your own,
for a billion dollars something like that ridiculous.
Turns out we weren't really checking whether
or not people were trading after hours.
And it turns out that also, Yahoo stalk quotes are not
in fact perfectly Real time which means
if you just have a real E*Trade account you can see the future
and see where the stocks are going.
[ Laughter ]
So, apparently you can exploit that if you put your mind to it.
and then, in Problem Set 8,
the course's final problem set last year,
we had students implement a mash up where they take Google News
and Google Maps and mash them together using JavaScript,
PHP and SQL in such a way that they had a website
that they could find all of the local news
from whether it's zip code 02138 or 90210.
And, you would actually pull the local current even articles
by this thing called XML and integrate it
into the view of a Google Map.
And then, at very course's end was the true climax
of the course.
This course culminates in final projects,
which ultimately will be your opportunity
to design your very own piece of software, designed by you
or two or three friends.
And the course then climaxes with the new and improved,
with the second annual computer science 50 fair
which last year was an exhibition across the street
in one of the engineering buildings
with 300 laptops atop tables, popcorn was popping,
music was playing, stress balls
with CS50's logo were being thrown around.
And this was an opportunity for our 300 plus students
to exhibit their final projects not only to each other but also
to some 900 attendees in total.
And we also invited some recruiters as well.
So, that is what you have to look forward in this course.
You also have cake to look forward to in the hallway.
This is CS50 and we'll see you on Friday.
[ Applause ]