Chapter 19 OBJECT ORIENTED MODELING, CONCEPTS AND PRINCIPLES

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

1

CONTENTS
is object-oriented development ?  Object-oriented process model  Object-oriented concepts  Object modeling technique  Unified Modeling Language (UML)  Concepts and Principles of Object Modeling  Object-oriented vs functional approach 
What
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 2

What is OO Development ?
way of thinking about problems using models organized around real world concepts.  The fundamental construct is the object 
³New´

‡ Combines both data structure and operations in a single entity called an object. 
Leads

to reuse, faster software development and higher quality programs.  Easier to maintain
‡ Structure inherently decoupled ‡ Fewer side-effects
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 3

The OO process model 
Moves

through an evolutionary spiral  Emphasizes development of reuse capability

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

4

Object Oriented Concepts 
Objects

and Object Model

‡ Object: Data and operations relevant to some real world or significant program entity encapsulated into a monolithic unit accessible only through a well defined interface. For ex. File in the file system together with operations such as open, close, read, & write, ‡ Object Model: Describes the structure of the objects in the system
± their identity, relationships to other objects, attributes and operations.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 5

Object Modeling 
Classification

& Classes

‡ A class describes a group of objects with similar properties (attributes), common behavior (operations), common relationships to other objects, and common semantics.

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

6

Object Classes 
Thus,

a class is an abstraction that describes relevant properties and hides the rest. Represented diagrammatically as below. Class Name Attributes Operations

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

7

Object Modeling

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

8

Object Modeling 
Attributes:

An attribute is a data value held by the objects in a class. Name, age, and weight are attributes of Person objects.

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat

9

Object Modeling 
Operations

and Methods :

‡ Operations : An operation is a function or transformation that may be applied to or by objects in a class. Each operation has a target object as an implicit argument. The behavior of the operation depends on the class of its target. ‡ Methods : A method is the implementation of an operation for a class.
± Categories: 1) manipulate data, 2) perform computation, and 3) monitor for occurrence of controlling event.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 10

Object Modeling 
An

operation may have arguments in addition to its target object. Such arguments parameterize the operation but do not affect the choice of method.

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 11

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 12

Class and Instance
Polygon Vertices Border Color Fill Color Draw Erase Move
February 14, 1999 R. A. Volz

Polygon v={(0,0),(0,1),(1,0)} BC = Red FC = Blue Draw Erase Move
Chapter 19 -- Assistance -- Lamimi V. Kamat 13

Abstraction and Encapsulation

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 14

Abstraction and Encapsulation 
Abstraction

‡ Isolate those aspects that are important and suppress (or hide) those that are unimportant (e.g., representations). ‡ Focus on what object is and does before deciding how it should be implemented. ‡ Abstraction allows dealing only with application domain concepts, not making design and implementation decision before problem is understood.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 15

Abstraction and Encapsulation 
Encapsulation

(Information Hiding)

‡ Separates the external aspects of an object, which are accessible to other objects, from the internal implementation details of the object, which are hidden from other objects. 
Combining

Data and Operations:

‡ The OO approach combines the data structure and operations in a single entity.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 16

Interfaces
<<Interface>> Class Name Operations 
Does

not have an implementation of its own.  Other classes provide implementations of it.  Client classes are only interested in behavior.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 17

Inheritance 
Sharing

of attributes and operations among classes based on hierarchical relationship.

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 18

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 19

Class and Subclass
Polygon Vertices Border Color Fill Color Draw Erase Move
February 14, 1999 R. A. Volz

Right Triangle
Vertices Hypotenuse length Border Color Fill Color

‡ ‡

Draw Erase Move
Chapter 19 -- Assistance -- Lamimi V. Kamat 20

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 21

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 22

Operations 
Polymorphism

‡ The same ³operation´ may behave differently on different classes. E.g., the move operation behaves differently on a Window and ChessPiece. ‡ Operations may be overloaded when subclasses defined.
± The compiler can distinguish based on the type of the operands in method invocations which operation is actually needed.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 23

Polymorphism
Polygon Paint Car Paint

Triangle Paint
February 14, 1999 R. A. Volz

Square Paint
Chapter 19 -- Assistance -- Lamimi V. Kamat 24

Communication 
Message:

[destination, operation, params]

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 25

What Does OO Mean? 
Pressman

(Coad & Yourdon)

‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡
February 14, 1999

Objects (identity) Classification Inheritance Communication Objects (identity) Classification Inheritance Polymorphism
R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 26 

Rumbaugh

Object Modeling Technique 
Object

modeling technique (OMT) extends from analysis thru design to implementation  Analysis model contains objects found in the application domain, including properties of object and their operations.  These application domain objects form a framework to the design model.

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 27

Object Modeling Technique 
The

same seamless notation is used from analysis to design to implementation.  The system is modeled using three related but different view points.
‡ Object Model : Represents the static, structural, ³data´ aspects of the system. ‡ Dynamic Model : Represents the temporal, behavioral, ³control´ aspects of the system. ‡ Functional Model : Represents transformational, ³functional´ aspects of the system.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 28

Object Modeling 
Links

and Associations

‡ Link: A physical or conceptual connection between instances. E.g., Joe Smith Works-for Simplex company. Mathematically, a tuple, i.e., an ordered list of object instances. A link is an instance of an association. ‡ Associations : A group of links with common structure and semantics. E.g., a person Worksfor a company. All the links in an association connect objects from the same classes.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 29

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 30

Object Modeling 
Multiplicity:

‡ Specifies how many instances of one class may relate to a single instance of an associated class 
Role

Names: attributes

‡ One end of an association. Binary association has two roles. 
Link

‡ May be defined for associations, e.g., if the association is ³uses,´ the link attribute might be one of permission.
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 31

Binary Association & Multiplicity

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 32

Ternary Association

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 33

Link Associations

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 34

Aggregation 
A

³part-whole´ or ³a-part-of´ relationship

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 35

OO Software Process 
Framework

‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡

Identify major classes and connections. Do enough design to ensure they are implementable Extract reusable components and build prototype. Test to uncover errors and get customer feedback. Iterate on design and refine it. Engineer special objects (not in library). Assemble a new prototype. Test and obtain customer feedback. Iterate until satisfactory product obtained.
R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 36

February 14, 1999

OO Metrics 
Because

of reuse, LOC not so useful  # of Scenario scripts, each a triplet of the form [initiator, action, participant], where
‡ Initiator = object initiating a request ‡ action = result of request (method invocation) ‡ participant = server object satisfying request 
#

of key [highly independent] classes  # of support classes (and ave. per key class)  # of subsystems
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 37

Possible Estimating Approach 
Develop

scenario scripts and estimate count  Determine the number of key classes  Categorize key classes Interface type Multiplier No GUI 2.0 Text-based user int. 2.25 GUI 2.5 Complex GUI 3.0
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 38

Possible Estimating Approach 
Estimate

# of support classes by multiplying # key classes in each category by multiplier  Estimate # of person-days per class, e.g., 15-20  Estimate the number of major iterations  There should be a contract deliverable for each major iteration
February 14, 1999 R. A. Volz Chapter 19 -- Assistance -- Lamimi V. Kamat 39

OO Progress Tracking 
This

needs to be done for each iteration (see text for list of specifics in each category)
‡ ‡ ‡ ‡ OO analysis completed OO design completed OO programming completed OO testing completed

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 40

Object-Oriented vs Structured Approach 
Easier to

maintain  Combines data structure and behavior in a single entity  Emphasizes object structure  Reuse more readily accomplished 

Harder to

maintain  May separate data and behavior  Emphasizes procedural structure  Reuse limited, hence possible delay in software construction

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 41

Object-Oriented vs Structured Approach 
Strong

cohesion and weak coupling  Encapsulation, Inheritance and Polymorphism are strong features of OO software development 

Harder to

achieve weak Coupling and strong cohesion  Some languages support encapsulation and polymorphism, but rarely inheritance

February 14, 1999

R. A. Volz

Chapter 19 -- Assistance -- Lamimi V. Kamat 42