This has been knocking around the blogosphere for a while now, but I may as well engage with it. Apparently, David Brin thinks coming generations will miss out because computers don’t come with BASIC any more. I’m not so sure. I was a ZX Spectrum kid, and I used to spend a lot of time fiddling with code on it without any clear aim. Later, I met Mallard BASIC on the Amstrad PCW, and did a few things slightly more useful with it – Mallard had a file handling thingy called Jetsam you could call from within a BASIC script, which helped.
But – what? I rejected computers for a while, and only really got back to it when I developed a serious forums habit at RHUL. In a similar way, I first heard of blogs and Blogger in Vienna in the autumn of 2001, but didn’t cross the threshold – so I suppose Instapundit’s fame is at least in part my fault. Now I regret not learning to program properly. Looking back, though, I wouldn’t wish BASIC on a new generation of geeks. Certainly not on computers with networking, graphical user interfaces and other stuff. Because the gap between “Hello World” and “anything you might want to make a computer do, especially when you’re 12” is very broad. Yes, you have to learn concepts like sequential execution, loops, arrays, subroutines, procedure calls and that they are to be preferred to subs, that GOTO is considered harmful and the like.
But the point of an introductory language is that you shouldn’t notice that you’re learning that stuff. If the aim is learning-by-doing, it’s got to make things happen, and design should involve some thought about what the users might want to do (think mobile devices).
That said, which programming language would my readers recommend I learn? (Don’t say Brainfuck! or anything like that, please.)
What about Ruby or Python?
Both are very modern. Both are quite easy for a beginner to learn, and yet both are very powerful with lots of features that make computer science types pleased. Existing code in those languages is very structured and easy to read (for the most part). They both have plenty of support in the form of libraries and tools and so forth, and they can even both be run as an interpreter for that instant feedback like you got when you typed PRINT “HELLO” on your old 8bit.
If you want to learn programming languages *now* first ask yourself what you actually want to do with the language – what sorts of problems do you want to solve, etc. Then investigate that particular subject area and pick the language that appears to be most common in that area. Because you want learn without doing – and simple strawman programs will bore you after a while, just be realistic.
Or do a survey of various tech blogs and pick a language recommended by a tech blogger who other techies seem to respect. These days most tech bloggers are into OO and Meta-Programming, and that means either Ruby or Python.
Python or ruby are reasonable suggestions if what you want is a scripting language. In reality all the modern scripting languages are basically equally capable (though I’d avoid PHP like the plague). C is good intellectual exercise; C++ grotesque; and Java a solution looking for a problem.
Don’t for god’s sake take advice from “tech bloggers” though — ask somebody competent. And don’t worry about whether the language you’ve chosen is suitable for your problem domain. Learning new languages is easy once you’re in practice, and one of the great things about modern languages is that you can turn them to about any problem you want to attack.
I’d pick Ruby over Python because of a yearning for elegance. Both get the job done well, but Ruby was designed to be elegant and to implement the best ideas from other languages such as Lisp and Smalltalk. As a mathematician manque, this appeals to me. I think it would provide the best starting place.
Calling either of these ‘scripting languages’ really sells them short – yes they are interpreted rather than compiled, but otherwise both are functionally equivalent to a full language.
Start here:
http://www.ruby-lang.org/en/documentation/
C or C++ is what Real Programmers use, but frankly they are more painful than necessary, at least until you need to get really close to the metal.