OO Programming  «Prev  Next»
Lesson 2 Traditional approach/ Procedural Programming
Objective Procedural programming and how it is used.

Traditional Approach of Procedural Programming

Prior to the rise of object-oriented programming, the most popular approach was procedural, or structured, programming. Structured programming uses top-down design to decompose a problem into a series of successively more granular functions.
Structured programming requires well-defined flow control. Languages that support this are often called procedural languages because of their heavy reliance on procedures.
Development begins by identifying the problem domaindefining what th, e problem is that your project is supposed to help solve. This is the case whether you use a procedural or an object-oriented design. Once the problem domain has been identified, however, the two methods diverge. Procedural designs begin by defining the procedures, starting with a top-level function. From there, the problem is broken into more specific procedures.

For example, a program that converts GIF files to JPEG files might begin with a single function called convertImage(), which demonstrates the traditional programming approach. This function is then broken down into three functions called
readGIF(), 
convertGIFtoJPEG(), 

and
writeJPEG().

In turn, each of these functions can be broken down even further.

Procedural Programming

Procedural programming refers to a programming paradigm derived from structured programming which is based upon the concept of the procedure call. Procedures, also known as
  1. subroutines,
  2. methods, or
  3. functions
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. A list of instructions telling a computer what to do, usually having a linear order of execution from the first statement to the second occasional loops and branches. Procedural programming languages include C, C++, Fortran, Pascal, and BASIC.

Object Oriented Analysis

Programming Language Questions

Question: What is meant by an executable specification language?
Answer: When the specification of a system is expressed formally or is described by using a programming language, then it becomes possible to directly execute the specification without having to design and write code for implementation.
Question: How is an executable specification language different from a traditional procedural programming language?
Answer:
Executable specifications are usually slow and inefficient and 4th Generation Languages are examples of executable specification languages. 4th Generation Languages are successful because their granularity can be used across data processing applications which have been identified and mapped to program code. 4GLs get their power from software reuse, where the common abstractions have been identified and parameterized. Careful experiments have shown that rewriting 4GL programs in 3GLs results in up to 50 per cent lower memory usage. In addition, the program execution can reduce run-time up to ten folds.

Question: Give an example of an executable specification language.
Answer: 4th Generation Languages