A reader (and friend) writes:
My nearly 17-year-old daughter is starting to be more and more curious about what it is that I
*DO*, and computers and stuff. Which leads us to the perennial question:What programming language should beginners be exposed to first – this
year? Just to give them a basic notion about programming concepts – not
to get them a job.I’m completely stumped. I live in a world of C and C++ and Java and
Perl and more recently Ada – yes, Ada – from which I am unlikely to
escape.Is Python the answer? Or ??? I can’t imagine that any of the languages
I listed above is a candidate. Pascal is irrelevant these days. Logo
(“turtle graphics”) were cute 20 years ago. What is it now? Something
simple to grasp but that isn’t too limiting.Curious what your ideas are.
…S
My first programming language was Fortran on an IBM 1620; I decided that wasn’t a reasonable recommendation, despite the availablility of an 1620 emulator (I had to drive 5 miles each way uphill in the snow to get to the computer).
Instead, I answered thusly:
I, of course, am still partial to Rexx, but I don’t think it’s a good beginner’s language any more, because you can’t do “interesting” things in it (like make GUIs happen, or manipulate other programs, or do things on the web). And, to be honest, I haven’t written anything in Rexx in a few years and don’t even bother to install it any more.
So my suggestions would be Python or Ruby.
Python, because it’s got a very clean syntax (as long as you don’t mind that indentation is syntactically significant), because it is just object-oriented enough (and these days, I think starting with an OO language is the right answer), and because there are packages available that let you do damn near anything (though I still haven’t gotten around to writing anything GUI….). The documentation is pretty good, and there are at least two decent books to start with (Learning Python and Dive Into Python, which is also available free online).
Ruby, because all the Cool Kids are using it (especially with Rails). It has much too much syntax for my taste, and there’s often More Than One Way To Do It, which you may consider to be good or bad. I haven’t really gotten into Ruby or Rails yet, because I haven’t had a real good use case, though that may change.
Other languages to think about:
PHP, the language of WordPress and MediaWiki. There’s even a book, PHP For Teens, which might be interesting from a target audience perspective. OTOH, PHP’s natural habitat is in creating server-based apps, and that might not be ideal.
Java, just because. I’ve been able to avoid it so far, but the time has come for me to get my feet wet there, so I can vouch for Head First Java as a good introductory book.
And one of my colleagues here suggests JavaScript — you can write it and play with it right in your browser and get instant gratification.
Both S. and I are interested in your thoughts on this…comment away!
I agree Ruby or Python. …..But stating Ruby has “Much to much syntax”? Try Java.
Dysinger — I’m not partial to languages which decorate variables to indicate what kind of thing they are (Ruby’s @name, :name, $name, @@name, and the like). I also never liked Hungarian Notation when programming in C or Pascal!
On the other hand, my early FORTRAN training still causes me to name uninteresting integer variables with names beginning with the letters I through N, so I’m not all that consistent.
I *do* like the fact that Ruby, like Python, doesn’t require () around a conditional in if statements; that has tripped me up many many times in Java and C.
Thanks!
i would recommend basic! back when computer monitor displays were only monochromatic green, my friends and i had a lot of fun playing with basic when we were kids. there was no visual basic back then, so we edited our .bas files on regular editors, but we had this book called big computer games (http://www.atariarchives.org/bigcomputergames/) featuring all sorts of games written in basic, and we tried implementing our own modifications to the games. of course, now we know that goto is considered harmful, but back then all we could think about was how to make the little character that acted as our sprite jump all over the screen.
i really can’tt recommend ruby, even though i think ruby beats python all over the place, simply because i think it’s really hard for an inexperienced programmer to appreciate the power of the language; blocks and anonymous functions stir the hearts of experienced programmers but mean nothing to an amateur. i won’t recommend python either, because it’s hard to explain a lot of quirks, such as why single-element tuples have to end with a comma. i can’t recommend java either; i still remember the time i typed my first “public static void main” and wondered “what on earth is that?” i won’t recommend lisp either; it’s hard enough to explain why the plus sign moves forward in 2 + 3 to become (+ 2 3).
imo, i guess for mort it’s all about the interactivity, the ability to see the results without going through weird rituals called compilation, et cetera, and the ability to do something “funky” and “cool” without requiring a degree in computer science. however, it ultimately boils down to the question “why would i want to learn that?” the answer lies less in the technical merits of the programming languages and more in the individual’s psyche, that which motivates him or her to learn stuff like skateboarding, making computer games, smoking cigarettes, or playing the guitar. if she wants to make websites, i’d recommend php; if she wants to make computer games, i’d recommend pygame; and so on.
I agree with Raichu.
A best thing should be appreciated. Ruby should not be the first programming language to go with, otherwise she will never know that Ruby is best, all she will know that other programming languages are NOT best. She must go for some C things to clear the loops, functions and constructs. Then for building OOPS, select either C++ or JAVA just to get familiar with class’ concepts. And then finally she must do Ruby.
To learn the absolute basics I think PHP would be good, since the way it does many constructs is very similar to C and Java. It lets you use more complex stuff as you learn them. C and Java on the other hand, just to start writing code, immediately forces you to use a method, a class in the latter, know about return types, etc. Personally, I hate the “just ignore this for now” approach in teaching programming.
Once you’ve got the basics down in PHP, the swith to Ruby should be easier, though I’d recommend learning at least some OOP in PHP first.
When it comes to learning a language in general, there’s nothing better than taking on a good-sized project. Little bits show you how to use it, but eventually you’ll have to learn how to work with it.
Chris Pine wrote a free online tutorial called “Learning to Program” which is Ruby-based and later became a book. I believe the free tutorial is still available. It (and the book) has a very gentle runway suitable for complete beginners to programming.