Case Study 1: The History of "Hello, World!"
From a Bell Labs Memo to a Global Tradition
Every programmer's journey begins the same way: printing "Hello, World!" to the screen. It's such a universal tradition that it's easy to assume it's been around since the dawn of computing. But every tradition has an origin story, and this one starts with a Canadian computer scientist named Brian Kernighan.
The First Appearance (1972–1978)
The earliest known version of the program appears in a Bell Labs tutorial Kernighan wrote in 1972, A Tutorial Introduction to the Language B, where he used it to show how B could output text. (The Jargon File, a long-running dictionary of hacker slang, claims the phrase goes back further still, to the language BCPL around 1967, but the B tutorial is the earliest version anyone has actually found.) B was a precursor to C — the language that would go on to power operating systems, embedded systems, and much of the software infrastructure we still use today.
The program looked like this in B:
main( ) {
extrn a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
It's barely recognizable compared to modern code. The string "hello, world" is split across three variables (a, b, c), each holding four characters (in B, a character constant could hold at most four). The '!*n' represents an exclamation mark followed by a newline. The program takes seven lines just to print a greeting.
Kernighan reused the example in a 1974 internal memo, Programming in C: A Tutorial. Then, in 1978, "Hello, World!" got its true moment. Kernighan co-authored The C Programming Language with Dennis Ritchie — the person who created C. The book, universally known as "K&R" after the authors' initials, became one of the most influential programming books ever written. Its very first complete example program was:
main()
{
printf("hello, world\n");
}
This version is much more recognizable: a main function and a single printf call. (The 1988 second edition, updated for standard C, added the #include <stdio.h> line you'll see in most modern versions.) It established the pattern that would be repeated billions of times: the first program in a new language prints a greeting to the screen.
Why "Hello, World!" Stuck
There seems to have been no grand plan behind the phrase. Asked about it decades later in an interview with Forbes India, Kernighan admitted his memory was hazy, but recalled having seen a cartoon of a chick hatching from an egg and saying "Hello, World" — and the image stuck with him. Whatever the origin, the choice turned out to be inspired for several reasons:
-
It tests output. The most fundamental thing a program does is produce output. If your "Hello, World!" program runs correctly, you've confirmed that your language, compiler/interpreter, and environment are all working.
-
It's achievable. No loops, no conditionals, no data structures. Just one statement. For someone who has never programmed before, seeing their words appear on screen is a genuine moment of agency — I told the computer to do something, and it did it.
-
It's a shared experience. Every programmer in the world has done this. Whether you write Python, Java, Haskell, Assembly, or any other language, your first program was some variation of "Hello, World!" It's a universal entry point into a global community.
"Hello, World!" Across Languages
The tradition spread to virtually every programming language. Here's how "Hello, World!" looks in several languages, illustrating how language design has evolved over decades:
Python (1991):
print("Hello, World!")
Java (1995):
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
JavaScript (1995):
console.log("Hello, World!");
C++ (1985):
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Rust (2010):
fn main() {
println!("Hello, World!");
}
Assembly (x86, Linux):
section .data
msg db 'Hello, World!', 0xa
len equ $ - msg
section .text
global _start
_start:
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
The contrast is striking. Python needs one line. Assembly needs 14 lines just to load the right values into CPU registers and ask the operating system, twice, to do the work (once to write the text, once to exit). Classic Java wraps its one line of real work in four lines of ceremony: a class declaration and a method signature with three keywords (public static void). Java 25 (2025) finally allows a shorter void main() form for simple programs — proof that the ceremony bothered people. Each language makes different trade-offs between brevity, safety, performance, and explicitness — and "Hello, World!" makes those trade-offs immediately visible.
The Deeper Lesson
"Hello, World!" isn't just a tradition — it's a diagnostic tool. When a developer starts working with a new language, framework, or platform, the first thing they do is get the simplest possible program running. In the industry, this is sometimes called a "smoke test" — does the thing turn on without catching fire?
Professional developers do "Hello, World!" equivalents constantly:
- Starting a new web framework? Create a page that says "It works!"
- Connecting to a new database? Write a query that returns one row.
- Setting up a new CI/CD pipeline? Push a commit that just runs echo "Pipeline works".
The principle is always the same: start with the smallest thing that proves the system works, then build from there. This is decomposition in action — the first pillar of computational thinking from Chapter 1.
Why It Matters for You
When you typed print("Hello, World!") in section 2.4, you joined a tradition that stretches back over 50 years. You used the same strategy that every programmer uses: start small, verify the system works, then build up. That one-line program confirmed that Python is installed and the interpreter is working; running hello.py in section 2.6 then proved your editor, terminal, and Python all work together.
That might seem trivial. It's not. Everything you build in this course — TaskFlow, the grade calculator, Elena's reports, every exercise and project — starts from this foundation. You now have a working development environment, and you know how to use it. The rest is just adding one piece at a time.
Discussion Questions
-
Why do you think "Hello, World!" became the universal first program, rather than something more "useful" like a calculator or a file reader?
-
Look at the Assembly version above. It takes 14 lines to do what Python does in 1. What are the trade-offs? Why would anyone choose to write in Assembly?
-
Kernighan didn't plan for "Hello, World!" to become a tradition. Can you think of other conventions in technology (or other fields) that arose accidentally and became standard practice?
-
The "smoke test" concept — verifying the simplest thing works before building complexity — applies far beyond programming. Where else in life do you use this strategy?