More Comments on "A Very Quick Comparison of Popular Languages for Teaching Computer Programming"

This article has been translated into Polish here. Thanks to Weronika Pawlak for creating this translation.

I wrote a brief article comparing C, Java and Python as a first language for Computer Science students new to programming. A number of people wrote with comments and they keep on coming. Here are some of the latest, along with my responses.

Pascal

On 3rd December, 2005, Laszlo Balint, a computer science student from Romania, sent me the following Pascal and wondered why I hadn't included Pascal in the first place:

  var a,b,c:integer;
  begin
     readln(a,b);
     c:=a+b;
     writeln(c);
  end.

I remember Pascal feeling like a breath of interesting air - being the first post-BASIC language I really used. It was a big improvement. And sure, it was designed expressly for teaching (in fact, so was BASIC). But that was a long time ago....

Pascal fails miserably in comparison to Python for expressive power, and also apparently - see this article by Brian Kernighan - in comparison to C.

Pascal has evolved into Delphi, which apparently has a real world following, and is presumably much more able than the Pascal I used at Uni, but this is a proprietary language, and as such I would consider it an inappropriate choice for teaching.

REXX

On 2nd December, 2005, Jon Wolfers wrote:

I see you had lots of people sending you their favourites, and was saddened not to see Rexx there.

Many people who use Rexx list it as their favourite language. It combines simplicity of use with readability and power, is very forgiving (as a Python advocate imagine if you could indent freely and include white-space wherever you wanted to aid readability) and now very late in its life it has become open source and freely available (www.oorexx.org)

It is far and away my favourite language, so I thought I'd send you my sample submission. Here is the code:

Say 'Type two numbers followed by Enter'
Pull a b
Say a'+'b'='a+b
Time to write: as fast as you can type.

Things to explain:

  • The potential power of parsing
  • Variables
  • Literals
Although the example is extremely simple Rexx is very powerful, with OO where you want it.

I remember some buzz around REXX in the days of the Amiga, but had not heard of it since. I have to say it looks like it could be fun, and I may put it on my list of languages to learn. I'd reject it as a teaching language purely on the grounds of it being too little known. I was interested to see that it's considered a precursor to Python....

TCL

On 15th September 2005, Steve Duncan wrote:

Couldn't resist replying to your "add two numbers" item. Here's a Tcl/wish script that pops up a GUI for adding the numbers. The numbers are syntax checked and can be integers, hex, floating point or in fact any constant expressions containing standard function evaluations. For example, you can add 0x4 to log(0.5) if you like.

#!/usr/bin/wish

entry .e1
entry .e2
label .l1
button .b1 -text "Add these two numbers" -command {.l1 configure -text [expr ([.e1 get]) + ([.e2 get])]}
pack .e1 .e2 .b1 .l1
BTW the minimum Tcl to do the same thing is:

puts [expr ([gets stdin]) + ([gets stdin])]
I've heard many people refer to Python as "just a scripting language" which has always seemed both inaccurate and unfair to me. So I'm reluctant, with little experience, to level the same accusation at TCL. There's a lot to be said for being able to whip up a GUI with such incredible ease - vastly less work than the equivalent in Visual BASIC for example, and much more powerful.

In fact, TCL appears to be quite a match for Python in terms of expressiveness, but for a beginner its syntax is not as clear and (more importantly) has less in common with other mainstream languages like C and Java.

Patrick Jordan - patrick@ariel.com.au - 2005-12-14


...original article
...part 2 (comments)