Procedural programming

Procedural programming

Procedural programming can sometimes be 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". Procedures, also known as routines, subroutines, methods, or functions (not to be confused with mathematical functions, but similar to those used in functional programming) simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. [cite web
title=Welcome to IEEE Xplore 2.0: Use of procedural programming languages for controlling productionsystems

Procedural programming is often a better choice than simple sequential or unstructured programming in many situations which involve moderate complexity or which require significant ease of maintainability. Possible benefits:

* The ability to re-use the same code at different places in the program without copying it.
* An easier way to keep track of program flow than a collection of "GOTO" or "JUMP" statements (which can turn a large, complicated program into spaghetti code).
* The ability to be strongly modular or structured.

Procedures and modularity

Modularity is generally desirable, especially in large, complicated programs. Inputs are usually specified syntactically in the form of "arguments" and the outputs delivered as "return values".

Scoping is another technique that helps keep procedures strongly modular. It prevents the procedure from accessing the variables of other procedures (and vice-versa), including previous instances of itself, without explicit authorization.

Less modular procedures, often used in small or quickly written programs, tend to interact with a large number of variables in the execution environment, which other procedures might also modify.

Because of the ability to specify a simple interface, to be self-contained, and to be reused, procedures are a convenient vehicle for making pieces of code written by different people or different groups, including through programming libraries.

(See Module (programming) and Software package (programming).)

Comparison with imperative programming

Most procedural programming languages are also imperative languages, because they make explicit references to the state of the execution environment. This could be anything from "variables" (which may correspond to processor registers) to something like the position of the "turtle" in the Logo programming language.

Comparison with object-oriented programming

The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines, whereas in object-oriented programming it is to break down a programming task into objects. Either method can be valid for accomplishing a specific programming task.

Some differences between pure object-oriented languages and non-OO procedural languages:

Comparison with logic programming

In logic programming, a program is a set of premises, and computation is performed by attempting to prove candidate theorems. From this point of view, logic programs are declarative, focusing on what the problem is, rather than on how to solve it.

However, the backward reasoning technique, implemented by SLD resolution, used to solve problems in logic programming languages such as Prolog, treats programs as goal-reduction procedures. Thus clauses of the form:

:H :- B1, …, Bn.

have a dual interpretation, both as procedures

:to show/solve H, show/solve B1 and … and Bn

and as logical implications:

:B1 and … and Bn implies H.

Experienced logic programmers use the procedural interpretation to write programs that are effective and efficient, and they use the declarative interpretation to help ensure that programs are correct.

Procedural programming languages

To be considered procedural, a programming language should support procedural programming by having an explicit concept of a procedure, and a syntax to define it. The canonical example of a procedural programming language is ALGOL.

Languages in which the only form of procedure is a method are generally considered object-oriented rather than procedural, and are not included in this list. This applies, in particular, to C# and Java. Languages like Prolog and its variants, which are both declarative "and" procedural, are also not included.

* Ada
* C
* ColdFusion
* Component Pascal
* D
* ECMAScript (e.g., ActionScript, JavaScript, JScript)
* Forth
* Fortran
* F
* Lasso
* Linoleum
* Mathematica
* Modula-2
* Oberon (Oberon-1 and Oberon-2)
* Occam
* M
* Neko
* Pascal
* Perl
* Pike
* PL/C
* Python
* PL/I
* Rapira
* Tcl
* VBScript

See also

* Functional programming (contrast)
* Imperative programming
* Logic programming
* Object-oriented programming
* Programming paradigms
* Programming language
* Procedural generation (contrast)
* Structured programming


External links

* [ Open Directory: Programming: Languages: Procedural]

Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Programming paradigm — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concu …   Wikipedia

  • Programming language — lists Alphabetical Categorical Chronological Generational A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that… …   Wikipedia

  • Procedural — Procedural, as an adjective, refers to the concept of procedure. It may also refer to: *Procedural programming, a computer programming concept *Procedural generation, a term often used in connection with computer graphics applications to indicate …   Wikipedia

  • Programming Language for Business — or PL/B is a business oriented programming language originally called DATABUS and designed by Datapoint in the early 1970s as an alternative to COBOL because its 8 bit computers could not fit COBOL into their limited memory, and because COBOL did …   Wikipedia

  • Procedural animation — A procedural animation is a type of computer animation, used to automatically generate animation in real time to allow for a more diverse series of actions than could otherwise be created using predefined animations.Procedural animation is used… …   Wikipedia

  • Procedural generation — is a widely used term in the production of media, indicating the possibility to create content on the fly rather than prior to distribution. This is often related to computer graphics applications and video game level design.OverviewThe term… …   Wikipedia

  • Programming in the large and programming in the small — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computin …   Wikipedia

  • procedural language — programming language in which commands must be executed in a specific order …   English contemporary dictionary

  • Comparison of programming paradigms — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computin …   Wikipedia

  • Object-oriented programming — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computing …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”