Learning Programming - First Language?
I was speaking with a couple of college students at OSCON who were just getting into programming. One of the student's introduction to CS was learning Visual Basic in class. Normally, I'd expect C/C++ or Java to be the introduction language of choice for college CS courses, but to each their own. So I ended up showing them NetBeans IDE for Java, the sample apps and our learning trails on netbeans.org. Later, this got me thinking, what are good introductory progamming languages and why?
I started waaaay back with DOS BASIC, moved on to Pascal and Fortran, and really got into programming with Java (I avoided C/C++, too much pointer arithmetic and preprocessing for me). Each of these languages taught me valuable concepts- basic procedural programming, data structures, and OOP respectively. Looking back, I'd still recommend Java as a first language because syntatically it's easy to pick up, it teaches most of the important CS concepts (data typing, structures, OOP, etc...), you can graduate to much more advanced development, it's widely used in real world applications, and perhaps most importantly- OS agnostic.
Not to start a flame war, but I would definitely love to hear which language you recommend and why.
C is a great first language. (ok, i'm a bit biased since it was my first language). I'm a firm believer that one should understand what is going on behind the scenes before they take the step to the next level. Thus, you learn C before you learn Java.
This way it forces you to understand exactly what is going on. i.e., this is a linked list. It includes an item and a pointer to the next item on the list. There is no way to hide what it is doing. It also helps that the language is not overloaded with tons of other crap like pre-build classes that do everything and anything for you.
Yeah, it can be a bit fragile for larger projects so I would not use it beyond the first 2 or 3 classes. But for an introduction to data structures and control loops, it rocks.
Posted by John on July 24, 2008 at 12:31 PM PDT #
I suppose it depends on what one thinks is important, and what sort of things the student is apt to do when they "grow up".
If one accepts parallelism is the way of the future, then something like prolog or erlang are probably good starting points (or for the more numerically inclined, co-array Fortran, CM-Fortran or something of that ilk). SIMULA67 was a good choice for object oriented lessons (and being divorced from "the current real world" will ensure the student learns at least two languages which is a good first step towards multilingualism).
If they want to really understand the foundation of CS, then a generic assembler like Knuth's MIX might be good.
But without some consensus about what one is trying to accomplish, it's hard to have a useful recommendation. Someone seeking to understand how to build gaming software or virtual worlds may well have very different needs than someone who wants to grow up to be a hardware designer.
C is clearly the "right" choice if the student wants to understand the underpinnings of Unix/Linux OS. Asserting that Java is "the next level" strikes me as a bit bizarre. But even if we assume there to be a natural ordering .. there would still be the traditional argument of bottom up or top down ... either way C is neither at the very bottom nor the very top. It's inappropriate for parallel programming and for object oriented programming.
Posted by Keith Bierman on July 24, 2008 at 01:10 PM PDT #
If you want to teach people how to program rather than how to be programmers of a specific language then it is best to pick a non main stream language in my opinion. It is also important to get exposure as early as possible to the different paradigms (imperative, declarative, functional, oop, etc). Back in 1995 Glasgow Uni computing science department when through that exercise to choose a language to replace Turbo Pascal (on Mac) for teaching the imperative programming arts of the first and second year courses. The choice ended up being Ada95. It was mainstream enough that there were available compilers (IIRC gcc/gnat was the main choice) but also obscure enough that most (if not all) of the first years wouldn't have come across it before (that was important to help ensure bad habits pickedu p in previous courses or self teaching were reduced). Note that that was just one language of many that was (maybe still is) used. Haskell was used for functional programming, Prolog for "AI" classes - back then C/C++ wasn't introduced for most people until 3rd year and Java was still new.
Posted by Darren Moffat on July 25, 2008 at 05:17 AM PDT #
Thanks John, Keith, and Darren for your comments. As the old saying goes, all roads lead back to Rome, or C/C++ in this case =) I agree that a CS education really isn't rounded without a good grounding in C/C++ (seeing how a good majority of software/projects are built on top of it), and as Darren points out, there are certainly advantages to first introduce students to a different language before diving in depth learning C/C++.
Posted by Wen on July 28, 2008 at 09:11 AM PDT #
For a first language? Definitely Python.
Python is interpreted and can be used as a shell - which facilitates learning. And yet, scripts automatically compile on first execution and are fast, without requiring the use of a manual compiler.
Python has a streamlined syntax and scales down for simple exercises, with minimal boilerplate. But it also supports more abstract constructs (for when the student is ready) which allow it to scale up for more complex projects down the road.
Python supports multiple paradigms including procedural, functional, and OO, so you can build up. Most modern programming concepts are supported. The "batteries included" philosophy means you can accomplish interesting, useful tasks without getting confused by dependencies and competing extentions. It scales down, yet also supports concurrency and even has a built-in database (Berkeley DB) and who knows what else.
Python is readily available on most platforms. Its file locking on Unix is of the more popular lockf type (unlike Perl and Ruby) and so will play nicely with more modern unix lock-aware programs (and with Java.)
Python has accumulated less syntax pollution over the years than some other languages. The next version of Python (v 3.0) aims to clean up what little syntax pollution there is, at the expense of backwards compatibility - a good tradeoff for a language used in teaching, and one which most other languages are unwilling to make.
Python is actually useful. Somehow, I still haven't managed to use Logo on a project...
The One Laptop per Child initiative has a nice python application for learning python.
Ben
Posted by Ben Mord on August 13, 2008 at 03:23 PM PDT #