OO Programming  «Prev  Next»
Lesson 3 Object-oriented approach to Design
Objective OO Programming differs from procedural programming.

OO Programming compared to Procedural Programming

Object-oriented programs follow a different path than procedural programs. In procedural programming, you think mostly about the algorithms and data structures that are used to model the problem and divide the problem into a series of procedures.
In OOP (an abbreviation for object-oriented programming), you think about the system you are modeling and how the elements in the system interact with each other. In procedural programs, the procedures are the highest-level elements. They define what the program does and the data is almost an afterthought.

In object-oriented programs, the classes are the highest level elements.
The classes contain the functions (or the methods, as they're referred to in OOP jargon) and the data. In procedural programming, data belongs to functions or occasionally is stored in global variables.
Object-oriented programming languages encapsulate both data and methods in classes.

Object Programming

The difference between programmers who use objects in their code and those who truly grasp object-oriented programming comes down to the way their objects relate to each other and to the overall design of the program. This module begins with a very brief description of procedural programming (C-style), followed by a detailed discussion of object-oriented programming (OOP).
Even if you have been using objects for years, you will want to read this module for some new ideas regarding how to think about objects. A discussion of the different kinds of relationships between objects includes pitfalls programmers often succumb to when building an object-oriented program. You will also learn how the principal of abstraction relates to objects. When thinking about procedural programming or object-oriented programming, the most important point to remember is that they just represent different ways of reasoning about what is occurring in your program. Too often, programmers get bogged down in the syntax of OOP before they adequately understand what an object is. This chapter is light on code and heavy on concepts and ideas.