Computer program: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Thomas H. Larsen
(Re-wrote first paragraph.)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{subpages}}
{{subpages}}


A '''computer program''' is, at the most basic level, a set of instructions to be executed by a computer. Often, a computer program will go through multiple stages of processing until it is in a form that the computer can handle correctly. Computer programs are often likened to [[recipe]]s, since they are built up of instructions (usually called "statements" or "commands"), accept input, and result in output being produced.
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 "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.
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.


Generally programs are written to run on top of an [[operating system]], which in turn manages the hardware resources of a 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.


There are a myriad of various ways to write a computer program. On a basic level one could write [[machine code]] designed to run directly on top of [[hardware]]. This is a tedious task, and several other methods to create programs have evolved over the [[history of computing]]
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]], [[Java programming language|Java]] or [[Python programming language|Python]]) and then the [[syntax]] of that language is learned. 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.[[Category:Suggestion Bot Tag]]

Latest revision as of 16:01, 31 July 2024

This article is a stub and thus not approved.
Main Article
Discussion
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.