I distinctly remember the day I started learning my first programming language. I was sitting in front of a computer with a blue screen (which I later realized was the code editor), as clueless as the guy next to me, waiting for the slightest hint of help from the instructor. Thankfully, we did have help with our first program. I know I failed to mention what programming language I was learning, so just to get that out of the way, it was 'C'. The instructor asked us to include the header for our first program, and I was one of the few people that managed to type "#include
"; the rest were still in a state of shock at having to write an entire computer program by themselves (Note that this was a period when computers were considered aliens and writing a computer program was something that was reserved strictly for the nerdiest of nerds). After I had my opening and closing braces in place to fit my code within, the instructor proceeded to inform us that we would be writing a simple program to display a line on the computer screen. Naturally, I continued to add a printf statement to my code, which would display whatever I typed within it on the screen, and waited for further instructions. He asked us to display the sentence (or string as he called it) "hello, world!" on the screen. Though I was a little amused at why we were asked to type something completely irrelevant and alien to the current situation, I followed blindly and successfully got the message to display on my screen. Little did I know then that I was signing up for an endless barrage of "hello, world"s in the days to come. For the next few months, "hello, world" faded into the recesses of my mind with more complicated programs keeping me busy. I realized that I loved programming and within a few months, I had made up my mind that I would be pursuing computer science as a degree.
Years later, during my second year of undergraduate college, we were introduced to a new programming language called "C++" which improved on a few aspects of "C" language and made it easier and more flexible for programmers. I was looking forward to my first class. Our lecturer came in and told us that we would be starting with some practical experience in coding. She asked us to open our editors (which was still the boring blue background text-based editor) and type in the command "#include". She told us that the iostream library in C++ was similar to the stdio library in C, albeit with more intuitive functions. After that she asked us to add the line, cout<<"hello, world";. Though it brought back memories of my first C program, I obliged without questioning and displayed my first "hello, world" in C++. Weeks passed, and I started to enjoy coding in C++. It was truly wonderful with all its functions and features that let the programmer have a great degree of control over the data he manipulated. Soon, I was coding fairly complex programs in C++, and got through my examination with a good score.
During my next year at college, I had a new language in my curriculum - Java. Looking forward to another programming language, I walked into my first Java lecture and found myself typing the command System.out.printLn("hello, world"). By now, it had become a ritual to start any programming language with the cryptic message that had puzzled me years ago in my first programming class. I went on to write better programs in Java, but "hello, world" was a mystic code to me, a piece of puzzle that I knew I had to fit in, but did not know how or why.
Now, after almost six years, I am learning a new programming language, xcode - for programming iPhone applications. Any guesses about the first program I coded?
Why does "hello, world" start off a programming language, has been a nagging question that has lingered in my head for quite a while now. All my searches and exploring have led to the common answer - "hello, world" was the sentence used by Kernighan and Ritchie in the introductory chapter of their 'C programming' book. Still, it is amusing that none of the other authors/languages have not tried breaking the tradition; everyone continues using "hello, world" as the gateway to the expanses of every programming language. Let's hope that the jinx is broken soon and the next generation of programmers start their coding life with something 'cooler' than "hello, world".