Object Orientation

The OO Technology - "a way of thinking about a problem using real world concepts rather than computer concepts."

"Object-Oriented ___"

means that we organize software as a collection of discrete objects that incorporate both data structures and behavior.

At a higher scale - distributed objects "the network is the computer"

Introduction

(1)

The OO Technique

New?

No.

Began around 1965 with the development of SIMULA

(an extension to Algol)

SIMULA was released in 1967

Now, Smalltalk, LOOPS, CLOS, C++, Object Cobol, Eiffel, etc. and Java!

But WHY?

(2)

The Case for Object-Orientation

Software crisis:

Previously, No emphasis on iteration, reuse, no unifying model to integrate phases

Object-Oriented Analysis, Design and Implementation are not separable

A clear mapping enhances trace- ability and maintenance/error control

An approach which is

Thus, OO methodologies lead to

Note:

Paradigm shift...new world view which is incompatible with the previous

There is more to OOP than syntax -

there is also more than just terms!

Pure OO languages force one to see and use the OO concepts to a greater extent...thus the use of Java.

Nonetheless, terms:

Typically four important aspects:

(3)

Identity

:

discrete, distinguishable entities called objects. E.G.:

Interesting choice of classes to show. I thought I would investigate classes (left panel) in the Java 1.5 API
Some classes: Number , Integer , NoSuchMethodException , Throwable, PrintStream

An object is a grouping of information (its properties) and a description of its manipulation (its possible actions). (ADT's)

Name the objects in the above figure.

(4)

Classification

:

objects with the same data structure (attributes) and behaviors (operations or methods) are grouped in the same class.

They should be thought of as a holder of "typical instance" type information, similar to a frame-like idea.

They are related to each other by their location in a class hierarchy.

Classes must be instantiated giving an "instance" of the class.

Each object is an instance of some class. (or a class itself)

Storage and information:

Class Name

CVs and methods are declared and exist in the class and may be accessed by all instances of the class

Instance

CVs are class variables which are declared in a class, but which can be accesses in either the class or any instance of the class. (One memory location)

The IV value that is set in the class definition (default) is returned unless there is a local setting in the specific instance

Example:

Class - csuProfessor

(5)

Polymorphism

:

the same operation may behave differently on different classes

The language selects the correct method based on the name of the operation and the class of the object being operated on. (not overload like C) (discuss)

Inheritance:

sharing of attributes and operations

OO Themes:

Advantages of Object Orientation

Disadvantages of Object Orientation

(6)

How about in this class...

There are three very common relationships between classes:

Most relationships are uses (or instantiation of classes)

Not a lot of inheritence - and often used incorrectly.

Consider lab 1. Timer... it uses Date, but is it a Date?

Of course not.

Where would we use inheritence? (Reusable things)