Skip to content

How CS50 uses GitHub to teach computer science

Professor David J. Malan, Gordon McKay Professor of the Practice of Computer Science at Harvard University, is dedicated to offering his students a robust learning experience. This post outlines how…

Author

Professor David J. Malan, Gordon McKay Professor of the Practice of Computer Science at Harvard University, is dedicated to offering his students a robust learning experience. This post outlines how he uses GitHub and his own custom tools to build hands-on assignments for CS50 students.

With over 700 students, 80 staffers, and 2,200 participants in their end-of-term CS50 Fairs, CS50 has a reputation for rigor, real-life application, and engaging material.

At the same time, says Professor Malan, about half of CS50’s students typically treat the course as “terminal”— as their one and only course in computer science. So the projects touch on applications in a variety of fields, from social sciences and humanities to medicine and finance.

Malan says of the learning goals of CS50: “We want to provide students with a solid foundation in computer science so that they are well prepared for any field. And also bring to bear some practical skills to that world. So that is actually tied in with our adoption of GitHub this past year.”

A gentle onboarding to Git and GitHub

The mental model for cloning, branching, opening pull requests, or pushing can be tricky for newbies just starting out. As a way to onboard students, Malan wrote a command-line tool that wraps a sequence of Git commands called submit50. They developed submit50 to not “reinvent the wheel” with a new submission system, but to create space for students to grow into comprehensive GitHub use as their learning evolves beyond CS50. Says Malan:

One goal was to have students graduate, so to speak, from the class actually having a GitHub account. And even though they don’t keep their work in public portfolios for the course, the hope is that they’ll have at least enough understanding of GitHub that they can use it after the term ends for personal projects.

Course outline for CS50

Student workflow for submit50

CS50 uses the structure of one branch per problem, and students engage Git and GitHub from the command line.

First, they run a command in their directory on a Linux system with a folder they wish to submit to CS50’s servers. The student then runs submit50 foo where foo is the unique identifier for that assignment.

submit50 models how Git and GitHub work while abstracting away some of the complexity:

Behind the scenes we show them the command so that through a bit of osmosis, they can infer what’s actually going on.

We clone their repo, which lives in our submit50 organization. So we have full administrative rights, and students have push and pull privileges only.

The submit50 script clones that repo into a temporary directory. We do the equivalent of rm -rf to blow away whatever is currently in there, and then git-add the entire contents of their current working directory into that repo, and then tag it with a tag that corresponds to the problem’s name, and then push it to the server.

Project-based assignments, real-life applications

An example assignment is “C$50 Finance” where students build an application to simulate stock trades using Python with Flask, HTML, CSS and SQL.

Students create tables with user accounts, who can then buy and sell stocks. The application queries Yahoo Finance for stock quotes, almost in real time.

Malan is delighted to see the different personal touches students add to their projects, both functional and aesthetic.

It’s a fun opportunity to introduce students to even the aesthetics of web design. Invariably the first thing students do is customize the aesthetics of the site, and then certainly there are differences in features, and we’re fine with that. The assignment requires ultimately that they add a personal touch, so any feature that’s not been enumerated by us they’re welcome to do so long as it’s of reasonable scope. So we’ll get different outputs from that as well.

Rituals of success

All students exhibit their final projects an end-of-semester “CS50 Fair.” About 2,200 people attend to see the student demos.

Malan designs the event as a kind of celebration, a capstone ritual where students can show people what they’ve made:

It’s a fun way to delight in how much you’ve finished, particularly if new to programming just months prior. And it perhaps creates a bit of social pressure too. You know you’re going to be showing this not just to your Teaching Fellow, but to your classmates, and you want to be proud of it. And so, hopefully, that incentivizes all the more of a strong finish.

Computer science and tech news = CS50 Live

Pushing beyond the boundaries of the traditional classroom, Malan connects the course materials with the news in a kind of “Daily Show” for technology, called “CS50 Live.”

Malan and the crew of Teaching Fellows take up current events, like Apple’s implementation of OpenSSL with a bug in it, and dig into the code on the show.

This is a post in our “Teacher Spotlight” series, where we share the different ways teachers use GitHub in their classrooms. Check out the other posts:

Join this week’s discussion in the community forum: How to automatically gather or collect assignments?

Explore more from GitHub

Education

Education

Information for tomorrow’s developers.
GitHub Universe 2024

GitHub Universe 2024

Get tickets to the 10th anniversary of our global developer event on AI, DevEx, and security.
GitHub Copilot

GitHub Copilot

Don't fly solo. Try 30 days for free.
Work at GitHub!

Work at GitHub!

Check out our current job openings.