Introducing Object Oriented Programming


Procedural Programming

Procedural programming is what most programmers are used to. In procedural programming we view a system as a series of instructions to be executed one after another.

Structured Programming

Structured programming is a formal method of procedural programming in which we begin with general abstractions about the system and break them down gradually into steps that become more and more concrete. Using this technique we develope levels of procedures calling more concrete procedures until finally we reach the lowest level of abstraction in which we can describe the procedure in terms of programming language statements. This is called hierarchial decomposition or top down programming. Another important part of structured programming is data abstraction and data hiding. We group data based on abstract ideas. We then keep this data on the lowest possible level in our program. These concepts were introduced to deal with the problem of unrestricted access to global data.

Object Oriented Programming

Object oriented programming challenges two notions underlying structured procedural programming. The first is that programming should be approached from the top down. The second is that a program is a series of procedures or actions invoked one after the other. Make no mistake. Object oriented programming is a structuring technique. Although you must start with objects, the perspective to be emphasized is the framework, or program structure. An object oriented program should not be viewed as a set of procedures. An object oriented program should be viewed as a set of of communicating objects.
In OOP we emphasize objects rather than actions. Processing takes place inside of objects, and information is passed back and forth between objects. Objects can invoke processing in other objects by sending messages. An object contains its own data and is solely responsible for maintaining the integrity of its data. Only procedures within the object are allowed access to the private data elements. This bundling of procedures and associated data is encapsulation.