Information about Imperative (programming)

In computer science, imperative programming, as contrasted with declarative programming, is a programming paradigm that describes computation as statements that change a program state. In much the same way as the imperative mood in natural languages expresses commands to take action, imperative programs are a sequence of commands for the computer to perform. Procedural programming is a common method of executing imperative programming, and the terms are often used as synonyms.

Imperative programming languages stand in contrast to other types of languages, such as functional and logical programming languages. Functional programming languages, such as Haskell, are not a sequence of statements and have no global state as imperative languages do. Logical programming languages, like Prolog, are often thought of as defining "what" is to be computed, rather than "how" the computation is to take place, as an imperative programming language does.

Overview

The hardware implementation of almost all computers is imperative; nearly all computer hardware is designed to execute machine code, which is native to the computer, written in the imperative style. From this low-level perspective, the program state is defined by the contents of memory, and the statements are instructions in the native machine language of the computer. Higher-level imperative languages use variables and more complex statements, but still follow the same paradigm. Recipes and process checklists, while not computer programs, are also familiar concepts that are similar in style to imperative programming; each step is an instruction, and the physical world holds the state. Since the basic ideas of imperative programming are both conceptually familiar and directly embodied in the hardware, most computer languages are in the imperative style.

Assignment statements, in general, perform an operation on information located in memory and store the results in memory for later use. High-level imperative languages, in addition, permit the evaluation of complex expressions, which may consist of a combination of arithmetic operations and function evaluations, and the assignment of the resulting value to memory. Looping statements allow a sequence of statements to be executed multiple times. Loops can either execute the statements they contain a predefined number of times, or they can execute them repeatedly until some condition changes. Conditional branching statements allow a block of statements to be executed only if some condition is met. Otherwise, the statements are skipped and the execution sequence continues from the statement following the block. Unconditional branching statements allow the execution sequence to be transferred to some other part of the program. These include the jump, called "goto" in many languages, and the subprogram, or procedure, call.

History

The earliest imperative languages were the machine languages of the original computers. In these languages, instructions were very simple, which made hardware implementation easier, but hindered the creation of complex programs. FORTRAN, developed by John Backus at IBM starting in 1954, was the first major programming language to remove the obstacles presented by machine code in the creation of complex programs. FORTRAN was a compiled language that allowed named variables, complex expressions, subprograms, and many other features now common in imperative languages. The next two decades saw the development of a number of other major high-level imperative programming languages. In the late 1950s and 1960s, ALGOL was developed in order to allow mathematical algorithms to be more easily expressed, and even served as the operating system's target language for some computers. COBOL (1960) and BASIC (1964) were both attempts to make programming syntax look more like English. In the 1970s, Pascal was developed by Niklaus Wirth, and C was created by Dennis Ritchie while he was working at Bell Laboratories. Wirth went on to design Modula-2, and Oberon. For the needs of the United States Department of Defense, Jean Ichbiah and a team at Honeywell began designing Ada in 1978, after a 4-year project to define the requirements for the language. The specification was first published in 1983, with revisions in 1995 and 2005/6.

The 1980s saw a rapid growth in interest in object-oriented programming. These languages were imperative in style, but added features to support objects. The last two decades of the 20th century saw the development of a considerable number of such programming languages. Smalltalk-80, originally conceived by Alan Kay in 1969, was released in 1980 by the Xerox Palo Alto Research Center. Drawing from concepts in another object-oriented language — Simula (which is considered to be the world's first object-oriented programming language, developed in the late 1960s) — Bjarne Stroustrup designed C++, an object-oriented language based on C. C++ was first implemented in 1985. In the late 1980s and 1990s, the notable imperative languages drawing on object-oriented concepts were Perl, released by Larry Wall in 1987; Python, released by Guido van Rossum in 1990; PHP, released by Rasmus Lerdorf in 1994; and Java, first released by Sun Microsystems in 1994.

Example languages

The canonical examples of imperative programming languages are Fortran and Algol. Others include Pascal, C, and Ada, Perl.

provides an exhaustive list.

References

  • Pratt, Terrence W. and Marvin V. Zelkowitz. Programming Languages: Design and Implementation, 3rd ed. Englewood Cliffs, N.J.: Prentice Hall, 1996.
  • Sebesta, Robert W. Concepts of Programming Languages, 3rd ed. Reading, Mass.: Addison-Wesley Publishing Company, 1996.

See also

Originally based on the article 'Imperative programming' by Stan Seibert, from Nupedia, licensed under the GNU Free Documentation License.

Computer science, or computing science, is the study of the theoretical foundations of information and computation and their implementation and application in computer systems.
..... Click the link for more information.
Declarative programming is a term with two distinct meanings, both of which are in current use.

According to one definition, a program is "declarative" if it describes what something is like, rather than how to create it.
..... Click the link for more information.
A programming paradigm is a fundamental style of programming regarding how solutions to problems are to be formulated in a programming language. (Compare with a methodology, which is a style of solving specific software engineering problems).
..... Click the link for more information.
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program is formed by a sequence of one or more statements. A statement will have internal components (eg, expressions).
..... Click the link for more information.
In computer science and automata theory, a state is a unique configuration of information in a program or machine. It is a concept that occasionally extends into some forms of systems programming such as lexers and parsers.
..... Click the link for more information.
In the philosophy of language, a natural language (or ordinary language) is a language that is spoken, written, or signed (visually or tactilely) by humans for general-purpose communication, as distinguished from formal languages (such as computer-programming
..... Click the link for more information.
computer is a machine which manipulates data according to a list of instructions.

Computers take numerous physical forms. The first devices that resemble modern computers date to the mid-20th century (around 1940 - 1941), although the computer concept and various machines
..... Click the link for more information.
Procedural programming is sometimes used as a synonym for imperative programming (specifying the steps the program must take to reach the desired state), but can also refer (as in this article) to a programming paradigm based upon the concept of the procedure call.
..... Click the link for more information.
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast with the imperative programming style that emphasizes changes in state.
..... Click the link for more information.
<noinclude></noinclude> Logic programming (which might better be called logical programming by analogy with mathematical programming and linear programming) is, in its broadest sense, the use of mathematical logic for computer programming.
..... Click the link for more information.
Haskell

Paradigm: functional, non-strict, modular
Appeared in: 1990
Designed by: Simon Peyton-Jones, Paul Hudak[1], Philip Wadler, et al
Typing discipline: static, strong, inferred
Major implementations: GHC, Hugs, NHC , JHC , Yhc
..... Click the link for more information.
Prolog
Paradigm: Logic programming
Appeared in: 1972
Designed by: Alain Colmerauer
Major implementations: BProlog, GNU Prolog, Quintus, SICStus, Strawberry, SWI-Prolog, YAP-Prolog
Dialects: ISO Prolog, Edinburgh Prolog
..... Click the link for more information.
Machine code or machine language is a system of instructions and data directly executed by a computer's central processing unit. Machine code is the lowest-level of abstraction for representing a computer program.
..... Click the link for more information.
variable (IPA pronunciation: [ˈvæɹiəbl]) (sometimes called a pronumeral) is a symbolic representation denoting a quantity or expression.
..... Click the link for more information.
Since the late 1960s, the word paradigm (IPA: /ˈpærədaɪm/) has referred to a thought pattern in any scientific discipline or other epistemological context.
..... Click the link for more information.
recipes, see Semiconductor fabrication.


A recipe is a set of instructions that show how to prepare or make something, especially a culinary dish.
..... Click the link for more information.
A checklist is used to compensate for the weaknesses of human memory to help ensure consistency and completeness in carrying out a task.

Some applications include:

..... Click the link for more information.
A computer program is one or more instructions that are intended for execution by a computer. Specifically, it is a symbol or combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language.
..... Click the link for more information.
Arithmetic or arithmetics (from the Greek word αριθμός = number) is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple day-to-day counting to advanced science and business
..... Click the link for more information.
function expresses dependence between two quantities, one of which is given (the independent variable, argument of the function, or its "input") and the other produced (the dependent variable, value of the function, or "output").
..... Click the link for more information.
GOTO is a statement found in many computer programming languages. It is a combination of the English words and . When executed it causes an unconditional transfer of control (a "jump") to another statement.
..... Click the link for more information.
A procedure is a specification of series of actions, acts or operations which have to be executed in the same manner in order to always obtain the same result in the same circumstances (for example, emergency procedures).
..... Click the link for more information.
Fortran

Paradigm: multi-paradigm: procedural, imperative, structured, object-oriented
Appeared in: 1957
Designed by: John W. Backus
Developer: John W.
..... Click the link for more information.
John Backus

Born November 3 1924(1924--)
Philadelphia, Pennsylvania
Died March 17 2007 (aged 84)
Ashland, Oregon
..... Click the link for more information.
International Business Machines Corporation

Public (NYSE:  IBM )
Founded 1889, incorporated 1911
Headquarters Armonk, New York, USA

Key people Samuel J.
..... Click the link for more information.
19th century - 20th century - 21st century
1920s  1930s  1940s  - 1950s -  1960s  1970s  1980s
1951 1952 1953 - 1954 - 1955 1956 1957

Year 1954 (MCMLIV
..... Click the link for more information.
worldwide view.


2nd millennium
Centuries: 19th century - 20th century - 21st century

1920s 1930s 1940s - 1950s - 1960s 1970s 1980s
1950 1951 1952 1953 1954
1955 1956 1957 1958 1959

- -
- The 1950s
..... Click the link for more information.
Centuries: 19th century - 20th century - 21st century

1930s 1940s 1950s - 1960s - 1970s 1980s 1990s
1960 1961 1962 1963 1964
1965 1966 1967 1968 1969

- -
-

Their 1960s decade refers to the years from 1960 to 1969, inclusive.
..... Click the link for more information.
Algol (β Per / Beta Persei) is a bright star in the constellation Perseus. It is one of the best known eclipsing binaries, the first such star to be discovered, and also one of the first (non-nova) variable stars to be discovered.
..... Click the link for more information.
An operating system (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus


page counter