download

SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
MODULE
A
Irwin/McGraw-Hill
OBJECT-ORIENTED
ANALYSIS AND
MODELING
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Module A Object-Oriented Analysis & Modeling
• Define object modeling and explain its benefits.
• Recognize and understand the basic concepts and constructs of
an object model.
• Read and interpret an object model.
• Describe object modeling in the context of systems analysis.
• Explain the Unified Modeling Language (UML) and list its
diagrams.
• Construct a use case model.
• Discover objects and classes, and their relationships.
• Construct an object class diagram.
• Construct a state diagram to model an object’s behavior.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Chapter Map
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Introduction to Object Modeling
• Object-oriented analysis (OOA) techniques are used
to (1) study existing objects to see if they can be
reused or adapted for new uses, and (2) define new or
modified objects that will be combined with existing
objects into a useful business computing application.
• Object modeling is a technique for identifying objects
within the systems environment and the relationships
between those objects.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Introduction to The UML
• The Unified Modeling Language (UML) is a set
of modeling conventions that is used to specify or
describe a software system in terms of objects.
– The UML does not prescribe a method for developing
systems—only a notation that is now widely accepted
as a standard for object modeling.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Objects, Attributes, & Instances
• An object is something that is or is capable of being
seen, touched, or otherwise sensed, and about which
users store data and associate behavior.
• Attributes are the data that represent characteristics of
interest about an object.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Objects, Attributes, & Instances
An instance (or object instance) of an object consists of
the values for the attributes that describe a specific
person, place, thing, or event.
412209: Customer
(a)
customer number = 412209
last name =
Bentley
first name =
Lonnie
home phone =
317-463-9593
street =
2625 Darwin Dr.
city =
West Lafayette
state =
Indiana
zipcode =
47906
etc.
0256101329: Book
(b)
ISBN = 0256101329
type = textbook
title = Systems Analysis & Design Methods
copyright = 1996
Irwin/McGraw-Hill
0256102219: Book
ISBN = 0256102219
type = workbook
title = Projects and Cases to Accompany SADM
copyright = 1996
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Methods & Encapsulation
• Behavior refers to those things that the object can do
and which correspond to functions that act on the
object’s data (or attributes).
– In object-oriented circles, an object’s behavior is
commonly referred to as a method or service.
• Encapsulation is the packaging of several items
together into one unit.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Object Classes
A class is a set of objects that share common attributes
and behavior. A class is sometimes referred to as an
object class.
Customer
customer number
last name
first name
home phone
street
city
state
zipcode
etc.
changeAddress()
Irwin/McGraw-Hill
Book
ISBN
type
title
copyright
Open()
Close()
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Inheritance
Inheritance means that methods and/or attributes
defined in an object class can be inherited or reused by
another object class.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Generalization/Specialization
Generalization/specialization is a technique wherein
the attributes and behaviors that are common to several
types of object classes are grouped into their own class,
called a supertype. The attributes and methods of the
supertype object class are then inherited by those object
classes.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Supertypes & Subtypes
• A class supertype is an object class whose instances store attributes
that are common to one or more class subtypes of the object.
• A class subtype is an object class whose instances inherit some
common attributes from a class supertype, and then add other
attributes that are unique to an instance of the subtype.
Person Class
(supertype)
Student Class
(subtype)
Student A
Irwin/McGraw-Hill
Student B
Teacher Class
(subtype)
Student C
Teacher A
Teacher B
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
UML Representation of Generalization/Specialization
Person
last name
first name
birthdate
gender
walk()
jump()
talk()
sleep()
eat()
etc.()
Arrowhead indicates
generalization/specialization
relationship
Student
Teacher
GPA
classification
rank
enroll()
displayGPA()
lecture()
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Object/Class Relationships
An object/class relationship is a natural business
association that exists between one or more
objects/classes.
Places
Customer
Irwin/McGraw-Hill
0..*
Order
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Multiplicity
Multiplicity defines how many instances of one
object/class can be associated with one instance of
another object/class.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Sample UML Multiplicity Notations
UML
Multiplicity Multiplicity
Notation
1
Exactly 1
Zero or one
Zero or
more
Specific
range
Irwin/McGraw-Hill
Employee
Works for
1
Department
or
leave blank
Employee
0..1
Employee
0..*
Customer
Works for
Department
Has
0..1
Makes
0..*
Spouse
Payment
or
*
One or more
Association with Multiplicity
1..*
7..9
Customer
University
Team
Makes
*
Offers
1..*
Has
scheduled 7..9
Payment
Association
Meaning
An employee
works for one
and only one
department.
An employee has
either one or no
spouse.
A customer can
make no payment
up to many
payments.
Course
A university
offers at least 1
course up to
many courses.
Game
A team has either
7, 8, or 9 games
scheduled
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
UML Example of a Composite Aggregation Relationship
Book
1
Cover
0..1
Table of
Contents
1..*
Chapter
0..1
Index
1..*
Page
Solid diamond indicates
composition aggregation
relationship
0..*
Paragraph
1..*
Word
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
UML Example of a Shared Aggregation Relationship
Team
0..*
Hollow diamond indicates
Shared aggregation
relationship
0..*
Player
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Messages
A message is passed when one object invokes one or
more of another object's methods (behaviors) to request
information or some action
MESSAGE
REQUEST
(containing name of request behavior
and attribute needed by ORDER)
Customer
Irwin/McGraw-Hill
display order status
of order 23161
Order
order number
order date
order status
etc.
add order
modify order
delete order
display status
etc.
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
Polymorphism
Polymorphism means “many forms.” Applied to objectoriented techniques, it means that a behavior may be
completed differently for different objects/classes.
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
UML Diagrams
•
•
•
•
•
Use Case
Class
Object
Sequence
Collaboration
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved
SYSTEMS ANALYSIS AND DESIGN METHODS 5th Edition
Whitten Bentley Dittman
UML Diagrams (continued)
•
•
•
•
State
Activity
Component
Deployment
Irwin/McGraw-Hill
Copyright © 2000 The McGraw-Hill Companies. All Rights reserved