9
EDUC4417 Senior Computers Dr. Mumbi Kariuki January 28, 2004 Object-Orientation David Cuillerier

EDUC4417 Senior Computers Dr. Mumbi Kariuki January 28, 2004 Object-Orientation David Cuillerier

Embed Size (px)

Citation preview

EDUC4417 Senior ComputersDr. Mumbi Kariuki

January 28, 2004

Object-OrientationDavid Cuillerier

Fundamental Tenets of Object-Orientation…

All system components, interactors and events are modeled as formal, conceptual Objects.

These Objects, like real-world objects, have properties which define their state and methods which define the actions that they can perform on themselves or their environments.

Any Object may reference, and thereby control, another Object through composition relations.

Any Object may inherit, and thereby channel, another Object through extension relations.

Implications of Object-Orientation…

Positive:• Abstracts data AND

functionality by encasing it within Objects.

• Encapsulates resources and controls access.

• Facilitates code reuse through extension and composition.

• Reduces production and maintenance costs.

Negative:• Imposes a small runtime

performance penalty.• Requires use of object-

oriented languages, environs and developers to implement.

• Increases design costs.

Core Concepts…ABSTRACTION

Abstraction is the process of simplifying a system by hiding low-level implementation details behind higher level interfaces.

Successive layers of abstraction can have an enormous effect upon the simplicity of the programmer interface of a software system.

Objects comprise, and therefore abstract, data, functions AND other Objects.

As a result they are ideal mechanisms through which to perform software abstraction.

Core Concepts…ENCAPSULATION

Most Object-oriented languages allow developers to specify levels of ownership for attributes and functions (methods)

Although multiple levels of access typically exist, the concept of public and private resources forms the core of each encapsulation metaphor.

Objects which encapsulate their resources can control access to those resources according to the relationship the Object has with the requestor.

Core Concepts…COMPOSITION

Objects are essentially advanced data structures.

As such, they may contain various form of data, including references to other Objects.

Complex systems of Objects can therefore be assembled by embedding references to certain Objects within others.

These compositions can then be composed into yet higher levels of solution control, and so on.

Core Concepts…EXTENSION

An Object that inherits all of the properties and functions of another is said to extend that Object.

Some languages allow Objects to extend multiple ancestors and obtain the superset of their resources.

By chaining extensions together, an Object can be created that linearly inherits its functionality from a hierarchy of ancestors.

Extended methods can then be overridden leading to the use of dynamic binding (polymorphism) and all manner of useful design techniques.

Core Concepts…IMPLEMENTATION

An Object subscribes to some published pattern or interface and contracts to implement the functionality specified.

Interface implementation is a common workaround for multiple-inheritance in Object-oriented language, like Java, that do not support multiple extensions.

Interface implementation can unfortunately result in code duplication. It should be used sparingly.

Relevant ICS4MB Expectations…

TF1.05 Describe the difference between procedural and object-oriented programming;

TF2.01 Describe how procedural and object-oriented programming paradigms can be used to solve different problems;