Hello World Comparisons Considered Harmful

For the second month a row, the misinformation about Stanford’s decision to offer JavaScript as an alternative to Java is making the rounds.

As is often the case, the case against Java is made because of the typical hello world program:

public class Hello
  public static void main(String args[])
    System.out.println("Hello, World");

And, yes, there are lot of problems with this hello world program in the context of teaching beginning programming. You are forced to either hand waive and say “just trust me” or explain the following key words: public, class, static, void, String (OK, not really a keyword, but still…).

Additionally, people will express concern over the syntax of braces and other various influences coming from C. Objections of which I have no disagreement with.

But then the conversation turns around and JavaScript is raised up as the solution because here is your hello world program:

alert("Hello, World!");

Leaving aside the reality that JavaScript has just as many C inherited syntax issues as Java, the immediate implication is that a shorter hello world program is a better one.

Well, how about this one:

'Hello World'

Even better, right? Well, no, this is hello world in APL. Take a look at an example of an if else statement in APL:

∇ generateAll number
:If number>100
   ⎕←'Too high'
   ⎕←⍳ number

Why all the strange characters? APL actually requires a special keyboard for a special character set! All leading towards to the reality that we need to go beyond Hello, World as a means to compare introductory programming languages.