I am now skipping two of the guidelines from the paper, because they are specific to object orientation, and I would like to first concentrate on the general advice. (I might come back to the OO advice later.) Therefore, our Guideline 4 here is actually number 6 in the paper. It tells us not to start with “Hello World” as a first example.
The main problem with “Hello World” (or the only marginally more interesting “Hello <NAME>”) is that it is just so boring!
If you want to show a 15-year old why they should be interested in programming as a discipline, why on earth would you do THIS? Felienne Hermans, in a recent article, described her experience in teaching beginners where a pupil commented “If I want Hello world on the screen, I can type that in Word.” (1) And that student is quite right!
The problem is not restricted to Hello World. When I was a student, we were told to write a program that prints out all the prime numbers from 1 to 100. This is a boring example. There is so much wrong with it.
Firstly, it’s Maths. Maths immediately puts off 80% of your class.
Secondly, if you really wanted to know the prime numbers up to 100, what would you do? No, you would not write a program for it. You would google it. It would take you about three seconds and bang! – there they are. Using a computer to solve this problem is entirely artificial. It makes nobody understand why you would want to learn to program.
Thirdly, the program is finished when it prints exactly what I knew it would print all along! To test my program, I would work out the complete answer myself, and then confirm that the program does it. You learn absolutely nothing from running the program. You might learn the program statements, but not why you would want to write them. It excites no one.
And fourthly, imagine a pupil is really quick, finishes the exercise after five minutes, while everyone else is just getting started. What do they do then? How can they stretch, extend, be creative? Add their own ideas, and grow? Print out the primes to 200?
The problems is that, once the program has run, there is absolutely no reason to ever run it again. A program that you do not want to run twice is not an interesting program.
So my advice is: use examples of programs where you actually need a computer to do the task! Games and simulations are such examples. Visualisation of data, or graphical animations. Use examples that give learners immediate ideas what they want to add!
Of course, you need an environment that supports this, and makes it easy enough to do this from your first hour of teaching. But these exist. Use them!
Every time I see another “What is your name? Hello Michael” program, I could tear my hair out in frustration at how far we have not come.
(1) Felienne Hermans: The Story of Building Hedy: A Programming Language with Cognitive Science in Mind, Informatics in Education, Volume 23, Issue 4 (2024), pp. 791–822
Print the words
hello, world
This is the basic hurdle: to leap over it you have to be able to create the program text somewhere, compile it successfully, load it, run it, and find it where your input went. With these mechanical details mastered, everything else is comparatively easy.
from The C Programming Language, (Kernighan and Ritchie)
I always thought this was the point of ‘hello, world’: it doesn’t really apply to, say Python, where you can just write “hello, world”and press Enter (although even there you need to know about ” or ‘ – Paris has five letters, no it doesn’t, Paris has twenty arrondissements but ‘Paris’ has five letters), but otherwise you still have to find the right program to enter your code, probably save it somewhere (from where you can retrieve it), compile it (locating and correcting any errors), …
Modern IDEs remove a lot of this effort, and I find myself thinking “It would be far better if they had to use one other to enter the text, another to compile it, a third to link and load it, and then another command to run it! Those were the days!” bus that’s just my age showing.
I think there is a place for hello, world, but it needs to explained that this is what it is teaching you, yes it’s boring, yes it’s short,, but at least if you get it working you can then move on.