Rethinking Hello World
Is it time to rethink and replace “Hello world?” Honestly I think so. The purpose of “Hello Word” is to walk a beginner through the process of creating a minimal computer program and getting it to run. It probably made sense when one had to use a text editor to create a file and then manually run it through a compiler and a linker to get to the run part. For modern integrated development environments (IDEs) I’m not so sure it makes since though. It is fairly easy to enter some simple code and hit the F5 button and get a running “Hello World” to run. So what is the problem? What is the harm? Well two things.
One is that the process doesn’t feel like it makes sense. It is just too trivial and too boring. As I said before using an IDE is easy for students who have grown up with word processing and similar programs from early childhood. Why waste time with something that means nothing? Plus it violates Astrachan’s law - “Do not give an assignment that computes something that is more easily figured out without a computer, such as the old Fahrenheit/Celsius conversion problem.” OK “Hello world” is not exactly an assignment but more like a demo/exercise. And I am going to suggest a more powerful and interesting version of Fahrenheit/Celsius conversion but bare with me.
The second problem is that “Hello World” does not lend itself to enough experimentation. I think that students get more out of a project, even a simple demo exercise, if they can play with it and stretch their creative muscles a little before moving on. What can you do with “Hello world?” You can change the message. If you want to introduce an input statement and a concatenation operator you can try some personalized messages. None of this makes for any thing but a slightly different trivial exercise.
With text based console applications there isn’t much you can do though. It’s a lot of work to add loops so early for example. On the other hand with Visual Basic and C# from Visual Studio beginners can get graphic easily without writing any code. For years I have been using a version of the Fahrenheit/Celsius conversion that doesn’t require more than two lines of code with both of them being assignment statements. I use a form with two labeled label boxes and a slider bar.
The two lines of code can be as simple as
Label1.Text = VScrollBar1.Value
Label2.Text = ((Val(Label1.Text) - 32.0) * (5.0 / 9.0))
In this case I am taking advantage of some explicit type conversions of course and a little “hand waving” and “we’ll explain more of this later” but most students with some understanding of algebra should be able to handle it. You also have to spend a few minutes explaining setting some object parameters but that is a basic thing that will pay off later. It’s useful I think to get it in early as well. The result is an interactive routine that students can play around with.
The next benefit is that you can turn students loose and ask them to modify it to do other conversions. Currency, weights (Imperial to metric), volume or any of many that students may find interesting. This lets students take a little ownership and experiment a little in a safe simple project.
So what do you think? Is this too much for a “Hello world” replacement or does a little additional complexity pay off in building early interest? Have you tried something to replace “Hello world” and if so what works for you?
Comments
Anonymous
March 22, 2010
I usually test any new GUI library with simple two textedit and one button. when button is clicked text from textedit 1 is copied to textedit 2. this could be harder that your hello world , but it shows a lot about GUI library and how it is working.Anonymous
March 22, 2010
I've done something like that a few times. It is even more interesting if you set the fonts of the two boxes differently. Students seeem to like Wingdings. :-)Anonymous
March 22, 2010
The comment has been removedAnonymous
March 23, 2010
The comment has been removedAnonymous
March 25, 2010
I would disagree. "Hello World" has one aim in life for a person learning programming from scratch, and that is as a confidence builder. To give you are example from Microsoft Visual C# 2008 - Step by Step, the Hello World example introducts the student to: a. Creating a Project. b. The Solution Explorer. c. Intellisense. Which is enough to take on board, without making the first program more complicated than "Hello World".Anonymous
March 26, 2010
The comment has been removedAnonymous
March 26, 2010
The comment has been removedAnonymous
March 27, 2010
The comment has been removed