1 2 3 4 5 6 7 8 9 10 11 12

How does Object Oriented Programming (OOP) help?


The above rule assumed each program was one large piece
of code. Breaking a program up into separate functions
doesn't help because of interactions between functions.
The only types of thing that can work is if a program
can be constructed from smaller pieces, each of which
is completely independent.
[This was the driving philosophy behind UNIX in 1970,
and look where UNIX is now!]


This is exactly what object oriented programming is about.
Programs are constructed out of objects. Each object
contains data and code and is completely self-contained.
There are ways of manipulating these objects
(operators) so that all the "real world'' manipulations
can be done in such a way that:

*


*


*

objects can be used as-is


objects can be used mostly as-is, but with some extra
code for the problem at hand (
inheritanceand derived
objects
)


objects can be selected based on criteria known only at
run-time (
virtual objects)

*objects can be generalized to work on other objects
whose type is not known until link-time.
Consider sorting an array. You should be able to write an
object that sorts arrays no matter what type of object
is in each element. (
templates)

March 2,1998

Page 4

C201 TAM/AGS