|
A computer-programming methodology
that focuses on data items rather than processes
The object-oriented approach focuses first on
the data items (entities, objects) that are being
manipulated. The emphasis is on characterizing
the data items as active entities which can perform
operations on and for themselves. It then describes
how system behavior is implemented through the
interaction of the data items.
Object Oriented Programing Introduction
Object Oriented Programing Tutorial
Abstract data types define the active data items
described above. A traditional data type in a
programming language describes only the structure
of a data item. An abstract data type also describes
operations that may be requested of the data item.
It is the ability to associate operations with
data items that makes them active. The abstract
data type makes operations available without revealing
the details of how the operations are implemented,
preventing programmers from becoming dependent
on implementation details. The definition of an
operation is considered a contract between the
implementor of the abstract data type and the
user of the abstract data type. The implementor
is free to perform the operation in any appropriate
manner as long as the operation fulfills its contract.
Object-oriented programming languages give abstract
data types the name class.
Polymorphism in the object-oriented
approach refers to the ability of a programmer
to treat many different types of objects in a
uniform manner by invoking the same operation
on each object. Because the objects are instances
of abstract data types, they may implement the
operation differently as long as they fulfill
the agreement in their common contract.
A new abstract data type (class) can
be created in object-oriented programming simply
by stating how the new type differs from some
existing type. A feature that is not described
as different will be shared by the two types,
constituting reuse through inheritance. Inheritance
is useful because it replaces the practice of
copying an entire abstract data type in order
to change a single feature.
In the object-oriented approach, a
class is used to define an abstract data type,
and the operations of the type are referred to
as methods. An instance of a class is termed an
object instance or simply an object. To invoke
an operation on an object instance, the programmer
sends a message to the object.
|