DEV Community

Cover image for Why do we use Hello World? - the history behind it
leo
leo

Posted on

Why do we use Hello World? - the history behind it

Hello World!
Oh wait... Hello everyone!

I got bored today and did some intense research on the history of Hello World!. My mission (of finding out why us programmers use "Hello World!" instead of something like a simple "Hi", "Test" or random key spam) succeeded and I felt like sharing this truly mindblowing history with the DEV community.


~ Where it all started

The first time "Hello World" was exposed to the public wasn't actually through IT, but through the radio. Back in the 1950's it was used as a catchphrase by William Williams.
The genius that brought Hello World! to the programming space appears to be the one and only Brian Kernighan.
It is unclear whether it was first used in the B Language or in BCPL (released 1967). It certainly was mentioned and had an appearance in both languages, however Brian didn't publicly mention it for quite some time after the BCPL release.
He first publicly referenced these legendary 2 words in his work The Programming Language B for the publishers of the language, bell-labs. While the language itself was published all the way back in 1969, his Introduction to it was written 3 years later, in 1972.

Ever since then Brian seemed to enjoy including Hello World! in his books, for example in another work for bell-labs titled "Programming in C" (1974).

But through these 2 publications Hello World! didn't gain any real traction.
That was until Kernighan decided to put it in yet another book (this time not for bell-labs) which he wrote with the developer of C (Dennis Ritchie). It bears the simple title "The C Programming Language" and was released back in 1978.


~ Why?

So here I will cover 3 different things, firstly, why is Hello World! even used, and second, why the hell it is "Hello World!" and not something else, and last but not least, why did it get so popular?.

Why do we use Hello World as our first program?

Everyone used it at least once. But why? Well, to put it simply, to check if everything works. If you run your program and see an output, you can be certain that your compiler and all environments have been installed successfully and correctly. While this was more necessary back in the day, it became a tradition for newbies to write Hello World. This might also be because it is commonly used to teach the most basic syntax of a language!

Why exactly "Hello World"

The question about why exactly us developers use "Hello World" instead of a simple "Test", "Hi" or some random key spam, was hard to research. But I managed to find a few things.

So the use of Hello World actually dates back to the book on the B language. Back then it was used to display the functionality of variables. Since "hi" was too simple there was a need for an option that required more character constants. So basically it was used to explain the basics of B since in B you can only store up to 4 (ASCII) characters in one constant/variable.
It was used due to it's functionality!

Why is it so popular?

But why did it get so damn popular, and especially when? Well to understand why it is so popular, we should take a look at the old alternatives.
Here we have this intimitating line: MY HUMAN UNDERSTANDS ME. This glorious line was brought to the masses by Bob Albrecht through his book My Computer Likes Me When I Speak in BASIC which was published in the same year as the work that exposed Hello World to the public for the first time (1972). The mentioned line wasn't very widely spread, however, it was at least something that could have been used as a first program by the ancient developers.

So at this point it may appear obvious why it gained so much popularity. It's simplicity and also functionality allowed "Hello World" to be way more popular then the previously mentioned version. While having the same effect, Hello World managed to show the "student" what they are supposed to do in a more effective and easy way.
However, it only gained traction with the release of Brian and Dennis' book on the C language in 1978. Due to Cs' rising popularity more and more people got to know the line and implemented it in their code while learning. After a while, it became a tradition that is still being used to this day in many different languages to get familar with the most basic syntax of the language:
B:

main( ) {
    extern a, b, c;
    putchar(a); putchar(b); putchar(c); putchar('!*n');
}

a 'hell';
b 'o, w';
c 'orld';
Enter fullscreen mode Exit fullscreen mode

BCPL:

get "streams.d"
external
[
Ws
]

let Main() be
[
Ws("Hello World!*N")
]
Enter fullscreen mode Exit fullscreen mode

C:

#include <stdio.h>
int main() {
   printf("Hello World!");
   return 0;
}
Enter fullscreen mode Exit fullscreen mode

Python:

print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

Java:

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!"); 
    }
}
Enter fullscreen mode Exit fullscreen mode

Go:

package main

import "fmt"
func main() {
    fmt.Println("Hello World!")
}
Enter fullscreen mode Exit fullscreen mode

Brainfuck:

>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<+
+.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-
]<+.
Enter fullscreen mode Exit fullscreen mode

...and many many more!


~ Outro

Hello World is an amazing tradition since many years, decades even. While it first used to make an example more complex, it is nowadays being used to not just test code but also to teach new programmers the most basic syntax of a language.
Also, it's quite lucky that Brian got to write the book on C. Otherwise we would probably still be stuck on getting screamed at when executing our "Hello World" program.

No need to thank me for this useless information, though any feedback would be highly appreciated! Maybe I will find some other useless topic to talk about in the future!
With that being said, have a great rest of your day :)

~ Sources:

https://en.wikipedia.org/wiki/%22Hello,_World!%22_program
https://www.thesoftwareguild.com/blog/the-history-of-hello-world/
https://www.bell-labs.com/usr/dmr/www/bintro.html
https://en.wikipedia.org/wiki/B_(programming_language)

Top comments (18)

Collapse
 
djquecke profile image
DJ Quecke • Edited

I'm mildly insulted by your term "ancient developers" but that aside, I started learning BASIC in high school on a IBM 360 computer in 1976 and "Hello World" was my first program then. You might want to check IBM BASIC documentation for teachers from that period. I did enjoy your article and like to think I'm approaching "ancient" but not quite there yet.

Collapse
 
just5moreminutes profile image
leo • Edited

Using the term ancient probably was a little harsh, sorry about that!
I'll check the documentation and maybe expand on some points or re-write my article partially :)
Thank you so much for your feedback!
++++
UPDATE: I did intensive research and looked through several BASIC manuals, documentations and books from around 1976, but I sadly didn't find anything!
Still, thank you so much for mentioning that! :) I'm sure it was used a lot for teaching, though it seemingly wasn't yet mentioned in any books...

Collapse
 
djquecke profile image
DJ Quecke

Late night crusing and I found a couple of links I think.
Dartmouth was way ahead of the times in the 60's when they first developed time sharing on a mainframe. Then they developed the BASIC language for these mainframe terminals.

When time sharing was introduced on the IBM\360 they provided the PL/1 and BASIC languages to the terminal users. I also have been unable to find a reference for BAISC on the 360 although I am certain I used it '76, my senior year of high school.

There is a pretty good article at:

time.com/69316/basic/

I also found the textbook I used for APL in '76.

softwarepreservation.org/projects/...

Interesting stuff. Powerful language.

Thanks for your article, it got me thinking of my earliest days with computers.

Collapse
 
just5moreminutes profile image
leo • Edited

Disclaimer: I'm very sorry for the late response!

wow, it's been a while since I last checked up on DEV and I was quite surprised to see any traction on this post!

Anyway, thank you very much for the two links and the additional research! I read through the article and it was very interesting. I learned a lot of new things from it and it was especially exciting to get to know how computers and programming became more mainstream thanks to BASIC. It truly seems to be a powerful language, thanks for sharing the article!

I'm currently checking out the textbook.

Also, I'm glad you enjoyed the article, thank you very much for reading, giving feedback and doing some more research!

Collapse
 
pauldubois777 profile image
Paul DuBois

What about "Hello World" in 6809 assembler for the Radio Shack Color Computer!

* FILENAME: HELLO.ASM
* CLEARS SCREEN, PRINTS "HELLO WORLD" AND
* WAITS FOR KEYPRESS

    ORG $2A00

START
* CREATE NEW STACK
    STS OLDS
    LDS #24+STK

* CLEAR THE SCREEN
    JSR $A928

* PRINT THE MESSAGE     
    LDX #MESG
LOOP    LDA ,X+
        BEQ KEY

* CALL CHROUT
    JSR [$A002]
    BRA LOOP

* WAIT FOR KEYPRESS        
KEY JSR [$A000]
    BEQ KEY

* RESTORE STACK
    LDS OLDS

* RETURN TO BASIC
DONE    RTS

* DATA
MESG    FCC /HELLO WORLD/
    FCB 13
    FCB 0
OLDS    RMB 2
STK RMW 12
    END START
Enter fullscreen mode Exit fullscreen mode

Courtesy of TRS-80 Coco 6809 ASM Hello World

Collapse
 
acoh3n profile image
Arik

Now, that's code.

Collapse
 
pauldubois777 profile image
Paul DuBois

Thanks for your post.

There is actually a movie called, "Hello World". It's a great movie about inclusion and diversity in the software-developer world.

Hello World - Confronting Bias in Software Development

Collapse
 
just5moreminutes profile image
leo

Oh wow! I haven't heard of that one yet! Certainly a movie I will add to my watchlist, thanks! :)

Collapse
 
guillep2k profile image
Guillermo Prandi

In my not researched opinion, Hello World is a simpler phrase than "My human understands me", so people to which English is not their first language it might have been more easy to grasp.

Collapse
 
just5moreminutes profile image
leo

That certainly also was a reason! Thanks for mentioning that, I sort of overlooked, and didn't think of it, while researching!

Collapse
 
codebykeoma profile image
Keoma Mallett

I enjoyed reading this!

Collapse
 
andypiper profile image
Andy Piper

Nice bit of research, thanks for sharing this.

Collapse
 
just5moreminutes profile image
leo

No problem :)
Thank you so much for the feedback!

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Thank you very much, I didn't know this piece of history, yet. But the book's name is "The C Programming Language".

Collapse
 
just5moreminutes profile image
leo

Oh, oops! I switched some things up! I changed it :)
Thanks for the feedback!

Collapse
 
mohammed5rafi profile image
Muhammed Rafi

thaks for the qustions i have the same doubt for a while

Collapse
 
mandaputtra profile image
Manda Putra

Famous hellow world song youtube.com/watch?v=Yw6u6YkTgQ4

Collapse
 
ifierygod profile image
Goran Kortjie

When the ancient developers created the first hello world program millions of years ago