Object oriented programming

Don & bashford at scripps.edu
Wed Aug 19 18:48:59 EST 1992

>>>>> In article <0095F555.4A4EEF00.243 at NTBTOX.NCTR.FDA.GOV>, wmelchior at NTBTOX.NCTR.FDA.GOV ("Bill Melchior, NCTR/FDA") writes:

Bill> For folks like me, could someone who knows something
Bill> about the field make a stab at a brief, simple definition of 
Bill> "object oriented programming"?  I'd like to know what it is, not
Bill> what language (C++, ?) is used; or maybe it's defined by what it is NOT?

Here are some paraphrases and quotes stolen from Chapter 1 of Bjarne Stroustrup's
"The C++ Programming Language" (2nd ed.).

The original programming paradigm is Procedural Programming:

   Decide which procedures you want; use the best algorithms you can find.

Languages like C and Fortran provide functions or subroutines as
the basic building block.  But as programs became larger people began
to shift their focus towards the orginization of data.  *Modules* were
built which contained related procedures with the data they operate on.
Thus we have the Modular Programming Paradigm:

   Decide which modules you want; partition the program so that data
   is hidden in modules.

This kind of programming is possible in C and supported directly in
Modula-2.  For example, if you want a stack you can put static pointers
to it in a stack.c file along with functions for pushing, popping, etc.
But what if you want to have more than one stack?  Do you need to
write stack_a.c and stack_b.c defining functions like pop_a, pop_b, etc.?
Yuk!  What you really need is the ability to craft a "stack" data
type and then declare the existence of as many stacks is you like.
This leads to the Data Abstraction Paradigm:

   Decide which types you want; provide a full set of operations for
   each type.

This can be done in C++.  But you may find that you have alot of data
types that are similar but not the same and you are duplicating alot
of effort in providing the "full set of operations for each type".
You would like to be able to define a base type that has the features common
to the similar types, then impliment the particular types by
declaring that they inherit the features of the base type and then adding
the details of that particular type.  This is the Object Oriented Paradigm:

   Decide which classes (types) you want: provide a full set of operations
   for each class; make commonalities explicity by using inheretence.

This is supported in C++.

More information about the Bio-soft mailing list