At first I thought it’s a pretty good idea – after all, who is going to disagree with John Resig – but after some consideration I think there might be some better choices for a first language.
The ideal First Language
It might be easier to simply consider what the perfect first language would look like rather than simply going through the list and picking a language. In my opinion, the perfect first language should be
- Very visual. It should be possible for a new programmer to write a few lines of code (preferably only one or two) and immediately see the results. Pretty much every language has some advanced visual libraries, but these can be very confusing for someone new to programming.
- Simple. This is obvious. While I have seen discussions on StackOverflow that seem to advocate that you simply ‘stick with C++’ I don’t think this is the correct approach. It seems to me there is a phase where a new programmer first needs to learn how to think like a programmer, before making the jump to any sort of programming technique. That’s my opinion anyways. If my first programming class was in C++ I might not have chosen this career – I just don’t see how it would have been much fun. The syntax also needs to be straightforward – we can sacrifice functionality for simplicity – in fact, it’s probably a good idea. ‘Simple’ in my opinion also refers to areas such as the IDE and project structure – I can’t imagine it would be very easy for a new programmer to understand the project structures in Visual Studio or Eclipse.
- Easy to debug. To a certain extent this ties into the first point – if you can see what’s going wrong it’s much easier to figure out where the code is going wrong. If your application simply spits out a single number without any explanation you’ll likely need some more advanced debugging tools and techniques, which would probably confuse a new programmer.
- Consistent. This is maybe a bit more difficult to explain, but it comes down to the element of least surprise (which is so often mentioned in Ruby) – different areas of the language should perform consistently. The greater the lack of ‘special cases’, the better.
Now that we have some idea of what we’re looking for, it might be a bit easier to evaluate the languages available to us on this criteria. It’s clear (in my mind) that most of the popular languages fail on one or more of the criteria I outlined above. For example, C++ probably fails on the first 3 points (it’s not very visual, it’s not simple, it’s not easy to debug) while Ruby fails on the first point and possibly the second one (it’s not very visual). This probably implies that Ruby is a better ‘first’ language than C++, while neither of them would appear to be a great choice.
What are some alternatives?
As I mentioned in my ‘about me’ page I started off programming in Logo. While most would probably dismiss this as way too simple, I like the idea of having a simple language which still allows the student to test the limits of what’s possible. For example, one of my first projects was to write Tic-Tac-Toe – you could either write a very simple little interface or you could write something advanced with better graphics, mouse control and AI. And you can still start off and draw something on the screen with one or two lines of code.
A language like Logo passes all the criteria I outlined above, but it could simply be because I had a language like this in mind when I drew up the criteria.
I think this is a really interesting topic – what was your first programming language? Don’t be shy – leave a comment below. I would actually love to put up a poll, but the alternatives are probably so wide I wouldn’t know what to put as the different options!