Article No: 1
The Beginning
The earliest computers were programmed in binary. Mechanical switches were used to load programs. With the advent of mass storage devices and larger and cheaper computer memories, the first high-level computer programming languages came into existence. With their arrival, instead of thinking in terms of bits and bytes, programmers could write a series of English like instructions that a compiler could translate into the binary language of computers.
These languages were simple in design and easy to use because programs at that time were primarily concerned with relatively simple tasks like calculations. As a result, programs were pretty short, limited to about a few hundred lines of source code.
As the computers capacity and capability increased, so also did the ability to develop more complex computer programs. However, the earlier programming languages were found wanting in performing the complex programming task. These languages suffered from the following limitations:
1. There were no facilities to reuse existing program code. Wherever the same piece of code was required, it was simply duplicated.
2. The control was transferred via the dangerous goto statement. As a result, there was too much jumping around in the program, often without any clear indication of how, where and why the control is flowing.
3. All variables in the program were global. Tracking down spurious changes in global data in long convoluted (complex) programs was a very tedious job.
4. Writing, understanding and maintaining long programs became a programmer’s nightmare.
Software Development
Ernest Tello, a well known writer in the field of artificial intelligence, compared the development of software technology to growth of a tree. Like a tree, software development has had different layers of growth. These layers were built up one by one over the last 50 years.
To build today’s difficult software it is not just to put together a sequence of programming statements and sets of procedures, but we need to include construction techniques and program structures that are easy to understand, implementable and can be modified.
ML=Machine Language, AL=Assembly Language,
PO=Procedure-oriented OOP=Object Oriented Programming
Structured Programming
To overcome the limitations mentioned above in earlier period, a quest (long search) began to develop new languages with new features that would help to create more sophisticated (complex) applications. The breakthrough occurred in late 60’s and early 70’s with the introduction of structured programming. The long programs that the programmer found difficult to comprehend (understand) could now be broken down into smaller units of few hundred statements. Functions/subroutines/procedures were introduced in these languages to make the programs more comprehensible (understand) to their human creators. A program could now be divided into functions, with each function having a clearly defined purpose and a clearly defined interface to other functions in the program.
A structured program is built by breaking down the program’s primary purpose into smaller pieces that then become functions within the program. Each function can have its own data and logic. Information is passed between functions using parameters and functions can have local data that cannot be accessed outside the function’s scope.
By isolating processes within functions, a structured program minimizes the chance that one procedure will affect another. This also makes it easier to isolate problems, if any. Structured programming helps you to write cleaner code and maintain control over each function. There is less need of global variables, which are now replaced by local variables that have a smaller and more controllable scope. All this makes the development and maintenance of code fast as well as sufficient.
A new concept came into existence with structured programming abstraction. Abstraction permitted the programmer to look at something without being concerned with its internal details. In a structured program it is enough to know which task is performed by function. It does not matter to the programmer how the task is performed so long as the function does it reliably. This is called functional abstraction and is the corner stone of structured programming.
Structured programming ruled the roost for almost two decades. With the constant improvement in the hardware and increasingly more demands from the users for feature-rich programs, the complexity of programs increased multi-fold and that’s the time structured programming approach started showing signs of strain. This occurred because of the weakness in the procedural paradigm (pattern) itself. One of the key reasons for the failure of procedural languages was the role played by data.
In the procedural language, the whole emphasis is on doing things. Subdivision of a program into functions continued this emphasis. Functions do things just as single program statements do. What they do may be more complex, but the emphasis is still on doing. Data is given a second class status in the procedural paradigm even though data is the reason for program’s existence. For example, in a payroll processing application the important part is not the function which displays the data, or the function that checks for current input; the important is the payroll data itself.
In a structured program, data types are processed in many functions, and when changes occur in data types, modifications must be made at every location that acts on those data types within the program. This is a frustrating and time-consuming task for large-sized programs.
Another problem with structured programming is that its primary components-functions and data structures-don’t model the real world very well. For example, suppose you are writing a program to create the elements of a GUI (menus, windows) there are no obvious program elements to which a menu or a window corresponds. This is because the structured programming paradigm emphasizes on fitting a problem to the procedural approach of a language.
Characteristics
· Emphasis is on doing things (procedures).
· Large programs are divided into smaller programs known as functions.
· Most of the functions share global data.
· Data move openly around the system from function to function.
· Functions transform data from one form to another.
· Employs top-down approach in program design.
Dis-Advantages of Procedure Oriented Programming
· Global data are more harmed due to change by function.
· In a large program it is very difficult to identify what data is used by which function.
· It does not model real world problems very well.
Comments
Post a Comment