<< Chapter < Page Chapter >> Page >
An overview of how object oriented programming is different from procedural or modular structured programming.

Discussion

"In procedural programming, the programmer constructs procedures (or functions, as they are called in C++). The procedures are collections of programming statements that perform a specific task. The procedures each contain their own variables and commonly share variables with other procedures. Procedural programming is centered on the procedure or function." Tony Gaddis, Judy Walters and Godfrey Muganda, Starting Out with C++ Early Objects Sixth Edition (United States of America: Pearson – Addison Wesley, 2008) 22. For decades (1950s to through the 1980s) most programming was taught as procedural programming . Coupled with the imposition of using standardized control structures in the late 1960s, we have what is typically called modular structured programming .

Another, equally valid approach to programming is object-oriented programming or OOP. It was introduced in the mid 1980s and was widely accepted as a programming approach by the early 1990s. The first languages to introduce OOP to the masses were C++ and Java. Shortly after their introduction, there were American National Standards Institute (ANSI) standards established for those languages. Today, C++ and Java are widely used.

"The primary differences between the two approaches is their use of data. In a procedural program, the design centers around the rules or procedures for processing the data. The procedures, implemented as functions in C++, are the focus of the design. The data objects are passed to the functions as parameters. The key question is how the functions will transform the data they receive for either storage or further processing. Procedural programming has been the mainstay of computer science since its beginning and is still heavily used today.

In an object-oriented program, abbreviated OOP, the design centers around objects that contain (encapsulate) the data and the necessary functions to process the data. In OOP, the objects own the functions that process the data." Behrouz A. Forouzan and Richard F. Gilberg, Computer Science A Structured Approach using C++ Second Edition (United States of America: Thompson – Brooks/Cole, 2004) 156.

"Object-oriented programming … is centered on the object. An object is a programming element that contains data and the procedures that operate on the data. The objects contain, within themselves, both the information and the ability to manipulate the information." Tony Gaddis, Judy Walters and Godfrey Muganda, Starting Out with C++ Early Objects Sixth Edition (United States of America: Pearson – Addison Wesley, 2008) 22.

To help complicate the picture, the C++ programming language can be used (and is used) to write either a procedural program (modular structured program) or an object-oriented program. Some items used by those writing procedural programs in C++ are in fact objects. Examples include:

  1. Standard input and output items of: cout and cin; example: cout.setf(ios::fixed)
  2. Strings; calculating the length with: identifier_name.length()
  3. File input/output; example: inData.open(filespec, ios::in)

Objects are implemented with a "class" data type; which is a complex or derived data type. Implementation details will not be presented in the module.

Transition

Many students will learn modular structured programming before learning object-oriented programming. The common way of teaching programming fundamentals is to cover them or divide them into three courses, usually covered in this order:

  1. Modular structured
  2. Object-oriented
  3. Data structures

The following items learned in modular structured programming flow into the learning of object-oriented programming:

  1. The standard and complex data types are the same
  2. The operators are the same, thus data manipulation is the same
  3. The control structures are the same
  4. Concepts of documentation and making code readable are the same
  5. The use of test data to verify logical thinking and program results is similar

Definitions

procedural programming
Aka modular structured programming.
object oriented
A programming approach that encapsulates data with functions.

Questions & Answers

if three forces F1.f2 .f3 act at a point on a Cartesian plane in the daigram .....so if the question says write down the x and y components ..... I really don't understand
Syamthanda Reply
hey , can you please explain oxidation reaction & redox ?
Boitumelo Reply
hey , can you please explain oxidation reaction and redox ?
Boitumelo
for grade 12 or grade 11?
Sibulele
the value of V1 and V2
Tumelo Reply
advantages of electrons in a circuit
Rethabile Reply
we're do you find electromagnetism past papers
Ntombifuthi
what a normal force
Tholulwazi Reply
it is the force or component of the force that the surface exert on an object incontact with it and which acts perpendicular to the surface
Sihle
what is physics?
Petrus Reply
what is the half reaction of Potassium and chlorine
Anna Reply
how to calculate coefficient of static friction
Lisa Reply
how to calculate static friction
Lisa
How to calculate a current
Tumelo
how to calculate the magnitude of horizontal component of the applied force
Mogano
How to calculate force
Monambi
a structure of a thermocouple used to measure inner temperature
Anna Reply
a fixed gas of a mass is held at standard pressure temperature of 15 degrees Celsius .Calculate the temperature of the gas in Celsius if the pressure is changed to 2×10 to the power 4
Amahle Reply
How is energy being used in bonding?
Raymond Reply
what is acceleration
Syamthanda Reply
a rate of change in velocity of an object whith respect to time
Khuthadzo
how can we find the moment of torque of a circular object
Kidist
Acceleration is a rate of change in velocity.
Justice
t =r×f
Khuthadzo
how to calculate tension by substitution
Precious Reply
hi
Shongi
hi
Leago
use fnet method. how many obects are being calculated ?
Khuthadzo
khuthadzo hii
Hulisani
how to calculate acceleration and tension force
Lungile Reply
you use Fnet equals ma , newtoms second law formula
Masego
please help me with vectors in two dimensions
Mulaudzi Reply
how to calculate normal force
Mulaudzi
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Programming fundamentals - a modular structured approach using c++. OpenStax CNX. Jan 10, 2013 Download for free at http://cnx.org/content/col10621/1.22
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Programming fundamentals - a modular structured approach using c++' conversation and receive update notifications?

Ask