Starting to program

Today I was asked if somebody who is getting into programming should start out with Perl?

First of all I would like to say that I feel honored that somebody would consider taking my advice. Second of all, I don’t really feel that I can give an objective answer, since I’ve been doing it so long (for more than 14 years now) that I totally forgot how it’s like to be a beginner. I will give my opinion here for what it’s worth though:

Perl is not a good language to start to learn programming. The main reason is captured in the Perl slogan: there is more than one way to do it. While this approach may benefit people coming from other programming languages (because you can write code like in C, like in Java, like in Bash, etc), I assume that this would confuse newcomers.

I would direct people wanting to learn programming to Python. The reasons I recommend it are:

  • For everything there is only one way to do it. This is a big advantage because sample code you might find will use the same approach.
  • It has a large number of modules / libraries, so you can do almost anything, including games.
  • It is multi platform (including Linux, Windows and Mac OSX and many exotic ones like OS/2 or BeOS) so you can your code on your preferred OS
  • It is dynamically typed and garbage collected, so for the start you don’t have to worry about data types and memory management (the two things most people struggle with when they get into programming)
  • It has a console, where you can try out things, write short programs and get immediate feedback. This is very useful for anyone learning the language.

Two books which I would recommend and are freely available on the web: Dive Into Python and Think Like a Computer Scientist (scroll down to find the download links). A more advanced one is Algorithms by by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani, also freely available.

P.S: although it is customary in the Romanian (and probably other) education system to use Pascal and C as introduction into programming, I would strongly advise against them, because to use them successfully, one has to understand many details which are not related to programming strongly: memory management, compilers, data types, etc. Of course one has to understand these details eventually, but it helps if one is not overwhelmed with to many details when starting out.

An other very nice programming language would be Smalltalk (with something like Squeak), however their image concept (= everything is contained inside one single file) is a little hard to grasp and reduces the usefulness of the language (because it limits interaction with the outside world). Then again, for smaller children who don’t have preconceived notions about files, directories, etc, it may be the ideal environment.

, ,

One response to “Starting to program”

  1. I also think that Python is best first language to learn. In Serbia we are using Pascal in secondary schools, and Java on faculties, but some my professors do not have objections on Python code, so I use that freedom a lot 🙂

Leave a Reply

Your email address will not be published.