What Is A Hello World Program And Why Is It Used In Coding?
The first program anyone is likely to code, whether they are playing with a new programming language or are taking part in an after-school coding club for the first time, is to get the computer to say hello to you.
This is known as a Hello World program, because the result of a successful program is that the computer, programming language or device will print the words “hello, world” onto the screen.
There are literally hundreds of Hello World programs out there, and it is such a useful metric that TTHW (Time To Hello World) is a commonly used metric to showcase how simple a computer is to program for or a programming language is to learn.
Where did it come from? Why is it still used? And why is it still so fun for two simple words to appear on a screen?
Who Invented The Hello World Program?
The inventor of Hello World is believed to be Brian Kernighan, one of the developers of Unix and the writer of the first book about the C programming language still used today, although there are claims that an earlier version was programmed in BCPL.
Testing programs have existed since computers have, but Mr Kernighan first used the word as part of his 1972 tutorial on the B programming language, a precursor to C.
The use of “hello, world” showcased a limitation in B that was not seen in his later tutorial on C, which was that character constants (the C term for fixed variables that cannot be changed later) were limited to four characters. Another tutorial example used the much shorter “hi!”.
Why Is Hello World Still Used?
Part of the reason is that it’s such a friendly expression; we love giving computers a personality, and having “hello world” is like an initial message of life.
It is also used because it is somewhat revealing about how easy or difficult some programming languages are to code for; a Python Hello World program is one very short line (“print("Hello, world")”), whilst C++ requires an imported library, an entry point and a call to output text.