Rethinking the Java Curriculum: Goodbye, HelloWorld!
Subject:   What HelloWorld is good for
Date:   2002-08-22 15:27:38
From:   ljagged
I think that you're missing a couple of the good points of HelloWorld.

1) It's small. It's about as small as you can get and still have some working code.

2) It provides feedback to the user. By actually printing something to the screen, the user -- a newbie by definition -- gets immediate feedback that s/he did something right.

3) It's friendly. It's hard not to feel good when you see the cheerful 'Hello World!' staring at you from the terminal window.

I agree with you that HelloWorld doesn't teach good OO practices, but I think the purpose of HelloWorld is to show the user that everything is set up correctly for some real programming to occur. It's more of a system check than a model of the RightThing.

Full Threads Newest First

Showing messages 1 through 4 of 4.

  • Daniel H. Steinberg photo I thought I said that in the article
    2002-08-22 18:42:32  Daniel H. Steinberg | O'Reilly AuthorO'Reilly Blogger [View]

    Not to be argumentative -- but I said that HelloWorld "is a short, simple-to-write program with an immediately observable result." I believe those address (1) and (2).

    As for point (3), I admit I'm at a loss. I don't find the words 'Hello World!' staring at me from a terminal window as being cheerful or friendly.

    I also agree with your final point that HelloWorld is a system check and note in the article that this program is where the novice user first learns to use the editor, compiler, and first runs a Java application.

    In other words, given all of the traditional benefits of the HelloWorld program, I am still suggesting that it is not the best way to start a course in object oriented programming.

    • What if we change the context
      2002-08-22 21:41:39  trajano [View]

      When I was in university, I do not recall them really teaching us "hello world", our first assignment was to do with graphics already (this was a first year intro CS course).

      Anyway, the way we had it was we had a few labs that we had to do to get us familiarized with the environment (how to compile, how to list directories, how to log in and log out). The "hello world" would be perfect for a lab task.

      The intro course itself could start teaching OO concepts from the get go. We learned other concepts on my day, but I think this would be the best way to teach an intro to CS course.

      Also on a side note, our labs were basically graded as "complete" and "incomplete", and do not count to your final mark because someone who knows programming will think its a waste of time anyway. But beginners would have an opportunity to understand how things work.
    • I thought I said that in the article
      2002-08-23 07:31:28  ljagged [View]

      I agree with all your points, except for the last one. I think that starting a course with a system check is _exactly_ the way to start a computer course, OO or not. Particularly, if the student has little/no programming experience.

      When you're doing a physics experiment, you want to reduce the variables to an absolute minimum. The best situation is to have one variable that you can control. Similarly, if you start the student out with an example of a good OO program and it doesn't work, they need to figure out why. is the JVM not on their PATH? Is the jar file not on their CLASSPATH? Are they treating an instance method as a static method? By starting with HelloWorld you're limiting the number of variables. If HelloWorld is working, then they probably have their PATH and CLASSPATH set up correctly. That's to say, their toolset is in working order and they can go forth with confidence.

      Admittedly, I'm a little vague on your goal. When you say a "Java-based introduction to object-oriented programming" is the intention that the students are already familiar with programming and this is their first foray into OO? The impression I got from the top of the article where you mention CS101 and CS in high school for the AP is that these are first time programmers. If that's the case, I'd argue that they should start with a language like python, scheme, or logo.

      Python: print "Hello World!"
      Scheme: (print '"Hello World!")

      even BASIC is just: 10 PRINT "HELLO WORLD!"

      and, I agree, that's probably a waste of time. If I had to teach Java to beginners, I'd probably teach them Jython. They get the benefits of a REPL environment and the ability to learn Java's class libraries. Eventually, I'd wean them off of Jython and into writing actual java code.
  • What HelloWorld is good for
    2003-04-21 09:54:22  anonymous2 [View]

    So why not write an OOP version of Hello World
    such as

    public class HelloWorld
    public void displayMessage()
    System.out.println("Hello World");

    Now create a HelloWorld object in BlueJ and
    invoke its displayMessage method.