computer programming(redirected from Application programming)
Also found in: Dictionary, Thesaurus.
Related to Application programming: System programming
computer programming[kəm′pyüd·ər ′prō‚gram·iŋ]
Designing and writing computer programs, or sequences of instructions to be executed by a computer. A computer is able to perform useful tasks only by executing computer programs. A programming language or a computer language is a specialized language for expressing the instructions in a computer program.
In this stage, the programmer gains a full understanding of the problem that the computer program under development is supposed to solve, and devises a step-by step procedure (an algorithm) that, when followed, will solve the problem. Such a procedure is then expressed in a fairly precise yet readily understandable notation such as pseudo code, which outlines the essentials of a computer program using English statements and programming language-like key words and structures. See Algorithm
A useful example concerns the problem of finding the greatest common divisor (gcd) of two given positive integers. After an analysis of the problem, a programmer may choose to solve the problem by the procedure described by the following pseudo code. (In the pseudo code, the modulus operator produces the remainder that results from the division of one integer by another; for example, 15 modulus 6 yields 3.)
- 1. Let x and y be the two given integers
- 2. As long an x and y are greater than 0, repeat lines 3–5
- 3. if x is greater than y
- 4. then replace x by the value of x modulus y
- 5. else replace y by the value of y modulus x
- 6. If x is 0
- 7. then y is the gcd
- 8. else x is the gcd
Lines 3–5 and 6–8 are examples of the selection control structure, which specifies alternative instructions and enables a computer to choose one alternative for execution and ignore the other. Lines 2–5 form a repetitive control structure (commonly called a loop), which causes the computer to execute certain instructions (lines 3–5) repeatedly.
Programmers indent to show the structural relationship among the statements and to enhance the readability of the program. In the example, indentation makes it clear that lines 4 and 5 are part of the selection structure beginning at line 3, that lines 3–5 are part of the loop that begins at line 2, and that lines 7 and 8 are part of the selection structure that begins at line 6.
An algorithm developed to solve a given problem should be verified to ensure that it will function correctly. The following list shows how the above procedure derives the gcd of 48 and 18 by successively modifying the values of x and y.
In this stage the pseudocode procedure developed in the problem-solving stage will be expressed in a programming language. There are numerous programming languages, in two broad classes: low-level languages, which are difficult for human programmers to understand and use but can be readily recognized by a physical computer; and high-level languages, which are easier for human programmers to use but cannot be directly recognized by a physical computer. Currently most computer programs are first written in a high-level language and then translated into an equivalent program in a low-level language so that a physical computer can recognize and obey the instructions in the program. The translator itself is usually a sophisticated computer program called a compiler. See Programming languages
Shown below is the gcd-finding procedure written in a widely used high-level language called C++.
The text beginning with/* and ending with */ (the first five lines above) is a program comment. Program comments are not executable instructions and do not affect the functioning of a computer program in any way, but are intended as a way to document a computer program. Appropriate program comments enhance program readability and are considered an important part of a computer program. A more readable program is usually easier to enhance or modify when such needs arise later. The rest of the above text is C++ code (instructions in the language C++) to compute the gcd of two given integers. Indentation in C++ code serves the same purpose as in pseudo code. It is obvious that the above C++ code closely parallels the pseudo code developed previously, as they both express the same abstract procedure.
Object-oriented programming is a way to structure a computer program. The object-oriented paradigm has gained widespread acceptance and is supported by such widely used languages as C++ and Java. An object includes relevant data and operations on the data as a self-contained entity. Interaction with an object can be made by invoking the object's operations. Each object is an instance of an object class. Object classes may be related by inheritance; one class may be a subclass (specialization) of another class. At the center of an object-oriented program design is a collection of objects that represent entities in the application domain. Identifying the objects and object classes, the relationship among the object classes, and the interactions among the objects is a major issue in designing an object-oriented program. See Object-oriented programming
Although many widely used programming languages are processed by compilation into machine-executable instructions, some programming languages (for example, LISP and Prolog) are usually interpreted instead of being compiled. When a computer program is interpreted, it is directly executed by another program called an interpreter without being translated into low-level, machine-executable instructions. Some other languages are processed by a hybrid approach. For example, a program in the language Java is first compiled into an equivalent program in an intermediate-level language, which is executed by an interpreter. See Computer, Digital computer