The
programming process has evolved through many phases. The journey started with
programmers who would write programs which some how worked without giving any
importance to readability of the program. The languages like FORTRAN and BASIC
neither enforced any discipline nor were the programmers trained to write user
centric programs. The result was unstructured understandable programs
susceptible to bugs acting as time bombs like Y2K problem. The major problem
was that the programs were not maintainable.
The
structured programming techniques did enforce some discipline on the
programmers by way of shunning the use of ‘goto’ statements and encouraging the
programmers to use ‘easy to read and difficult to write’ style of code
statements i.e. choosing long and meaningful names for the variables,
functions, procedures, modules etc. The major emphasis was to use block
structures in the program. For instance any code enclosed between a pair of
curly braces or the pair of begin – end was termed as a block. Pascal and ‘C’
supported blocks like compound statements, loops, functions, procedures, files
etc. This technique worked good for hard core programmers who were able to
write large and complex programs using structured programming techniques. Unix
operating system was written using ‘C’. Then there were always few hard core
programmers available in the market.
Nevertheless,
the importance was given to procedures as to how to solve the problem at hand.
The algorithm development consumed more time of the developer and least
importance was given to the data. So, a
program was virtually a collection of decomposed components i.e.
interacting functions or modules exchanging data and data structures among
them. Such data, especially the global data, was vulnerable to inadvertent
corruption by the fellow programmers.
The
remedy to the above mentioned drawbacks is that we put more emphasis on data
and try to create reusable software components. The reusable components can
further be combined to get bigger and more powerful software.
For
example, in our day to day life we compose bigger objects from smaller objects.
The desktop computer is made up many smaller objects like: mother board, RAM,
HDD, SMPS, mouse, keyboard etc. We use the services offered by these objects
and never bother as to how they work or who made them?
When
we look around then we find that we are surrounded by nothing but objects only.
You & I, books, pen, paper, laptop etc. are all objects. In fact any real
world program has to be a collection objects. A program about a University
would involve objects like students, professors, clerks, class rooms, books,
chalk, mark sheets etc. Then why not write programs using objects which would
be very natural way of creating useful software comprising of interacting
objects.
Object
Oriented Programming (OOP) is a paradigm shift in programming which defines,
creates, and manipulates objects to develop a reusable software. C++ is an
imperative language developed to support OOP components and features like:
classes, objects, abstraction, encapsulation, inheritance, polymorphism etc.
A. K. Sharma
Thought to ponder...
True education is that destroys narrow-mindedness,
develops equality and ultimately leads to world peace.
Bhagwan Sri Satya Sai Baba