Computer program

From Example Problems
Jump to navigation Jump to search

A computer program or software program (usually abbreviated to "a program") is a step-by-step list of instructions written for a particular computer architecture in a particular computer programming language. A layman equivalent example would be writing a step-by-step list of instructions in English instructing a human how to make a Peanut butter and jelly sandwich (the human being the specific architecture). More often than not, computer programs are compiled or assembled into non-human readable format. Executable uncompiled programs are referred to as scripts.


The term "program" specifically refers to the blocks of instruction code that are loaded into memory for execution by an interpreter. (See Program Execution below.)

In comparison, the term "software" refers to the computer program and any resources related to it. This would include static data, components (plugins), configuration files, and so on. These resources are usually bundled together into a software package to be distributed.

Software programs (collections of programs and related resources) are most frequently referred to as applications by end-users, as most users are focused on the abilities of application software (application programs) rather than system software. (Users see things differently than programmers.)

Note: The British English spelling programme is, for the most part, no longer used to refer to computer programs, as most internationally-used computing terms use the words (and spelling conventions) adopted in the U.S..

Program Execution

A modern day computer program is loaded into memory (usually by the operating system), interpreted and then executed ("run") instruction by instruction until "program termination", either with success or through computer error. Some primitive types of computers ran instructions encoded in various ways, an example would be punch cards.

Before a computer can execute any sort of program (including the operating system which is also a program) the computer hardware must be initialized. This is done 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 miscellaneous program execution.

Programs vs Data

A program has been defined. Data can be defined as information that is to be processed by some program. When the entire scope of a computer system is taken into account, there are regions where the distinction between the two is not so evident. CPUs sometimes have a set of smaller instructions that control the computer's hardware, data can contain a program that is executed (see Scripting programming language), programs can be written to create another program; all of which making the comparison largely one of perspective. Some deny that the distinction between program and data is useful altogther.

Writing a program to generate a computer program is called metaprogramming. One application of this is have a program generate code according to a certain given data set. A single program might not easily be able to account for all the different aspects of the given data. Analysing the data to create a program that can handle all the aspects might prove easier. Lisp is an example of a language that provides strong support for this aspect of programming.

The weights stored in a neural network are a form of data. It is precisely these weights that, combined with the topology of the network, define the network's behavior. It is unclear what the values of these weights actually represent or whether these weights can be programmed. This and other questions pertaining to artificial intelligence further test the comparison between program and data.


Creating a computer program is the iterative process of implementing new source code (or simply just "code") and testing, analyzing and refining the newly implemented code for syntax and semantic errors. One who practices this skill is referred to as a computer programmer. Since the evolution of computers is so rapid, the tasks of a computer programmer have become more diverse giving rise to different classes of computer programmers, each with a more specialized task. Two examples are a software developer and a systems architect. The lengthy process of computer programming is now referred to as "software development" or software engineering. The latter becoming more popular due to the increasing maturity of the discipline. (see Debate over who is a software engineer)

Hence, a contemporary computer programmer can refer to a specialist in one area of computer programming or to the general mass of programmers working for a software company who implement the bulk of the code in large scale software. A group of programmers working for a software company maybe assigned a lead programmer and a project manager to oversee project development and deadlines. Large scale software usually undergoes a lengthy design phase by a system architect before actual development and cowboy coding is frowned upon.

Two other forms of modern day approaches are team programming where each member of the group has equal say in the development process except for one person who guides the group through discrepancies. These groups tend to be around 10 people to keep the group manageable. The second form is referred to as "peer programming" or pair programming.

See Process and methodology for the different aspects of modern day computer programming.


A formal methodology to solve a particular problem usually combined with a study of different degrees of performance constitute an algorithm. Algorithms can be purely theoretical or implemented by a computer program. Where theoretical algorithms are usually classified in categories according to complexity [1], implemented algorithms are usually profiled to test routines for efficiency. Note that although an algorithm can be theoretically performant, it can be poorly implemented wasting valuable computer resources. (see Algorithmic information theory for more information)

Example of a program (source code)

Addr Label Instruction Object code [2]
.org 2048
a_start .equ 3000
 2048 ld [length],&r1 11000010 00000000 00101000 00101100
 2052 ld [address],%r2   11000100 00000000 00101000 00110000
 2056 addcc %r3,%r0,%r3   10000110 10001000 11000000 00000000
 2060 loop: addcc %r1,%r1,%r0   10000000 10001000 01000000 00000001
 2064 be done  00000010 10000000 00000000 00000110
 2068 addcc %r1,-4,%r1   10000010 10000000 01111111 11111100
 2072 addcc %r1,%r2,%r4   10001000 10000000 01000000 00000010
 2076 ld %r4,%r5   11001010 00000001 00000000 00000000
 2080 ba loop   00010000 10111111 11111111 11111011
 2084 addcc %r3,%r5,%r3   10000110 10000000 11000000 00000101
 2088 done: jmpl %r15+4,%r0   10000001 11000011 11100000 00000100
 2092 length: 20   00000000 00000000 00000000 00010100
 2096 address: a_start   00000000 00000000 00001011 10111000
.org a_start  
 3000 a: 25   00000000 00000000 00000000 00011001
 3004 -10   11111111 11111111 11111111 11110110
 3008 33   00000000 00000000 00000000 00100001
 3012 -5   11111111 11111111 11111111 11111011
 3016 7   00000000 00000000 00000000 00000111

The supplied code is a small program in assembly language written for a virtual computer [3]. The example shows a selection of instructions with the corresponding address in memory where each instruction will be placed. These addresses are not static, see memory management. Accompanying each instruction is the generated (by compilation) object code that coincides with the virtual computer's architecture (or ISA). For more examples, see the hello world program.

See also


  • ^  Miles J. Murdocca & Vincent P. Heuring (2000). Principles of Computer Architecture. Prentice-Hall, Inc. ISBN 0-201-43664-7
  • ^  Principles of Computer Architecture (POCA) – ARCTools virtual computer available for download to execute referenced code, accessed August 24, 2005
  • ^  J.Glenn Brookshear (1989). Theory of Computation, Formal Languages, Automata, and Complexity. The Benjamin/Cummings Publishing Co.Inc. ISBN 0-8053-0143-7

External links

ca:Programa informàtic cs:Program de:Computerprogramm es:programa de ordenador et:Arvutiprogramm fa:برنامه (رایانه) fi:Tietokoneohjelma fr:programme informatique id:Program komputer io:Programo it:programma (informatica) ja:プログラム (コンピュータ) ko:프로그램 lv:Datorprogramma nl:computerprogramma pt:Programa de computador ru:Компьютерная программа simple:Computer program sv:datorprogram th:โปรแกรม zh:程序