You are using an older browser version. Please use a supported version for the best MSN experience.

Why does CS50 use C as its primary language?

The Huffington Post The Huffington Post 17/03/2016 Quora
LAPTOP DARK © BrianAJackson via Getty Images LAPTOP DARK

These questions originally appeared on Quora - the knowledge sharing network where compelling questions are answered by people with unique insights.Answers by David J. Malan, Gordon McKay Professor of the Practice of Computer Science, Harvard University, on Quora.Q: Why does CS50 use C as its primary language?

A: A frequently asked question!

C is just about as close to a computer's hardware as you can get before you have assembly language (which would be too arcane, I think, for an introductory course like CS50). In C, there's no magic. If you want something to be somewhere in memory, you have to put it there yourself. If you want a hash table, you have to implement it yourself. The result by term's end, we hope, is that students understand how things work from the bottom up and, better yet, can explain as much.  C is also a small language that, by mid-semester, students have seen nearly all of (except for, e.g., unions and function pointers).

It's a powerful thing, too, I think, to go from implementing a hash table (or trie) in C in one week, and then just a week or so later implement the same in just one line of PHP or JavaScript code. And to know and understand what's underneath those one-line abstractions.

C also affords us an opportunity, very early on, to explore topics like buffer overflows (and security more generally), which still underlie today's exploits all too frequently!

Among the downsides of C, of course, are these same upsides. It's all too easy to access some memory you shouldn't. And if you want a hash table, you have to implement it yourself! And it's harder with C to assign problem sets early on in the term that are as engaging as they might otherwise be with, say, Python or Java, both of which offer many more (higher-level) features. But not impossible!

Ultimately, I think C is a wonderful, if challenging, stepping stone to other languages we look at in CS50, among them PHP and JavaScript, which are both so syntactically similar to C.

The net effect of these choices, we hope, is that at term's end a student will not say "I learned C" but, rather, "I learned how to program."


...
Q: How do you keep yourself motivated and interested while teaching the same topics every year?

A: Each year, CS50 changes in some non-trivial way, sometimes curricularly, sometimes technologically (and, more recently, sometimes geographically!), and so each year is somehow different from the last. Those changes certainly keep me motivated and interested. Or, to be fair, perhaps I initiate those changes to keep me motivated and interested!

The course's students and staff, of course, change each year, and each new class brings new ideas and personalities to the course. The course's problem sets are constantly evolving, as are the demonstrations we try out in lectures. The paradigms we teach (not so much in C but in web programming) are changing with time. The course's infrastructure is frequently updated, as from cluster to cloud to appliance to, most recently, IDE. Over time, we've introduced the CS50 Fair (2008), the CS50 Hackathon (2010), and CS50 Puzzle Day (2011). Whereas we once shot the course in 4:3 SD, we now shoot the course in 2.39:1 4K. (And coming in Fall 2016 is CS50 VR.) For quite some time, CS50 was offered only at Harvard College on campus, but it's now available beyond, and soon via AP.

So I daresay, every year, CS50 is anything but the same!

These questionsoriginally appeared on Quora. - the knowledge sharing network where compelling questions are answered by people with unique insights. You can follow Quora on Twitter, Facebook, and Google+. More questions:​

More from Huffington Post

The Huffington Post
The Huffington Post
image beaconimage beaconimage beacon