Hello world program
Encyclopedia
A "Hello world" program is a computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 that outputs "Hello world" on a display device
Display device
A display device is an output device for presentation of information in visual or tactile form...

. Because it is typically one of the simplest programs possible in most programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

s, it is by tradition
Tradition
A tradition is a ritual, belief or object passed down within a society, still maintained in the present, with origins in the past. Common examples include holidays or impractical but socially meaningful clothes , but the idea has also been applied to social norms such as greetings...

 often used to illustrate to beginners the most basic syntax of a programming language, or to verify that a language or system is operating correctly.

In a device that does not display text, a simple program to produce a signal, such as turning on an LED
Light-emitting diode
A light-emitting diode is a semiconductor light source. LEDs are used as indicator lamps in many devices and are increasingly used for other lighting...

, is often substituted for "Hello world" as the introductory program.

Purpose

A "hello world" program has become the traditional first program that many people learn. In general, it is simple enough that people who have no experience with computer programming can easily understand it, especially with the guidance of a teacher or a written guide. Using this simple program as a basis, computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

 principles or elements of a specific programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 can be explained to novice programmers. Experienced programmers learning new languages can also gain a lot of information about a given language's syntax and structure from a hello world program.

In addition, hello world can be a useful sanity test
Sanity test
A sanity test or sanity check is a basic test to quickly evaluate whether a claim or the result of a calculation can possibly be true. It is a simple check to see if the produced material is rational...

 to make sure that a language's compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

, development environment
Development environment
In hosted software development, a development environment refers to a server tier designated to a specific stage in a release process....

, and run-time environment are correctly installed. Configuring a complete programming toolchain
Toolchain
In software, a toolchain is the set of programming tools that are used to create a product...

 from scratch to the point where even trivial programs can be compiled and run can involve substantial amounts of work. For this reason, a simple program is used first when testing a new tool chain.

"Hello world" is also used by computer hackers as a proof of concept
Proof of concept
A proof of concept or a proof of principle is a realization of a certain method or idea to demonstrate its feasibility, or a demonstration in principle, whose purpose is to verify that some concept or theory that has the potential of being used...

 that arbitrary code can be executed through an exploit
Exploit (computer security)
An exploit is a piece of software, a chunk of data, or sequence of commands that takes advantage of a bug, glitch or vulnerability in order to cause unintended or unanticipated behavior to occur on computer software, hardware, or something electronic...

 where the system designers did not intend code to be executed—for example, on Sony's PlayStation Portable
PlayStation Portable
The is a handheld game console manufactured and marketed by Sony Corporation Development of the console was announced during E3 2003, and it was unveiled on , 2004, at a Sony press conference before E3 2004...

. This is the first step in using homemade content ("home brew
Homebrew (video games)
Homebrew is a term frequently applied to video games or other software produced by consumers to target proprietary hardware platforms not typically user-programmable or that use proprietary storage methods...

") on such a device.

History

While small test programs existed since the development of programmable computer
Computer
A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...

s, the tradition of using the phrase "Hello world!" as a test message was influenced by an example program in the seminal book The C Programming Language
The C Programming Language (book)
The C Programming Language is a well-known programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as co-designed the Unix operating system with which development of the language was closely intertwined...

. The example program from that book prints "hello, world" (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories
Bell Labs
Bell Laboratories is the research and development subsidiary of the French-owned Alcatel-Lucent and previously of the American Telephone & Telegraph Company , half-owned through its Western Electric manufacturing subsidiary.Bell Laboratories operates its...

 internal memorandum by Brian Kernighan
Brian Kernighan
Brian Wilson Kernighan is a Canadian computer scientist who worked at Bell Labs alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix. He is also coauthor of the AWK and AMPL programming languages. The 'K' of K&R C and the 'K' in AWK both stand for...

, Programming in C: A Tutorial, which contains the first known version:

main
{
printf("hello, world\n");
}


The first known instance of the usage of the words "hello" and "world" together in computer literature occurred earlier, in Kernighan's 1972 Tutorial Introduction to the Language B, with the following code:

main {
extrn a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';


For modern languages, the hello world program tends to subtly grow in sophistication. For example, the Go programming language introduced a multilingual hello world program, Sun
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 demonstrated a Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 hello world based on scalable vector graphics
Scalable Vector Graphics
Scalable Vector Graphics is a family of specifications of an XML-based file format for describing two-dimensional vector graphics, both static and dynamic . The SVG specification is an open standard that has been under development by the World Wide Web Consortium since 1999.SVG images and their...

, and the XL programming language features a spinning Earth hello world using 3D graphics.
Wikipedia
Wikipedia
Wikipedia is a free, web-based, collaborative, multilingual encyclopedia project supported by the non-profit Wikimedia Foundation. Its 20 million articles have been written collaboratively by volunteers around the world. Almost all of its articles can be edited by anyone with access to the site,...

 founder Jimmy Wales
Jimmy Wales
Jimmy Donal "Jimbo" Wales is an American Internet entrepreneur best known as a co-founder and promoter of the online non-profit encyclopedia Wikipedia and the Wikia company....

 announced during his presentation in Tuscaloosa's Ferguson Center Theater on September 2010 that Wikipedia's first live page was a 'Hello World' page.

Variations

There are many variations on the punctuation and casing of the phrase. Variations include the presence or absence of the comma and exclamation mark, and the capitalization of the 'H', both the 'H' and the 'W', or neither. Some languages are forced to implement different forms, such as "HELLO WORLD!", on systems that only support capital letters, while many "hello world" programs in esoteric languages
Esoteric programming language
An esoteric programming language is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke...

 print out a slightly modified string. For example, the first non-trivial Malbolge
Malbolge
Malbolge is a public domain esoteric programming language invented by Ben Olmstead in 1998, named after the eighth circle of hell in Dante's Inferno, the Malebolge....

 program printed "HEllO WORld", this having been determined to be good enough
Principle of good enough
The principle of good enough is a rule for software and systems design. It favours quick-and-simple designs over elaborate systems designed by committees. Once the quick-and-simple design is deployed, it can then evolve as needed, driven by user requirements...

.

There are variations in spirit, as well. Functional programming
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 languages, like Lisp, ML and Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

, tend to substitute a factorial
Factorial
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n...

 program for Hello World, as the former emphasizes recursive techniques, which are a large part of functional programming, while the latter emphasizes I/O, which violates the spirit of pure functional programming by producing side effects.

The Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

 and Ubuntu
Ubuntu (operating system)
Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu...

 Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 distributions provide the "hello world" program through the apt
Advanced Packaging Tool
The Advanced Packaging Tool, or APT, is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants...

 packaging system; this allows users to simply type "apt-get install hello" for the program to be installed, along with any software dependencies. While of itself useless, it serves as a sanity check and a simple example to newcomers of how to install a package. It is significantly more useful for developers, however, as it provides an example of how to create a .deb package, either traditionally or using debhelper
Debhelper
debhelper is a suite of programs originally written by Joey Hess that help a Debian packager write rules files. A rules file is a makefile that contains instructions for building and creating a Debian package.- Overview :...

, and the version of hello used, GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 hello, serves as an example of how to write a GNU program.

See also

  • "99 Bottles Of Beer" as used in computer science
  • Foobar
    Foobar
    The terms foobar /ˈfʊːbɑː/, fubar, or foo, bar, baz and qux are sometimes used as placeholder names in computer programming or computer-related documentation...

  • Hello world program examples
    Hello world program examples
    The Hello world program is a simple computer program that prints the string "Hello World". It is typically one of the simplest programs possible in almost all computer languages, and often used as first program to demonstrate a programming language. As such it can be used to quickly compare syntax...

  • Just another Perl hacker
    Just another Perl hacker
    Just another Perl hacker, or JAPH, typically refers to a Perl program which prints "Just another Perl hacker," . Short JAPH programs are often used as signatures in online forums, or as T-shirt designs...

  • List of basic computer science topics
  • Trabb Pardo-Knuth algorithm
    Trabb Pardo-Knuth algorithm
    The Trabb Pardo–Knuth algorithm is a program introduced by Donald Knuth and Luis Trabb Pardo to illustrate the evolution of computer programming languages....

  • At Wikibooks
    Wikibooks
    Wikibooks is a Wiki hosted by the Wikimedia Foundation for the creation of free content textbooks and annotated texts that anyone can edit....

    :
    • Algorithm Implementation/Mathematics/Fibonacci Number Program
    • Computer Programming/Hello world


External links



  • Hello World collection with 400+ programs, including "Hello World" in 60+ human languages
  • MSDN – "Hello Data" example database
  • HelloWiki.org, a wiki based Hello World collection, with helpful comments and links for starting.
  • Hello World! Visual Prolog Video Tutorial demonstrates basic IDE features while creating a Visual Prolog
    Visual Prolog
    Visual Prolog, also formerly known as PDC Prolog and Turbo Prolog, is a strongly typed object-oriented extension of Prolog. As Turbo Prolog it was marketed by Borland, but it is now developed and marketed by the Danish firm Prolog Development Center that originally developed it...

    "Hello World!" program.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK