3

Before starting CS50, I'd been looking for several other courses. I've noticed that many universities (including MIT) seem to prefer Python as a starting language. Here, after a brief adventure with Scratch, we dive into the world of C.

Is there any advantage in particular to a learner in one language, instead of another? How does C compare to Python when it comes to getting acquainted with CS?

I know we're using Python later in the course, but some MOOCs are structured using Python exclusively. Is there any advantage of focus on one language instead of a multitude of others? I prefer the latter approach myself, but is there a reason to prefer one course, focused on one programming language only, to another, exploring several at the same time? And if yes - what would it be?

Would love to hear thoughts of CS50's staff on this..

3

You can find the "official" answer from David Malan himself here: "Why does CS50 at Harvard use C as its primary language?"

A few words from my own perspective...

I began my formal programming journey in earnest with CS50 in August 2015 and currently teach CS50 AP. I've also explored a handful of different MOOCs: Nand to Tetris, Programming Languages, and currently MIT's 6.00.1x. Now that I have a little bit of experience, I can reflect on what I've been learning. More and more what every class has been emphasizing is that the language of choice is a means, not an end.

Certain languages allow, dare I say force, the user to grow as a computer scientist, as one studying computational thinking, in different ways. C, as a lower-level language than Python, certainly does (especially when it comes to handling strings, a common task for beginning programmers). Nevertheless, the goal of CS50 is not so much to learn C as to learn to think in way that allows you to solve problems computationally, algorithmically. Where CS50 shines are its problem sets, which consistently challenge you and push you just beyond your comfort zone. What problems a course has you solve will have a bigger impact on your growth than the language it emphasizes. MIT's course too, while in Python, is about the approach to problem solving with programming more than just the syntax of Python.

All this is to say: do not get hung up on what language to start with. The goal is not the language itself, but learning how and why to use programming to design solutions to complex problems.

You will not regret starting with CS50.

1
  • 1
    That's exactly what I think now as well. I started "programming" myself 5 or 6 years ago, with Visual Basic - but I quickly got tired of it. Writing one program after another which does nothing I could consider remotely useful was just .. boring. Only a year or so ago when I picked it up again (this time with D [language]) that I came to realise that any programming language is just a tool. A tool that is quite useless by itself. It's only when you use it to produce something that can solve some real problem that you create something genuinely useful.
    – A. Babe
    Jan 20 '17 at 20:27
2

I've noticed that many universities (including MIT) seem to prefer Python as a starting language.

That's true! I myself prefer Python as a starting language. However, I can understand why CS50 is having us do C.

Python is "easy" in the sense that it uses a lot of English or human-readable words. Take a for-loop, for example:

for letter in word
    // do this

You know this is an iteration just from looking at it - it goes through every single letter in the word. However, it doesn't tell you how this is working under the hood. How does the computer know when to start and when to stop?

David Malan says:

t'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 can help answer those previous questions as to how the computer knows when to stop, when to start, etc. In our for-loop example, C can show you how the computer knows to iterate through every letter in a word:

for( letter = 0; letter < strlen(word); letter++ )
{
    // do this
}

However, there isn't a "best" starting language. All languages have pros and cons, and it depends on what you want to do with the language.

I hope this helps!

1

DISCLAIMER: I am not CS50 staff, but here are some thoughts:

I am glad that CS50 offers the opportunity to dive into C, and then from that to higher level languages, like Python, Javascript, SQL.

C forces us to think at the lowest level, and because of that, we will appreciate a language like Python more than we would, if we jumped straight into that from the start.

6.00x from MIT focuses on Python. It used to be using Scheme, but since nobody uses Scheme these days, they switched to Python.

I think the advantage of a multi-language course like CS50 is that it teaches us how programming languages share similar ideas. If we learn one - C - then learning other will become easier (especially when moving from lower to higher level languages).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .