Ask anybody who knows how to open a text editor and write a line of code what the first thing they wrote was, and you are likely to get the same answer: Hello World. Any textbook, any blog, any tutorial, all start with Hello World. It's seems like it's so simple, but it really shows the variation between languages:
C
Wikipedia - "Hello, World!" program
main( ) { printf("hello, world"); }
(The first known implementation of the program documented)
C++
cplusplus.com - Structure of a program
#include <iostream> int main() { std::cout << "Hello World!"; }
Objective C
binpress - Objective-C Lesson 1: Hello, World!
#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello, World!"); [pool drain]; return 0; }
Funny story, this all started at a wonderful place called Bell Labs. Any geek / nerd knows about Bell Labs. Bell Labs was a mecha for technological advancement, founded by AT&T in 1925, during the last century. It was a place where science and engineering could happen and flow. At it's founding, 4,000 scientists and engineers were assigned there. The founding of Bell Labs was the first of it's kind, and attributed to many technologies that are core to the world we know today: - radio astronomy - the transistor - the laser - information theory - the UNIX operating system - the C programming language - the C++ programming language
It's safe to say, without Bell Labs, I wouldn't be posting this article on the internet. (Wikipedia - Bell Labs, Bell Labs - History of Bell Labs) So, what's the story? How did it happen?
In 1974 a Canadian Computer Scientest by the name of Brian Kernighan circulated an internal memorandum entitled Programming in C: A Tutorial. In it was the C example shown above. This memorandum eventually made it's way beyond Bell Labs, and Hello World started to spread as viraly as the next video of cute pandas cuddling in a Chinese Zoo. Anyways, all good coders reuse code. It turns out this was not necessarily the first version of the program, but an adaptation of another version he had wrote two years earlier in A Tutorial Introduction to the Language B.
main(){ extrn a,b,c; putchar(a); putchar(b); putchar(c); putchar('!*n'); } a 'hell'; b 'o, w'; c 'orld';
But why do in 7 lines of code what you can do in three? Hence the beginning of the march towards yet another programming language...