Computer program

From Citizendium
Jump to navigation Jump to search
This article is a stub and thus not approved.
Main Article
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
This editable Main Article is under development and subject to a disclaimer.

A computer program is a set of instructions to be executed by a computer. On the lowest level, computer programs consist of very simple operations such as adding two numbers and storing the result. When very many simple operations are combined, complex programs can be formed. Many computer programs are of the type that take some input (such as text from a keyboard or pictures from a camera) and produce some predictable output (such as text printed on a screen or sent to a printer). The main problem of computer programming is how to put simple operations together in a way that is effective and easy for humans to understand.

Computer programs can be as simple as a block of code that outputs the text "Hello world!" or complex enough to browse the Internet and display web pages. One example of a rather complex program would be the Mozilla Firefox web browser. Very often programs are written to run on top of an operating system, which in turn manages the hardware resources of a computer. This ensures that several programs can coexist on one computer.

Ultimately, every computer program must be translated into machine code: ones and zeroes, since that is the only language a computer can understand. All possible instructions are numbered, so the 'add' instruction might be number 42 on a given computer. Such instruction numbers are hard for humans to memorise, why the assembly language was invented. Assembly language replaces the machine code with word mnemonics, so that the programmer can write 'add' instead of 42. This makes programs somewhat easier to write.

In modern times typically if one chooses to write a program, a programming language is chosen (such as C or Python). Such high-level languages are more abstract than machine code or assembler, so that one high-level instruction translates to many machine code instructions. Common instructions may then be "open a file" and "sort a list". This makes program development much more efficient and less error-prone, at the expense of some efficiency.

Over time a programmer learns various skills in order to "develop code." Some programmers consider themselves as much artists as engineers.