The earliest computers were programmed in machine
language using 0 and 1. The mechanical switches were used to load programs.
Then, to provide convenience to the programmer, assembly language was
introduced where programmers use pneumonic for various instructions to write
programs. But it was a tedious job to remember so many pneumonic codes for
various instructions. Other major problem with the assembly languages is that
they are machine architecture dependent.
To overcome the difficulties of Assembly language,
high-level languages came into existence. Programmers could write a series of
English-like instructions that a compiler or interpreter could translate into
the binary language of computers directly.
These languages are simple in design and easy to use
because programs at that time were relatively simple tasks like any arithmetic
calculations. As a result, programs were pretty short, limited to about a few
hundred line of source code. As the capacity and capability of computers
increased, so did the scope to develop more complex computer programs. However,
these languages suffered the limitations of reusability, flow control (only
goto statements), difficulty due to global variables, understanding and
maintainability of long programs.
Structured
Programming
When the program becomes larger, a single list of
instructions becomes unwieldy. It is difficult for a programmer to comprehend a
large program unless it is broken down into smaller units. For this reason
languages used the concept of functions (or subroutines, procedures,
subprogram) to make programs more comprehensible.
A program is divided into functions or subroutines
where each function has a clearly defined purpose and a defined interface to
the other functions in the program. Further, a number of functions are grouped
together into larger entity called a module, but the principle remains the
same, i.e. a grouping of components that carry out specific tasks. Dividing a
program into functions and modules is one of the major characteristics of structured
programming.
By dividing the whole program using functions, a
structured program minimizes the chance that one function will affect another.
Structured programming helps the programmer to write an error free code and
maintain control over each function. This makes the development and maintenance
of the code faster and efficient.
Structured programming remained the leading approach
for almost two decades. With the emergence of new applications of computers the
demand for software arose with many new features such as GUI (Graphical user
interface). The complexity of such programs increased multi-fold and this
approach started showing new problems.
The problems arose due to the fundamental principle
of this paradigm. The whole emphasis is on doing things. Functions do some
activity, maybe a complex one, but the emphasis is still on doing. Data are
given a lower status. For example in banking application, more emphasis is
given to the function which collects the correct data in a desired format or
the function which processes it by doing some summation, manipulation etc. or a
function which displays it in the desired format or creates a report. But you
will also agree that the important part is the data itself.
The major drawback with structured programming are
its primary components, i.e., functions and data structures. But unfortunately
functions and data structures do not model the real world very well. Basically
to model a real world situation data should be given more importance.
Therefore, a new approach emerges with which we can express solutions in terms
of real world entities and give due importance to data.
Object
Oriented programming
The world and its applications are not organized as
functions and values separate from one another. The problem solvers do not
think about the world in this manner. They always deal with their problems by
concentrating on the objects, their characteristics and behavior. The world is
Object Oriented, and Object Oriented programming expresses programs in the ways
that model how people perceive the world. Shows different real world objects
around us which we often use for performing different functions. This shows
that problem solving using the objects oriented approach is very close to our
real life problem solving techniques.
The basic difference in Object Oriented programming
(OOP) is that the program is organized around the data being operated upon
rather than the operations performed. The basic idea behind OOP is to combine
both, data and its functions that operate on the data into a single unit called
object. Now in our next section, we will learn about the basic concepts used
extensively in the Object Oriented approach.
No comments:
Post a Comment