A computer program is a collection of instructions that describes a task, or set of tasks, to be carried out by a computer. More formally, computer programs can be described as an expression of a computational method written in a computer language.
Computer programs may be categorized along functional lines. These functional categories include application software, operating systems, video games, and compilers, among others. Computer programs embedded in hardware devices are called firmware.
The formal expression of computational methods in a human-readable computer language is often referred to as source code, while the machine-executable expressions of computational methods are commonly referred to as executables, object code, or simply as binaries — a reference to the binary file format commonly used to store the executable code.
Commercial computer programs aimed at end users are commonly referred to as application software by the computer industry, as these programs are focused on the functionality of what the computer is being used for (its application), as opposed to being focused on system-level functionality (for example, as the Windows operating system is). In practice, colloquially, both application software and system software may correctly be referred to as programs, as may the more esoteric firmware — software firmly built into an embedded system.
A computer program exists in a source code form, viewable as a programming language; as a tokenised form, ready to be interpreted; or in machine code form, ready to be executed. (An aside: source code form may also be interpreted.) Computer programs can be divided into two categories — system software and application software. System software is the operating system that couples the computer's hardware with the application software. Application software couples the system software with the user interface.
A computer program is loaded into memory (usually by the operating system) and then executed ("run"), instruction by instruction, until termination, either with success or through software or hardware error.
Before a computer can execute any sort of program (including the operating system, itself a program), the computer hardware must be initialized. This initialization is done in modern PCs by a piece of software stored on programmable memory chips installed by the manufacturer, called the BIOS. The BIOS will attempt to initialize the boot sequence, making the computer ready for higher-level program execution.
Programs vs. data
The executable form of a program (that is, usually object code) is often treated as being different from the data the program operates on. In some cases this distinction is blurred with programs creating, or modifying, data, which is subsequently executed as part of the same program (this is a common occurrence for programs written in Lisp), see self-modifying code.
Computer programming is the iterative process of writing or editing source code, followed by testing, analyzing and refining this code. A person who practices this skill is referred to as a computer programmer or software developer. The sometimes lengthy process of computer programming is usually referred to as software development, with the term software engineering becoming more popular as the process comes to be seen as an engineering discipline.
One approach to this process is team programming, in which each member of the group has equal say in the development process, except for one person who guides the group through discrepancies. Another approach is referred to as peer programming or pair programming.
Computational methods and algorithms
- A computational method must be definite, meaning each step of the algorithm must be precisely defined. Formally defined computer languages meet this criterion by allowing algorithms to be specified in such a way that every statement has a very definite meaning.
- A computational method must have zero or more inputs, or quantities given to it before the algorithm runs.
- A computational method must have one or more outputs which are quantities produced by the method, and will bear some specified relation to the inputs.
- A computational method is generally expected to be effective, meaning that its operations can be performed by hand, accurately and exactly, in a finite amount of time.
Although algorithms are defined to be finite, meaning they must complete in a finite number of steps, computational methods do not have to adhere to this restriction. A computational method theoretically does not have to stop running. Non-finite processes are common in reactive processes, such as operating systems that continually interact with their environment.
- "An expression of a computational method in a computer language is called a program." Knuth, Donald E. (1997). The Art of Computer Programming, Volume 1, 3rd Edition. Boston: Addison-Wesley. pp. pp.5. ISBN 0-201-89683-4.
- Knuth, Donald E. (1997). The Art of Computer Programming, Volume 1, 3rd Edition. Boston: Addison-Wesley. pp. pp.4–5. ISBN 0-201-89683-4.
- Knuth, Donald E. (1997). The Art of Computer Programming, Vol. 2, 3rd Ed. Addison-Wesley. ISBN 0-201-89684-2. Check date values in:
- Knuth, Donald E. (1997). The Art of Computer Programming, Vol. 3, 3rd Ed. Addison-Wesley. ISBN 0-201-89685-0. Check date values in:
zh-min-nan:Tiān-náu thêng-sek be-x-old:Праграма bs:Računarski program ca:Programa informàtic cs:Počítačový program de:Computerprogramm et:Arvutiprogramm fa:برنامه (رایانه) ga:Ríomhchlár ko:프로그램 hr:Računalni program io:Programo id:Program komputer is:Tölvuforrit it:Programma (informatica) he:תוכנית מחשב kk:Компьютерлік бағдарлама lo:ໂປແກມ ຄອມພິວເຕີ lv:Datorprogramma nl:Computerprogramma simple:Computer program fi:Tietokoneohjelma sv:Datorprogram th:โปรแกรมคอมพิวเตอร์ ur:شمارندی برنامج yi:קאמפיוטער פראגראם