hello, world

lore

programmingops culture

The tiny program that just prints a greeting, traditionally the first thing you write in a new language.

Brian Kernighan used 'hello, world' in a 1972 B tutorial and then in the 1978 C book, and the ritual spread to nearly every language since. It is the universal smoke test - if it prints, your toolchain works and you can start.

The tradition of making a first program print hello, world comes from Kernighan's work at Bell Labs, appearing in a 1972 tutorial and then in The C Programming Language, which fixed it as the universal starting point. Almost every language tutorial since has opened the same way.

Its function is pedagogical and mostly invisible to the learner. Printing a fixed string is trivial; getting a machine to run it requires that the environment is installed, the toolchain works, the file is in the right place, the build command is correct, and the output goes somewhere you can see. The program tests everything except the program, which is why it is the right first step and why failure at that stage is so demoralizing.

It has also become a benchmark of a different kind. The size of a hello world binary, the time to build it, and the ceremony required before printing a string are all rough measures of a platform's overhead, and the growth of that ceremony over decades is a fair proxy for the accumulated complexity of modern development. A greeting that fits on one line now routinely requires a project scaffold, and that says something.

Also known as: hello world, Hello, World!

Sources

  • Kernighan, 'A Tutorial Introduction to the Language B' (1972); Kernighan & Ritchie (1978)

All glossary entries