DAVID MALAN: All right.
So my name is David Malan.
And in fall of 1995, I sat exactly where you're sitting
right now in an economics class.
And elsewhere on campus, I sat in on government, and some mathematics,
and similar related fields.
And the reason for that was that when I got here on campus,
I really just gravitated toward the familiar, the kinds of subjects
in high school that I rather liked and I felt I was good at.
And computer science wasn't even on my radar.
In fact, it wasn't until sophomore fall that I finally
got up the nerve following some friends on campus
into a class called CS50, our introductory course in CS,
that I even got up the nerve to step over that threshold.
And the only reason I stayed in that class
my sophomore year was because the professor let me enroll pass/fail.
But over the next few months I realized that this actually
was a field for me and for so many of my classmates.
It wasn't really something to beware.
It was absolutely a challenge and a lot of work.
But that was at the same time what made it so fun and interesting.
And to this day, I still remember going back to Mather House on Friday
nights when homework assignments were released
and diving in after dinner time into the problem set
just because I liked it so much.
And so after 19 years not really ever finding homework fun
to find that to be the case, I sort of found my way.
And whether you end up majoring in a field like computer science
or really just taking one class, it's just such an empowering field
because you can go back to the arts, humanities,
social sciences, natural sciences, and not only
think a little bit differently about those worlds
but practically solve problems using code or just ideas therein.
And so what I thought I'd do in just a few minutes here
is give you not only a taste of this class called CS50 but also computer
science more generally, which I dare say is probably
more accessible, more familiar to you than you might otherwise actually
think.
And as for CS50 itself, more than just teach you a programming language as
is rather the norm in high school courses,
especially we really do aspire now to teach you how to program
and how to think more methodically.
We introduce you to a language first called Scratch
that you might even remember from middle school.
We spend time thereafter on a language called C, and Python,
and later in the class we end by focusing
on web programming or mobile application development
and using the tools that are inevitably going to evolve over the coming years
but by way of this foundation, even if it's the only CS class you ever take,
you can actually teach yourself new languages thereafter
and keep up and pick up what new topics might arise.
So then what is then CS and who then are you?
Well, according to Les Pass Fall 2022, 2/3 of CS50 students
have never programmed before or taken a computer science class before.
And so indeed if you're feeling like that is not for me,
realize you are and will be in very good company.
And I dare say CS is really just this picture, problem solving more
generally.
And what's a problem?
Well, it's something that's got input and we need output, the solution there
too.
But before we can solve problems, especially with computers,
we just have to decide how we're going to represent these inputs and outputs.
And for instance, if I might want to represent information on my human hand
to take attendance, well, how many people
could I count on my one human hand?
Five.
Very good.
But incorrect, because if I think about this a little more differently,
I could actually count as high as I think 31 on one human hand,
maybe not by counting like one, two, three, four, five,
but maybe if I come up with some kind of pattern, maybe one, two, three--
can't really do the next one because it involves the middle finger
but then it's six and then seven and beyond.
And so how do we get from that simple hand to just thinking
a little more differently about it?
Well, let me propose that we start even more simply with just a light bulb.
Indeed, inside of your computer, your phone, there's tiny little transistors,
otherwise known as little switches that can either be on or off.
And you probably already know whether or not
you've taken a CS class before that computers speak zeros
and ones, the so-called binary system.
But how do we get to zeros and ones to counting
to two, to three, to 31 or even higher?
Well, we can just turn these light bulbs on
and count with a single light bulb, or a single switch, or a single binary digit
or bit from zero, if this thing here is off, to up to a one
if this here light bulb or switch is on.
Well, let's take this more simply than five fingers.
How about three light bulbs?
How high can you count--
knowing that this is now indeed a trick question-- how high can you
count with three light bulbs?
So OK.
So some of you already gleaned that it's indeed seven.
And if you didn't, you're in good company.
Only a third of the audience probably just gleaned that.
But how do you get from three light bulbs to counting as high as seven?
Well, I could very familiarly just turn these on one at a time.
So that's one, that's two, that's three.
But what if I take some inspiration from permuting my fingers up and down
in different patterns, if you will?
Well, then I could say this is zero when they're all off but maybe this is one,
maybe this is two, maybe this is three, and now four, and now five, and now
six, and now seven.
And even if that was a little quickly, take my word for it
that there were seven distinct patterns there plus eight
for them all being off.
Now turns out that this system, even if it's not obvious
why I was turning one on and not the other,
is actually already familiar to us.
This, of course, is the human number 123.
And you just kind of get that by looking at these symbols on the screen.
But that's all they are, symbols that you and I were
taught in like grade school to ascribe some mathematical meaning to them, 123.
But if we rewind some 10, 20 years, this, of course,
you might recall is the ones place.
This now is the tens place.
This is the hundreds place and so forth.
So when you see one, two, three in that order,
we immediately do some mental math of 100 times 1 plus 10 times
2 plus 1 times 3, which of course, is 100 plus 20 plus 3, ergo 123.
And we just kind of do that intuitively nowadays.
Well, computers do exactly the same thing.
And even though they have just tiny little switches
that they can turn on and off, by way of those patterns can
they represent any number we might like.
So here for instance is a three-digit value, just
something, something something, but notice
that those columns, even though your grade school teacher didn't
talk to you about powers and exponents, are really just 10 to the zero, 10
to the one, 10 to the two, and so forth.
But what if we don't give you 10 digits, zero through nine?
We give you just zero or one, off or on?
Well, we can just change the base, so to speak,
to be two so now you have the ones place, the twos place, the fours place,
then eight, 16, 32, and so forth.
And so computers are using the same system as you and me.
They're just doing it with a smaller, simpler even alphabet.
And so here in binary, zeros and ones would
be the number we know as 0 because it's off, off, off.
Here now is one.
Here now is two.
And why?
Because there's a one in the twos column only.
Here now it's three because there's a two and a one that are both one or on.
And now of course four, and five, and six, and seven.
And this invites the question, well, how do we count as high as eight
or what is eight in binary?
Should be 1000 but we need more hardware.
We need another light bulb.
We need another switch.
We need more memory, so to speak.
And so if you keep giving me more digits, more memory, more hardware,
we can count as high up as we might want,
be it 31 using five digits literally here, or maybe even 16, or 32, or 64
nowadays as is the norm.
So how do we represent other things if we have different types of problems?
Well, we could represent letters of the alphabet.
But if we've already decided that everything is numbers,
we need to agree that, OK, we need to represent letters with numbers.
And so it turns out humans decades ago decided
that this pattern of switches, light bulbs, or bits, binary digits,
will represent the capital letter A in English.
What does that translate to?
Well, that's the 64s place.
That's the ones place.
So if we do some quick math, that gives me 65.
And that's just what every Mac, PC, Android phone,
iPhone nowadays has used for now decades.
Well, that's part of a system we know is Unicode.
And it can be used for other things too like sending actual messages.
So here's a chart of all of the English letters, capital, lowercase,
some punctuation, and more.
And if you focus just on this column, notice that 72 is H, 73 is I,
and we started, of course, with 65 being A and everything in between.
So if your phone were to receive a pattern of zeros and ones,
some kind of wireless signal that represents this, well,
that I will stipulate is 72, 73, 33.
So what text message did I just receive?
Apparently, hi.
Now what was the 33?
We'd have to kind of go back here.
And it turns out it's an exclamation point just according to the standard.
And this is how your phone sort of knows what to display.
Now suppose your phone got this pattern of zeros and ones.
This is getting big.
It's roughly four billion.
But that is just another letter of an alphabet.
And it's not the English alphabet in this case but anyone
want to hazard a guess or if you've taken CS50 online might know?
This is a very happy face with tears of joy, which is the most popular emoji as
of last year but you might notice that sometimes this
looks like this on an iPhone or slightly different like this on Android.
And that's because even emoji are just characters
that have patterns of zeros and ones or numbers that represent them.
And much like we have different fonts in the world,
it's up to the computer, the phone, to decide pictorially
how this thing is going to be displayed.
And if we thought about it, it turns out there's
like 64 light bulbs here in Sanders.
And if we treated these as eight distinct groups of binary digits,
I bet we could even spell something out here on the stage for all of you.
Now me and lastly, how might we represent other things?
Well, in CS50, you'll learn how to represent colors of some amount of red,
green, and blue, for instance, how to represent music,
maybe some combination of what's the note, how long do
you want to hear it, how loud do you want to hear it,
so just numeric values too so it's just a system of coding that represents
these different types of values.
So if we just kind of agree for now until September
that computers can represent inputs and outputs using zeros and ones alone,
well, let's lastly look at this black box in between.
How do we actually solve some problem?
Well, one common problem, for instance, might
be this here technology, a phone book.
And in this phone book is a whole bunch of human names, A through Z,
and their corresponding phone numbers.
Now as old school as this is, it's the exact same idea in your phones
nowadays with the Contacts icon of course on iPhone or Android.
And if you think about it, if you ever autocomplete someone's name,
the phone is searching for that person's name alphabetically much like I might.
So how might I do this in the human world
or how might Apple or Google do this in code?
Well, I could start searching one page at a time left to right.
This is a very methodical algorithm, step by step instruction
for solving this problem.
Is it correct?
So technically yes, it is correct, because if I'm
looking for John Harvard, H, well, I'll eventually get to him albeit slowly.
All right.
What could I do a little better?
Maybe two, four, six, eight.
I should probably look down but 10, 12, and so forth.
Is that algorithm correct?
So no.
Why?
I might miss it because if I get unlucky and John Harvard
is sandwiched between two pages but it's twice as fast.
So that's appealing.
So OK.
Worst case, let me just double back if I hit names starting with I instead of H
and then I can at least solve that bug or potential mistake.
And we'll teach you how to solve even more problems than that.
But obviously, back in the day and even now
what Apple and Google and others are doing
when they search digitally is they're metaphorically opening
to the middle of your contacts, looking down,
and of course it's probably the M section roughly halfway through
but what do I know about John Harvard now with respect to this phone book?
Is he to the left or to the right?
So left alphabetically.
And so here in CS50 is where we can tear this problem in half, throw half of it
away, leaving us with maybe originally 1,000 pages, now maybe 500 pages,
and I can do this again.
And oh, I went a little too far.
I'm in the F section.
But I can again tear the problem in half.
Now I'm down to 250 pages.
And we can only do this demo once each year.
But now I can go to 125, 67 or so.
And I have to deal with rounding and silly little issues like that.
But I dare say I can eventually get down to the H page
and call John Harvard at that point.
And if I started with 1,000 and I divide it in half, dividing and conquering
more familiarly, it turns out I can do this in 10 total steps, not 1,000, not
500, 10 total steps.
And that's just a taste then of what you'll learn in a course like CS50
and in computer science more generally.
Beyond that and along the way, you'll see so much of a support structure
at hand and indeed CS50 is distinct in so many
of its supports so many of your classmates
themselves are our own teaching fellows or TFs and course assistant CAs.
And now that everything has been back on campus for the past year, just
like in olden times we've brought back a lot of the community and supportive
events that we've long had.
And so I thought I'd conclude by hitting play on this short slideshow that
will paint a picture of what your predecessors have experienced
this past fall and what awaits you too this fall as well.
This then is CS50.
[VIDEO PLAYBACK]
[VOCALIZING]
SPEAKER 1: (SINGING) You're strolling along
Mass Ave. We're sitting by Widener, rubbing John Harvard's foot,
wishing for the best, praying to the Ivy gods thinking, man, what are the odds
that Harvard is the place I'll manifest?
Now Ivy Day has arrived.
You're nervous as ever, crowding around a tiny screen.
Heart beats as you wait.
[INAUDIBLE] and click.
Congratulations.
You're in.
Oh, this, this could be the start of something great.
Now Visitas has come upon us.
Let's all shop a class.
Who knows what David Malan has in store.
Learning Scratch, JavaScript, CSS, SQL, C, F Flask,
getting free food, who could ask for more?
Next thing you know, fall is here and it's your first P set.
You can't get the Scratch cat to do its little dance.
Oh, suddenly it's Sunday night.
Everyone's in such a fright.
Oh, this could be the start of your next chance.
You're freaking out.
It's week two and you've only just started.
You're actually coding now or so you might think.
You've never done this before.
That's why you can't handle more.
You don't see how you're going to sleep a wink.
Don't stress.
Your TFs are there.
They're ready to help you.
A legion of programmers at your beck and call.
When all of a sudden, you look up and the error's gone,
oh, maybe you can code well after all.
Who knew that coding for the first time would be such a rush, or the first time
you build binary search, or that your first day here on campus
would be a straight flush, and you'd go home with CS50 bucks.
Next thing you know, winter's here and it's the last lecture.
You walk into Sanders and lights start to shine.
Well, how the semester's flown.
Your confidence has grown.
And this could be the start of something.
This could be the heart of something.
This could be the start of something fun.
So fun.
So fine.
[APPLAUSE]
KATIE: Thank you so much.
We are the Radcliffe Pitches, Harvard University's oldest treble voice jazz
a cappella group founded back in 1975.
And it is such an honor to be singing with all of you tonight.
I hope you are all enjoying Visitas, albeit a little bit rainy.
But if you are interested at all in singing,
the Pitches are actually having an open rehearsal later this evening
in Farkas Hall 203.
You can join us and we promise not to make you sing CS50 related lyrics.
Now at this time, I'd like to invite our sibling group, the Harvard Krokodiloes,
on stage to join us.
We hope you'll get a kick out of it.
SPEAKER 2: Thanks so much, Katie.
As Katie said, we are the Harvard Krokodiloes,
Harvard University's oldest a cappella singing group founded way back in 1946.
And we are so excited to welcome you all, the class of 2027, to Harvard.
Now we're going to sing just one more song for you all today.
But if you like what you hear, please feel
free to follow us on Instagram @HarvardKrokodiloes
or check out our TikTok, @TheKrokTalk You can find more information
about our group there.
Congratulations, everyone.
And welcome to Harvard.
[APPLAUSE]
(SINGING) My story is much too sad to be told.
But practically everything leaves me totally cold.
The only exception I know is the case when I'm out on a quiet spree
fighting vainly the old ennui and I suddenly
turn to see your fabulous face.
1, 2, 3,
4.
[VOCALIZING]
I get no kick from champagne.
Mere alcohol doesn't thrill me at all.
So tell me why it should be true that I get a kick out of you.
Some like a perfume from Spain.
I'm sure that if I took even one sniff, it would bore me terrifically, too.
Yet I get a kick out of you.
I get a kick every time I see you standing there before me.
I get a kick though it's clear to me you obviously don't adore me.
[VOCALIZING]
[APPLAUSE]
I see you.
You're standing.
You're there before me.
You're standing before me.
I get a kick though it's clear to me you obviously don't adore me.
Some get their kick in a plane.
Flying so high with some gal in the sky is my idea of nothing to do.
Yet I get a kick, oh I get a kick, yes, I get a kick out of you.
Out of you.
[VOCALIZING]
[APPLAUSE]