Computer program: Difference between revisions
imported>Johan Förberg (Rewrote most of the article) |
imported>Meg Taylor No edit summary |
||
Line 5: | Line 5: | ||
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 page|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. | 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 page|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 | 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 programming language|C]] or [[Python programming language|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. | In modern times typically if one chooses to write a program, a [[programming language]] is chosen (such as [[C programming language|C]] or [[Python programming language|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. | Over time a ''programmer'' learns various skills in order to "develop code." Some programmers consider themselves as much artists as engineers. |
Revision as of 08:56, 16 July 2013
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.