DAVID J. MALAN: All right.
So this is "CS50 Explained, Behind the Pedagogy," our first session
of the workshop that's really meant to give you a sense,
as teachers or prospective teachers, a sense of the why we for CS50
do things the way we do, for better or for worse.
Ultimately, the goal of this whole initiative for the past many years
has been to really make available as OpenCourseWare
curricular materials that teachers like yourselves
are welcome to adopt or adapt in any way you see fit.
Indeed, typically, what we found is that if teachers are wanting
to teach introductory computer science or programming or AP Computer Science
principles or any number of variants thereof, they might,
in their first year, especially if new to teaching itself,
might want to adopt some of the course's or all of the course's curriculum
in some way and really serve the role more of a teaching assistant,
leaning on us and our videos and our homework assignments, a.k.a.
problem sets, while they walk around focusing their most precious time,
the human time, on their own students.
And then, perhaps, as they get their footing,
or if you've been teaching for many years,
you might instead pursue more of a model of adapting the course,
like any good teacher might when seeing someone else's materials,
and make it your own and integrate it into your own classes as you see fit.
What I thought we'd do, then, this morning here in Cambridge
is just give you a sense, then, of the why behind the course's pedagogy
and also just give you a few building blocks
if you're only somewhat familiar with CS50 and its offerings,
or perhaps familiar only from the perspective of being a student of sorts
yourself, having taken the class.
Along the way, please feel free to interject
with any questions via the chat that I or any of my colleagues
here can answer.
Or if you'd like to raise a virtual hand in Zoom,
we'll do our best to keep things interactive.
And then we'll take and leave time for a good break at the end
and then resume with our second session thereafter.
So a cursory glance at the history behind this class,
if only to give you a sense of why it combines the topics it does-- here
at Harvard, for the past many years, there
was this branch of courses starting with Engineering Sciences 100, Applied
Mathematics 110, and then, finally, Computer Science 150,
when computer science finally became a term,
academically, that described a whole field.
But this was an evolution of a particularly arcane set of classes,
if you will, particularly for those who wanted
to pursue what originally was called engineering,
was eventually called applied mathematics, and now, of course,
is called computer science.
But it was fairly technical for the particularly initiated-- the already
initiated.
Then, at Harvard, too, some years ago, there
was a different branch of courses, if you will,
starting with a well-known course here on campus
called Nat Sci 110, Natural Sciences 110, which eventually evolved
into a course called Applied Sciences 10,
and then eventually Quantitative Reasoning 20.
And this was more of a path for the uninitiated, those less comfortable,
who wanted to know something about computing and programming, ultimately,
but didn't necessarily think they were going to major in the same.
And then, eventually, Harvard, as a university,
rather started to merge these two tracks in a sense.
And we had Applied Sciences 11, Computer Science 11, and now
what we're here today to talk about, a course known as CS50.
And that all began back in 1989, which was the first year of CS50
being offered here on campus.
And it was and is our introduction to computer science and programming
but now for majors and nonmajors.
And that's perhaps the key characteristic
in that it does try to serve both of those audiences.
And you'll see today and tomorrow via what curricular means and pedagogical
means we aspire to do so.
As it turns out, I myself happened to be an undergrad here some years ago,
and in 1996, as a sophomore, took this same class.
As I tell students at the start of our own course,
I was a government major at the time.
I had gravitated from the get-go at college toward the familiar.
I rather liked history and constitutional law, especially
in high school.
And so I figured, well, you major in college
what you seem to like in high school.
But it wasn't until sophomore year that I got up the nerve, the courage
to just put my toes in the water and to step in on the first class of CS50
in September of 1996.
And, long story short, I was hooked.
As I tell students today it was the first course,
and really, the first field where--
not to sound too cliche-- but homework was fun.
I had somehow gone 19 years of being a good student, focusing on my work,
but not particularly describing school or homework as fun.
But when I discovered computer science, and particularly programming for me
early on, something clicked.
And as I tell students, I would go back to my dorm at, like,
7:00 PM on a Friday night, which is when they would officially post the homework
assignments, and that's how I would spend my Friday night well
into Saturday.
And, for me, that was a sign--
changed my major to computer science.
And, ultimately, that's what motivated now, really,
a lot of my interest in, daresay passion for trying
to create, whether it's in computer science
or any other field for students, that sort of discovery
and that encouragement to explore outside one's own comfort zone.
So fast-forward several years later, after finishing college and then
graduate school in 2007.
I was rather in the right place at the right time
and had an opportunity to take the helm of this same course as its instructor.
I was meant to fill in for just a year, after which the course would
be taught by someone else.
And somehow or other, that was, like, coming up on 16 years ago.
And so this will be version 16 of the course since 2007.
And nowadays, in healthy times, it's indeed one of Harvard's largest courses
here on campus.
So this is a photograph of one of the most beautiful spaces here
on campus, Sanders Theatre, so to speak, with a whole lot of students back
in healthy times and me down here about to talk about computer science.
And we hope, of course, to return to that kind of norm this year and beyond.
But that is to say there's been a marked increase in interest here,
and certainly elsewhere in the world, in computer science and programming.
And so, really, what we'll focus on today
is the support structure and the pedagogy
that we've tried to build up over time.
The course, as I alluded to earlier, has, since 2007, also
been freely available as OpenCourseWare under what's called a Creative Commons
license by NCSA, which means that anyone is welcome to use the material as they
see fit so long as they attribute it by CS50,
so as long as it's for noncommercial use,
and so long as they, too, share their materials, be it videos or PDFs
or adaptations thereof.
For more details, Carter, if you wouldn't mind pasting a URL
like this in the chat.
Now, in 2012, it's worth noting that we had an opportunity
to not just put material out there in the spirit of OpenCourseWare.
But 2012 was when this MOOC craze--
Massive Open Online Courses, rather-- begun with Coursera,
then edX, and a few others as well.
And this was an opportunity for us now to focus not just, of course,
on our own campus, on campus students, but, really, anyone
online who might like to learn but learn as actively as possible.
For many years, we had put our videos, our PDFs, the assignments,
and so forth on the internet.
But if a student on elsewhere in the world online
didn't have a Harvard University login account to connect to some Linux
or Unix server here on campus, the onus was on them
to figure out how to install a compiler, an interpreter, or a debugger
on their own Mac or PC-- doable, but not necessarily doable by many students who
don't yet have that footing and might otherwise struggle with "hello, world,"
let alone just trying to configure things like your path
and your terminal window and the like.
And so we began to focus in 2012, too, on really making
tooling and software available for students and teachers
alike to eliminate a lot of that complexity
so that they could focus truly on the curriculum
and less so on the mechanics of just getting requisite software set up.
And so thus was born what we now call CS50x, which is essentially
the OpenCourseWare version of the class, typically targeted
at university or older students.
But it is exactly the same curriculum technologically
and curricularly as the course here on campus.
Students, of course, on campus have access
to additional support structures, like human teaching assistants or TAs,
as you might find in universities typically.
But otherwise-- curricularly, technologically-- everything
is exactly the same.
And Carter has kindly pasted this, and Carter, if you don't mind,
some of our upcoming URLs as well.
CS50 has generally steered in the direction of existing online platforms
for bringing people together.
And so if you go to this URL here, you'll
see any number of CS50's online communities--
Facebook and Reddit and Stack Overflow and Discord and the like--
where we've rather tried to bring the course to the students to decrease,
rather, the transaction distance, so to speak,
between them and asking and answering questions as opposed
to focusing on walled gardens or proprietary tools that
might require the activation energy to come into the course.
Rather, we've tried to bring folks to it.
And we've also tried to focus, in recent years since 2012, again,
not just in putting curricular materials out there for folks to use,
but trying to incubate, encourage, foster, really, in-person communities.
The real opportunity at hand, whether with teachers formally in place
or just students who want to learn together,
is to try to bring them together as humans.
And Zoom and other technologies have certainly
accelerated this trend online.
But we have also focused, in healthier times, and hopefully, this coming year
and beyond, on helping incubate in-person communities, be it
at high schools, middle schools, universities, nonprofits,
community groups, or the like.
And so just to paint a picture of some of your predecessors, if you will,
or perhaps some of you here, here is one of our groups
in healthier times at Miami-Dade College,
led by one of our faculty member friends there.
And these are students holding proudly their CS50 certificates, so to speak,
at term's end.
Here are some students in healthier times from London,
when we held, with University College London, a so-called CS50
hackathon that drew people together to work
on their code and their final projects.
Here are some of our students in India working on something called CS50x
Puzzle Day-- more on that in a bit-- bringing students together as well.
Here in Myanmar was a student who actually
organized this many of his classmates to teach CS50 or introductory programming
more generally to some of his own classmates.
Here, after a CS50x Puzzle Day, are students in Pakistan.
Here are students after the same in Egypt.
Here are some of our students before the same in Congo
about to tackle these printouts of puzzles.
And here are some of our friends who have
been especially in our thoughts in recent months in Ukraine as well.
And these are just some of the communities
that have been incubated over time.
But this has, I think, been a very deliberate charge on our part
not to just put curricular materials out there, but,
again, to try to bring people, teachers, and students alike
together in the form of these more traditional in-person support
structures.
You've heard me allude now to CS50 AP, which
is a bit of a deliberate misnomer in that it isn't necessarily
an AP or advanced placement version of the course,
but really an adaptation designed for high schools and middle schools alike.
Its release coincided with the creation of AP Computer Science
Principles, with which some of you might be familiar
here in the US or also abroad.
And CS50 is one of the endorsed curriculum
providers of that same framework.
But CS50 AP, when we say it, really just refers
to a high school or middle school, a younger audience
adaptation of the same course that also happens to satisfy those requirements.
But it's an offering typically that is designed
to be spread over not maybe 12 or 16 weeks in a typical US semester,
but maybe 32 or 36 weeks over a typical US school year.
With that said, at its inception, CS50 AP here, which has,
again, the same curricular materials as CS50x itself.
Here's an early snapshot of all of the high schools
and universities and others that were working with us at the course's debut.
Every circle in red represents a high school
with which we've worked in the past.
Every blue represents a university.
This now is several years old.
But this, too, was an opportunity for us to try
to bring people together as well.
And I wish you and I were literally on that same stage right now.
This is a photograph of one of our earliest cohorts
of teachers at our very first CS50 educator workshop here at Harvard.
Hopefully, health circumstances permitting,
we'll be able to hold this same workshop both in person and online next year.
But these are some of our teachers with whom we got to meet
and the original network of teachers that began via this whole initiative
as well.
And in healthier times, too, did we focus on the students as well.
Margaret, whom you met earlier, kindly helped
us coordinate with a few other teachers in New York, public and private,
a CS50 hackathon.
Unlike our university hackathon, which tends to start at 7:00 PM
and end at 7:00 AM the next day, this was our first 10:00 AM
to 2:00 PM CS50 hackathon-- a little more high school
and teacher and parent-friendly-- that just brought students together
from five different schools in the area to work on their problem sets,
to attend some stand-up workshops and the like, and generally just have fun
learning and asking questions and solving problems,
all within this domain here of computer science.
So at the risk of overwhelming, just to give you the lay of the land,
but the whole goal of today and tomorrow is to just give you
a sense of what is available to you.
It is not the sort of menu via which you must choose
a little something of everything.
But just to give you a sense of what now exists, one of the FAQs
we began to receive shortly after the course launched in 2015, especially
in the form of AP for high schools and middle schools,
was, OK, I've taught this course now to my first-years or sophomores or maybe
seniors.
What now, at least for those younger students?
And so in recent years have I and some of our colleagues here at Harvard
began focusing on other curricular offerings as well,
all under the CS50 umbrella.
And so while you've had the whirlwind tour of the history, where
CS50 was the course that existed as of 1989 and ever since, now
we use that same moniker with suffixes to describe other curricular
offerings that assume either as background CS50 itself
or assume as a next step CS50 itself.
So here is the current list of all curricular offerings--
CS50x, which, again, is the online university and adult
offering of the same; CS50 AP, which is that for younger audiences.
But thanks to some of our amazing colleagues
here do we now have CS50AI, which is an introduction to artificial intelligence
with Python specifically.
It's indeed more software-centric than it is mathematically-oriented.
It introduces students to any requisite mathematics they need,
but it's not a theory course as much as it is a software course.
CS50B is computer science for business professionals, something
for students in management school or the like
who just are interested not so much in the lower-level implementation details,
but rather how you can leverage technology in business
or just make more informed decisions.
CS50G, introduction to gaming development
that uses a language called Lua that allows students on their own Macs
or PCs to create their own two-dimensional, and then, later
in the course via Unity, three-dimensional games as well.
CS50L for lawyers-- computer science.
This is similar to B but targeted specifically
at the legally-minded folks out there, paralegals and the like,
who want to explore the intersection of computing
with law in particular-- issues of security and privacy,
intellectual property, and the like.
There's a similar backbone among many of these courses.
But their focus tends, then, to vary.
CS50P, which is hot off the press, so to speak-- an introduction to Programming
with Python specifically.
We go all the more into detail on the syntax of Python, the features thereof.
We stop short of any topics that really are, and daresay belong in CS50, a.k.a.
CS50x or CS50 AP, which is a proper introduction to computer science.
So while we might take for granted in CS50P
that there's a function that sorts for you, it's in the original course,
CS50 itself, that we actually pull the lid off of sorting and searching
and algorithms and data structures more generally.
So CS50P is very much focused on programming itself
and is designed now to be a course that students
can take before or during or after CS50 itself,
as either additional material or perhaps preparatory material for the same.
CS50S, perhaps for your younger students or less comfortable students,
is an introduction to programming with Scratch, the graphical language that we
ourselves use in CS50.
And just the first week of the class, this
is a version of an introductory course that you might take three weeks, maybe
even six with your younger or older students,
to go through at a slower pace but with a higher ceiling
as to what they can then do with Scratch itself.
CS50T is an introduction to understanding technology.
So it's similar to CS50B, the business class, similar to CS50L, law class.
But it focuses more on consumer-type technologies--
how the internet works, how your own Mac or PC works-- and uses
some of the shared backbone but focuses, really,
on folks who aren't necessarily business or law-centric
but more generally using technology.
And then lastly but not least is CS50W, a course
on web programming with Python and JavaScript
that's meant to, like many of these, pick up where CS50 leaves off
and be a second course, be it for students in high school or university
or folks in the real world, to dive in more deeply into web programming
specifically, assuming as prior knowledge CS50 or some similar course
as well.
Carter, I think, no need to copy and paste all of these links.
But if you have the URL of these slides--
which, maybe, Carter, it would make sense to paste the URL of this slide
into the chat-- you're welcome to click on each
and every one of these links, which will lead you
to the free OpenCourseWare curriculum of all of these same courses in one place.
And I'll note here that characterizing all of these classes,
but especially the original class, CS50 itself, are really these two themes.
And in fact, after one or two or three years of teaching,
I began to reflect on what I was actually doing and why.
I daresay that, first year of the course, second year of the course,
I was just focused on keeping my head above water.
And it's only in recent years that I've really
noticed themes in my own approaches, for better or for worse,
to teaching the class.
And I daresay two of them are really this, accessibility and rigor--
sort of lowering the floor, so to speak, metaphorically,
for students to make it easier for them, similar in spirit to what
I hope to do back in 1996, just put a foot in the door
and get some exposure to CS, but simultaneously preserving what
at least here on campus has been a historical rigor
so that the returns, so to speak, of taking this course
are especially high for students.
And it's a particularly immersive, it's a particularly intensive experience.
But hopefully are the returns all the more proportional as well.
And so I daresay students taking this course, CS50, off campus,
be it online or locally elsewhere or through high school,
where you don't have the constraints, temporally, of 12 or just 16 weeks,
but you indeed have 32 weeks at your disposal,
maybe even 52 weeks in total--
that, I think, is indeed the enabling technology.
This isn't a Harvard course per se.
We are just confined by the traditional model of a semester.
I think, really, the key ingredient for students of any academic or curricular
background is just to allow themselves sufficient time.
And so that's a knob that we generally recommend
folks turn rather than jettisoning material or making things easier
and chipping away, therefore, at these primitives, the second one,
of rigor in particular, just allowing and structuring, perhaps,
your own classes to just give students more time-- instead
of one week for a given problem set or homework assignment,
perhaps two or even three, and as Margaret
might address in her experience, and our friend Douglas tomorrow
speak to their own experience with turning these knobs
and adapting the material as they see fit,
as might be best for their own students.
This, too, was a key curricular design early on here on campus, at least,
where we had within the same class, CS50, different tracks, so to speak.
We, like a lot of universities, have a model where we have weekly lectures.
So I will lecture once a week to all of the students in the class,
presenting the week's concepts and really setting
the stage for the week's assignment.
But our teaching assistants, who are typically
undergraduates themself who've taken the class and perhaps others in CS,
they then lead sections or recitations for maybe 12 to 20
or 30 students in total, generally on campus,
but for our online extension school students or adults
through continuing education, via Zoom as well.
But we've typically, on campus, had different tracks of these sections
or recitations for those more comfortable, those less comfortable,
and those somewhere in between.
And we just ask students to categorize themselves
at the start of the semester.
And we tell them, you're more comfortable
if you've been, in fact, programming since you were six years
old or the like, but maybe you don't have a formal background
in CS or programming.
And that's why you're nonetheless taking a formal introduction thereto.
You're among those less comfortable if, like me in 1995,
you didn't even consider taking the class.
Or you have one foot in the door and the other one
still out the door because you're not sure
if computer science or programming is for you.
And if you're not really sure where you fall,
we assure students that they're just somewhere in between.
So we have three different tracks that generally offer students
the same introduction to computer science but at a different pace.
And the teaching assistant leading these tracks might
speak to students at a different level, allow the conversations, perhaps
if more comfortable, to go all the more down a detailed rabbit hole,
or, at least, pumping the brakes, perhaps, for those
less comfortable to make sure everyone is comfortable on the same page.
I'll note, though, that in recent years, as the course has grown in size
and as the demographics of our student body have changed,
we were actually motivated this past year to introduce a fourth track,
if you will, for those euphemistically least comfortable,
who really need some additional support not just with taking the class itself,
but perhaps just with college.
Perhaps they didn't have the strongest high school or middle school
background.
They don't necessarily have the instincts,
or they didn't have the high school that trained them
to take advantage of the online resources
and the professor's office hours and the like.
And so in this particular track for our university
students do we also just help them structure their days,
structure their time so as to be successful in college,
because CS50 here on campus has actually gotten younger over the years.
We used to have a plurality of sophomore, second-year students.
But over the years, students have started taking the course more and more
as first-years, which means ours is the first of maybe four classes
they might take ever in college.
And so the onus has come to us to be all the more supportive of them just
getting their footing on campus.
It's also been important, if you know CS50's curriculum,
that we introduce, in my mind, different languages to students.
Back in the day, in 1996, when I took the class, it was a course in C.
And the vernacular on campus was, I know how
to program in C because I took a course in C.
We eventually introduced, though, other languages into the same course.
And nowadays, we start with one week of Scratch.
We then have several weeks of C, which is still
the backbone of the course as introduction to programming.
And then we have a few weeks of Python, added to that some SQL and JavaScript
and the requisite HTML and CSS so that for many students,
CS50 is designed to be either a foundation
in computer science for further studies in a traditional way,
but also a terminal class for about half of our students,
whereby we know a priori that half of our students
are not going to take another CS or programming class.
And we want them to have not just that foundational mental model
for solving problems with technology, but also the practical skills
to bring back to the arts, the humanities, the social sciences,
or the like, so as to solve real-world problems even with just a semester
of computer science under their belt.
And so our goal with these various languages and the intensity
of the course is so that students exit the class with a mental model of, I
learned how to program, period, as opposed to,
back in my day, what would have been, I learned how to program in C.
To be fair, we focus on procedural programming.
It's in other courses that students here at Harvard
tend to learn a bit more object-oriented programming, functional programming,
although we touch on briefly some of those topics.
We hint at them when we introduce languages like Python and JavaScript,
which lend themselves to some of those chats.
So I thought it might be fun, or helpful, perhaps,
to share the few vignettes of curricular content from the course itself.
Some of you might recognize these scenes or similar.
I took a few screenshots or photos from our lectures two years ago.
To be fair, I should qualify this as this was the first year of COVID
in fall of 2020.
Everything here on campus was shut down, and almost everyone
was, therefore, online, except us.
We had this a wonderful silver lining opportunity
to collaborate with a theater here on campus whose staff was otherwise idled.
And so what you're about to see is admittedly
a grand implementation of visions that I've had for 15, 20 years as a teacher.
But when it turns out when you have a prop shop behind you in the theater,
and talented artisans who can build things out
of wood and electricity and the like, you'll see some examples of curriculum
that we brought to life.
But every one of these examples have I done
in yesteryear using a scrap of paper that I brought with me or a Sharpie
on the board or the like.
There are lower-budget versions of each of these demonstrations as well.
But the goal, really, of each of these vignettes
is to paint a picture of why, in CS50, we, or I personally,
spend so much time teaching something like linear search, which maybe we
could get away with just a few minutes of a description,
maybe a drawing on the board or a few slides.
But instead, we might spend 15 or 20 minutes
inviting students in healthy times up to the front of the class
to demonstrate something with me, bringing in props
and creating all the more visuals.
The goal in my mind, just as a teacher, is
to not just get through the course's curriculum
and say the words or the topics that we want students to learn, but to create
these memorable moments, spending perhaps an unusual amount of time
to create those things they can latch on to mentally, even for years, that
help them orient some arcane topic in the practicality
that it actually offers.
So you might recognize something like this.
I, at least, have been a fan since 2007 of talking about binary using lights.
Back in the day, I used some desk lamps that I found from IKEA.
Nowadays, I might have a few students come up
and turn on the light bulbs on their phone.
Turns out when you're in a proper theater,
you might have dozens of light bulbs right in front of you, literally,
on the stage.
And so here is an opportunity where I introduced students
each year to the concept of binary, but really representation of information,
but rather bringing it to life visually by turning and turning off light bulbs.
A goal I had had for 14 years, that first year of COVID when
we were in this theater, was to actually do searching with physical doors,
to be able to walk up to it, open the door, and look for something behind it.
I didn't really have access to seven or eight
or more doors in our typical classroom in healthy times.
But thankfully, what you're seeing here is seven doors
from seven different plays that had used doors with their actual sets
back in healthy times.
Our friends kindly got these all out of the warehouse
and brought to life here me searching for the number 6.
We went all out-- or, really, our friends and artists went all out.
And we didn't just put a number 6 behind the door.
We put a fuzzy number 6 with googly eyes behind it
as well, really, just for fun and to bring this to life.
Mind you, too, I was the only one really in the room,
other than colleagues running our cameras and such.
All of our students were actually, this particular year, watching online.
But here you see, for instance, all of the numbers randomly ordered
behind the doors.
Linear search is the best you can do with this demo.
We then do a subsequent demo where a colleague secretly
sorts all of the numbers behind the closed doors.
And then we do it again with something like binary search.
Now, with this said, I don't have access to seven doors
anymore in our more traditional classroom.
And so I sort of revert to just grabbing something like a whiteboard
and pieces of paper and drawing with marker or chalk each of the numbers
I have in mind, covering them with some scotch tape and paper,
and then treating those as the door.
So here, too, is an example of how, back in the day and now,
do we do things, really, with the accessories we have on our desks
and in our cabinets.
This is a colleague of mine, Brian Yu, who teaches, in fact,
the AI class and web class we mentioned, where he and I were not
allowed to be in the same room in 2020 while teaching unmasked.
But here are some plastic numbers that we found here on Amazon
by searching Amazon for "plastic numbers," just to bring to life now
the actual sorting of numbers.
And so thanks to these shelves that we found in back
was Brian able to do something like sorting,
be it with merge sorts or the like, and actually give
a visual to that as opposed to just using PowerPoints or the like.
In CS50, we, of course, use C. And C has,
for better or for worse, pointers and memory management.
And you and I often talk about pointers in the context of addresses
or maybe even addresses on mailboxes.
So it turns out when you have a prop shop, you can actually use mailboxes.
So here, for instance, was a variable P representing a pointer.
And when I opened up that mailbox, I found inside of it
the address of some value--
0x123, for instance.
Brian, in the other room, of course, had the mailbox at address 0x123.
And inside of his mailbox was the value, once dereferenced, that we found.
So this, I daresay, is doable on a more modest scale
if you have a local Home Depot or hardware store or the like
to get some inexpensive mailboxes.
But this, too, was an example of just something we wanted
to create memorably for students.
We have another example that he and I tag
team where, when we talk about variables and something simple like swapping,
we typically invite a student on stage-- or, in this case,
Brian-- to just swap the value of two variables.
Those values, in this case, were represented by two glasses of water
with some food coloring in them so they'd stand out on camera--
orange and purple in this case.
And then I sort of playfully, since Brian's in on the joke,
ask him to swap the two values.
And it's not a matter of swapping the glasses.
I wanted the purple liquid in the one glass and the orange liquid
in the other, which, of course, you can't really
do unless you introduce, of course, a temporary variable, at least
using traditional means and not something fancy like bitwise operations
or the like.
So here we had just a way of bringing to life
why students, when they need to swap values, which becomes
germane quickly when we start talking about sorting
and moving things around in array, hopefully
a memorable moment they can latch on to.
We talk later in the semester about, as well, hashing.
And here, for instance, is me with some jumbo playing cards, also found
on Amazon as jumbo playing cards so that they're not this big but this big.
And this is me bucketizing them, literally,
with four buckets, each with a suit from a deck of cards,
and me just figuring out how to hash each card into the diamonds bucket
or the hearts bucket or the like.
So then, I can at least create four collections of size 13 instead of 52
and then maybe sort each of those individual buckets.
I have a habit of wearing today--
and really, always-- black T-shirts or sweaters.
Well, I realized at some point that this would actually
be kind of a fun way of introducing stacks and explaining, perhaps,
that the reason I always seem to wear black
is because my stack of sweaters at home looks, of course, like this.
And every time I do the wash, I just put the new sweaters back on top.
And even though I own a blue and a red sweater,
if you keep pushing onto the top of the stack but never exhausting the stack,
you're, of course, going to reuse and redress in the same way.
Back in the day, when I in college took a course on databases,
this was not done physically but just verbally.
But it stayed with me nonetheless, this idea of locking a database,
be it with locks or nowadays with transactions.
And so it turns out when you have colleagues who work in a prop shop,
you can just ask them to bring out the old-school fridge.
And we use this in CS50 to talk about issues of databases and concurrency
and not wanting to have two different users see
two different states of the same variable,
and therefore, make incorrect decisions.
So it turns out, when you have an actual refrigerator on stage and a padlock,
you can lock the refrigerator, the metaphor here being,
what happens if I have a refrigerator in my home and my roommates
and I both, a few minutes apart, open the fridge
and realize, wait a minute, we're out of milk, close the fridge,
and then go to the store?
The next roommate then comes in and makes that same decision
based on a now-misleading state because my roommate doesn't
know that I've gone to the store.
So what happens?
He too closes the fridge, goes to some other store.
We don't bump into each other in this story.
What happens then?
We get back to the apartment, and boom, we now have two gallons of milk.
And that's not going to last long.
That's going to spoil before long.
And so we've got a problem.
But we would not have that problem if I instead
locked the refrigerator, much like you might lock a table or a row
in a database.
And then one last visual here toward the end of the CS50 semester--
we introduced students to a bit of JavaScript and a paradigm
like asynchronicity and callback functions.
And so this is me on an old-timey phone calling Brian,
asking him, like, what the weather is.
He didn't know when he picked up.
So he hung up the phone, went outside to check the weather,
and then he called me back on that old-timey phone.
And I then picked up some number of seconds or minutes later,
thereby demonstrating, in this case, the example of a callback function
that's particularly germane again in the context of JavaScript.
So separate from these curricular memorable moments
and these demonstrations on stage, we also do a lot of live coding.
And whether you've taught or not taught before,
you might have a different approach to this.
But I daresay it can definitely be nerve-wracking and perhaps
something, even, to avoid.
And I will say I myself rather split the difference where I do
think, pedagogically, there's value in doing live coding as opposed to just
walking through static slides thereof.
I do admittedly think there's value in screwing
up in front of your roomful of students, ideally in a way
that you can figure it out within a few awkward seconds or minutes.
But that, too, of course, has value.
And I do try to generally split the difference where I, for instance, might
take code like this.
So, for instance, I'll pull up this URL myself if, Carter, you
wouldn't mind copy and pasting it, too.
This is just an example, for instance, of what my own approach to week one's
lecture in CS50 might be.
I've got a whole folder here called, by my own convention, src1, that just
has a whole bunch of demonstrations.
And these demonstrations are generally named
in a way that describes what it is I want to demonstrate, not necessarily
conceptually or curricularly, but functionally,
like, what does this program do just, so I and a student can find the demo they
vaguely remember later as well.
And I tend to do this.
As you can see from this calculator example,
I tend to have calculator 0, 1, 2, 3, 4, which
is really a set of five progressions.
And this is really a cue to myself that, when I live code,
I want to first implement for my students version 0.
And then we might have a quick discussion of the same
because version 0 is usually correct but just not very well implemented.
It might be messy.
It might not decompose lots of code very well.
There's opportunities for improvement.
And yet by checkpointing myself with, then, version 1, 2, 3, 4, and onward,
I then sort of redo or relive code the same.
I do admittedly, behind the scenes, always
have a very old-school technology next to me,
including, right now today, which is paper.
If you're curious, or if this might be helpful, just one of CS50's tools
is this tool here called Render50.
There's both a command line version and a web-based version.
And this is just a program that facilitates
generating landscape-mode, syntax-highlighted PDFs of source code
you've written in advance.
And to this day, even though I have all this technology in front of me,
this is my comfort blanket because I can always
rely on having an answer for myself or a next step,
even though I do sometimes diverge from that same script--
so just to give you a sense of, how I personally
walk the line of doing live coding but not in a way that
gets me into unrecoverable problems?
And the problem sets themselves-- this is
our nomenclature for programming assignments or homework
assignments, a.k.a. problem sets.
And a problem set literally might mean that.
It might mean, early in the semester, the problem
set for students has three or four smaller problems to solve.
Maybe, later in the course, a problem set
has just one problem for them to solve.
But these are really just our homework assignments here.
And I thought I'd share just the process by which I and now some
of my colleagues, among them Carter and Brian,
go about creating these homework assignments.
And in my mind, too, I have always tried to avoid using or creating problems
that you might typically find at the end of a textbook,
the end of a chapter, which are fairly mundane,
fairly uninspiring problems that absolutely have value when it
comes to the mechanics of programming.
Maybe they touch on some topic specifically.
But in general, our approach in CS50 and all of our classes
now has been to find some idea, some application,
some domain that we can use to inspire the problem
and then use that as a pivot to the underlying implementation details
that we really do want students to glean.
So, for instance, I think the very first problem
set I wrote for CS50 back in 2007, give or take,
would have been this, a program we call Mario.
This is not what students implement for Mario, though.
But this is a screenshot from the original Nintendo Super Mario Brothers
game.
But I did notice at the time--
well, this is kind of an interesting pattern, this pyramid-like shape.
And if you're using a language like C or most languages that generally print
on the terminal window from top to bottom, left to right,
this is actually maybe a little nontrivial.
It'd be a lot easier if the pyramid were this way because then you could
print one brick, then two, then three.
But here you have to somehow print out all of this empty sky.
So this inspires one of CS50's first problems that still,
to this day, which is to have students create, using C and a terminal window
only, none of the colors, none of the Mario or pipe,
but just pivot from this picture to implement, using hashtags,
these individual bricks instead.
Later in the class, we happen to draw some inspiration
from the world of imagery, if not forensics or steganography,
the art of hiding information.
And if you kind of look at your Zoom screen just right, perhaps,
or tilt your laptop, you might kind of see that this isn't all just red noise
with white dots as well.
There's some cyan in here-- some light blue, essentially-- wherein there's
a secret message.
And so for this problem set, we have students
inspired by what I remembered from my childhood
being something that looked like this in a cereal box
that also came with those red glasses that
puts red plastic in front of your eyes that somehow reveals a secret message.
So we have students in CS50, using C in this case,
implement the equivalent of a red filter so
that when they put on those glasses metaphorically,
or run their now-program, they see this.
And if you grew up playing Clue or Cluedo,
it was Professor Plum in the lounge with the candlestick this particular year.
But there, too, this is, again, a problem that, really, like Mario,
is maybe a couple of loops, iterating from top to bottom,
left to right-- so some basic mechanics of procedural programming,
but inspired, ideally now, by an idea that students can latch on to,
or something that just packages it in a way that inspires.
Most recently, Carter and I and the team have
been working on a course called CS50P, this introduction to programming
with Python.
I'm a big fan of Seinfeld, even though the older I get,
the fewer my same-age students seem to this particular show.
So we're finding new shows.
But there is this scene here where Kramer, if you've watched this show,
goes into a bank.
And the bank is having a promotion where,
if you are not greeted with a hello, you receive $100 from the bank.
He goes into this bank, and the teller says something like "hi"
to him instead.
Kramer demands his $100.
But the banker says, "No, no, I greeted you with hi.
But hi is not hello.
So some hilarity ensues.
And, long story short, it occurred to us, well, wait a minute.
Why don't we have students write a program that
prompts the user via standard input for a greeting.
And if that greeting starts with--
is not a hello, we print out $100 they're owed.
But if it starts with an H, which was the eventual compromise,
they should print out $20 instead, like Kramer got.
And if they print out anything else that doesn't start with an H or isn't hello,
well, they get printed out $0.
So here this is actually early on in CS50P.
It's really just a prompt to get input.
It's an if-elif-else kind of construct, and that's it.
But here, too, we try to package it in a more fun way.
And these URLs, too, will lead you to the particular specifications.
There's another problem on CamelCase converting between it and snake case,
so to speak, to help students realize that there's
different conventions out there.
There's a problem set where we have students implement a very, very
lightweight version of a deterministic finite automaton, a DFA,
or, really, just a soda machine that somehow maintains state with a variable
and keeps track of how much coin a user has virtually typed in in order to say,
yes, you're now given your Coke.
Drawing inspiration from the first tweet ever on Twitter,
which was this from Jack Dorsey-- "just setting up
my twttr," which was its nickname early on,
you'll notice there's no vowels in this word.
So here the pivot for us was prompt the user for input
and strip out all of the values.
So Twitter becomes T-W-T-T-R, but do this for any word as well.
In Massachusetts, you can get a so-called vanity plate.
But there's actually almost an algorithmic definition
of what the rules are for what letters you can use and numbers
and in what order.
So we have students implement something that will validate
an actual Massachusetts license plate.
We have students take a look at something they might see on their car
or their parents' that has, of course, fractions.
And we use this as an opportunity to have students type in a fraction using,
in Python, some try and some excepts, actually parse that fraction,
printing out the equivalent percentage, or, if it's
close enough to empty or full, E or F, respectively.
There's a very popular place down the road
called Felipe's Taqueria here in Cambridge that we hope,
if students ever visit Boston, they might visit as well.
But that's a great demonstration for now grabbing a whole bunch of menu items,
like the burritos and quesadillas and others that they have on the menu,
and using a Python dictionary to map those menu items to prices,
giving students an opportunity now to index into a dictionary,
at least in a more familiar way.
I grew up with this thing here, Little Professor,
which was a little device that generates pseudo-randomly mathematical formulas
on the screen, like one plus two.
And the student has to type in the answer.
But it's therefore sort of an opportunity to quiz them on math.
So we have students implement a Python version thereof.
We have this tradition on campus, and optionally,
online, for students, where at the end of the course
and be given an "I took CS50" T-shirt.
We tend to have some extras of these.
So if you are teaching your own class in the coming year, let us
know, and we'll do our best to oblige with one or more of these.
But we have students implement their own image generator.
So I can't do it with the green screen here.
But they have to take as input a photograph, for instance, of themselves
and then overlay that T-shirt in a way that
makes it look virtually like they're wearing, if prematurely,
their "I took CS50" T-shirt.
Any of you who've used Google Forms, it turns out
if you poke around with this response validation,
there's a word there called "regular expression" that most typical users
might not even know what it means.
But we introduce students in CS50P to regular expressions
to somehow now bring this familiar Google form UI to students to life,
and, oh, that's what that now means, and just connecting it
to their own real world.
And then, lastly, we now have not only CS50 certificates, PDFs,
that we give to students, proudly congratulating them
on finishing any of CS50's courses.
We now playfully have a problem set where
they generate, for this assignment, a PDF of a shirtificate, which
says their own name, virtually, on the T-shirt here, and then
some other text above and below, so here, too,
just examples along the way of some of CS50's classes
wherein we try to bring fundamentals of procedural programming, still,
but all the more to life.
And the last visuals I thought I'd share with everyone
here are just now some of the course's traditions, which
feed into those earlier missions of accessibility and rigor
but also generating, ultimately, a community among students,
certainly on campus, but even now off.
And some of you might know or heard me allude earlier
to what we call CS50 Puzzle Day.
This is an event that we hold here at Harvard in September of each year
and then online in March or April of the subsequent year for students online,
wherein we give students a printed packet of puzzles--
not jigsaw puzzles, but logic problems of sorts.
We use this in the first week of CS50 to send the message
that computer science is really about problem-solving more generally.
It's not about programming.
And we invite students to invite their own friends,
even if they've never studied computer science before.
They can use laptops and Google.
But no programming is needed or expected for this event.
And it draws hundreds of students here on campus together,
and in our case, thousands of students online.
But if you follow a traditional semester where
your classes might start in August or September, by all means,
reach out to us after the workshop.
We can provide you with the same packet of puzzles to run the event locally.
Or we'll also do the same on scale the subsequent spring.
We end our semester with the CS50 hackathon.
I alluded to this being our 7:00 PM to 7:00 AM event.
But it can be time-shifted as you see fit, certainly,
when we bring students together just more socially, more collaboratively,
to work on in CS50 their capstone project, their final project, which
is an open-ended challenge at the end of the semester to build most any piece
of software of interest, subject to the guidance of their teaching fellow
or teaching assistant, so that they calibrate
their expectations accordingly, of course, doing this at 7:00 PM
to 7:00 AM.
Not all students make it through the night.
Among my favorite photos is this one here around 4:00 or 5:00 AM.
But at least, in our case, we typically wake students
up at the end of the event for pancakes as well.
And then, lastly, an event that we've long held both on campus
and off is a so-called CS50 Fair, inspired, really, by what I remember
is like a middle-school science fair.
But at this event, we have students gather in a large space
on campus, bringing their laptops at sort of bar-height desks
and just presenting to passersby-- students, faculty, and staff
alike-- what it is they created for that final capstone project.
And we have music and popcorn and candy in the background.
We typically invite alumni or friends from industry
to have their own tables and just chat with students, in our case,
at the university level, about full-time or summertime jobs or the like
or what computer science is like in the real world,
but generally try to make it as much of a social event
as it is academic so that you get expressions and interactions
like these-- students not in the class, not
in computer science, showing off or seeing what their computer science
classmates have had.
This is one of my favorite candid photos we took years ago,
clearly amazed at what he saw.
But indeed, that there is the goal.
And in our case-- and this is something we can sometimes help out with if we
have spares--
but offering up at the end of the semester, as you see here,
the "I took CS50" T-shirts that mark the end of CS50 students' experience.
And along the way, suffice it to say we at least here on campus
take a lot of photos and videos.
We navigate through language.
We're happy to share what the requisite opt-in or opt-out language is.
Particularly in the K-12 level, you might need parents' blessing as well.
But I would encourage you to consider, if your circumstances allow, capturing,
if teaching CS50 or anything like it, as many of these moments,
academic and otherwise, because it turns out, one, it's a wonderful way
to look back and for your students to look back on what it is they
did in your class.
But it's also a wonderful mechanism for recruiting,
in some sense, to open other students' eyes to what goes on in your
or their friends' classrooms, bringing to life a fairly arcane
otherwise subject like CSS in a way that they might not
have realized was possible.
In the coming sessions today and tomorrow,
you'll see glimpses of some of the lower-level implementation details.
Carter and [? Rangshin ?] alluded to this earlier,
a new tool CS50 uses called VS Code, a.k.a.
Code Spaces in the cloud.
This is a tool that you'll be welcome to use in your own class,
certainly try out this weekend.
It's freely available thanks to Microsoft and GitHub nowadays.
You'll see a little something about how students access this tool now
via the web.
This, though, is consistent with my very first comment
about really in the course accessible, not just in a curricular sense,
but also for teachers and students who might only have Chromebooks
or might have computer labs but no administrative access.
Everything in CS50 can be done with just a browser these days.
And you, the teachers, then, needn't worry about some
of those lower-level details as well.
For those familiar with some of CS50's prior tools, a.k.a.
CS50 IDE, almost all of those features now exist in VS Code,
and more are still to be ported.
This is the environment that you'll soon see that provides students
with a cloud-based programming environment, terminal window, File
Explorer, code tabs, and all.
This is a built-in debugger that, thanks to [? Rangshin, ?] is all the easier
to use at the command line so as to step through, yourself or your students,
code line by line.
This is a VS Code extension that Brian and now [? Rangshin ?]
have created that allows you to implement rubber duck debugging
in your own classroom.
We actually have a whole lot of rubber ducks
that we're happy to send out as best we can, too.
But barring a physical rubber duck in your classroom,
you can use a virtual duck as well, the idea being,
pedagogically, to help students here any illogic in their thoughts.
And all this, too, if curious, can be done locally
on students' own Macs or PCs.
And for us, this is a goal at the end of the semester.
We start students with a completely self-service cloud-based environment,
but ultimately aspire now to off-board them at the end of the course
so that they can then stand on their own,
especially if this was the one and only CS course for them.
And, ultimately, they can now do everything locally as well.
I hope you'll forgive that I'm just a few minutes after our mark.
Why don't we officially end this session here?
I'm happy to stick around in the same Zoom for questions.
But we will officially return at 12:30 PM, which is in 24 minutes
here, for a session by Margaret on using the CS50 AP curriculum.
But, again, it's really also the CS50 and CS50x curriculum as well.
So it's targeted not just at K-12, but really, audiences younger and older
alike.
This, though, was "CS50 Explained."
Feel free to drop off, do some work, take a break.
But otherwise, we'll see you again in 23 minutes here.
And I'll be happy to take questions one-on-one now.
See you in a bit.