Just a while ago, I bumped into this piece comparing a few popular programming languages - BASIC, C, Java and Python - in terms of how appropriate they are as a first language for teaching computer programming. It raises a few interesting points and I generally agree with its conclusions. I remember that it was back in my sophomore year at university that I also started believing Python would be the definitive and proverbial first programming language. Unfortunately, as Patrick Ariel states in this article, people tend to be sadly dismissive of interpreted languages stereotyped as mere scripting tools. I couldn’t disagree more.
In my time, it was Haskell, a cute functional language that I despised back then. As far as I could gather, it was meant to act as some sort of tabula rasa - 99% of the freshmen would only have a minor C/Pascal background, so getting hit right in the face with a language belonging to a completely different paradigm would have everyone starting from zero and scratching their heads. I know I did.
One thing I liked about this article is that despite being entirely unscientific, so to speak, it uses a very important metric: how many things and concepts a student has to know in order to write simple programs. I’m no seasoned programmer by any means, but I’ve been programming long enough to be genuinely surprised now at the insane amount of stuff you have to learn in order to write a simple program in C. I mean, understanding pointers just to get input from the user? For crying out loud, I never stopped to think about it, yet it’s true. Good golly, miss Molly.
And don’t even get me started on Java. I’ve written some code in it and I do appreciate its huge class library but I also do think it tries to simplify things a little too much, turning programming into something like getting the jigsaw puzzle pieces together. Not that I believe programming should be hard per se, but the most powerful concepts are certainly not expressed in the way Java allows you to. Not in my book, anyway. I’m talking logic and functional programming here. Simple to write yet sometimes not easy to get your head around as the reasoning may be hard, but the language should not get in the way. Java’s “Hello World” speaks for itself in that department, I guess.
But I’m getting carried away and deviating from the point here. Believe it or not, as far as first languages go, I think Python’s most recommendable features are:
- mandatory indentation, simply because it forces young programmers to write properly structured code. And if that practice comes right at the beginning as the first language they pick up, then all the better. Obviously this alone doesn’t add up to better code, but it is a notion not many people seem to grasp. I’ve seen entirely too much ugly code in my time. And I’m still very young, mind you.
- perhaps even more importantly is the way Python allows reasoning-to-code translation in different paradigms. It does OO well enough, but does not enforce it, it allows for functional style programming, but does not enforce it, and it allows you to write purely imperative code a la C, but certainly does not enforce it either. Whatever the paradigm emphasis is, Python is there for you.
Mostly, I think the point is, again, that the language itself should never get in the way as clearly Java does (ever tried writing regular expressions code in Java?). C does that to a degree but I think its alibi of having its roots on systems programming and being a language from hackers to hackers is a good one. Nowadays, I don’t think it makes sense to use it for anything else other than writing device drivers and core operating system code. Python, on the other hand, is simple, elegant, well supported, well documented and has a huge community surrounding it that spans different arenas. Despite being slow, as an interpreted language, that’s certainly not something to bother the inexperienced wanna-be programmer.
Damn, I sound like a crazed and deranged Python groupie, don’t I? That’s too bad. Believe it or not, I don’t think I’m biased as I always try to use the right tool (language, in this case) for the job. Python just seems to be the best tool for the “learning programming” job.
Gosh, this was supposed to simply be a heads-up on Patrick’s write-up. I’m truly sorry, but if you’ve gotten this far, then congratulations. You did way more than I expected you to. And while we’re at it, why not leave a comment with your opinion on what the first programming language should be?
#