Chapter10 - Object-Oriented Systems Analysis and Design Using UML - E
Chapter10 - Object-Oriented Systems Analysis and Design Using UML - E
Object-Oriented Systems
Analysis and Design
Using UML
Systems Analysis and Design, 8e
Kendall & Kendall
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-2
Object-Oriented Analysis and
Design
• Works well in situations where
complicated systems are undergoing
continuous maintenance, adaptation,
and design
• Objects, classes are reusable
• The Unified Modeling Language (UML)
is an industry standard for modeling
object-oriented systems.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-3
Object-Oriented Analysis and
Design (Continued)
• Reusability
• Recycling of program parts should reduce
the costs of development in computer-
based systems.
• Maintaining systems
• Making a change in one object has a
minimal impact on other objects.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-4
Major Topics
• Object-oriented concepts
• CRC cards and object think
• Unified Modeling Language
• Use case and other UML diagrams
• Packages
• Using UML
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-5
Object-Oriented Concepts
• Objects
• Classes
• Inheritance
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-6
Objects
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-7
Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-8
An Example of a UML Class: A Class Is Depicted as a
Rectangle Consisting of the Class Name, Attributes, and
Methods (Figure 10.1)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-9
Inheritance
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-10
A Class Diagram Showing Inheritance (Figure 10.2)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-11
CRC Cards and Object Think
• CRC
• Class
• Responsibilities
• Collaborators
• CRC cards are used to represent the
responsibilities of classes and the
interaction between the classes.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-12
Four CRC Cards for Course Offerings Show How Analysts Fill in the
Details for Classes, Responsibilities, and Collaborators, as well as for
Object Think Statements and Property Names (Figure 10.3)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-13
Interacting during a CRC Session
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-14
The Unified Modeling Language
(UML) Concepts and Diagrams
• Things
• Relationships
• Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-15
Things
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-16
Relationships
• Structural relationships
• Tie things together in structural diagrams
• Behavioral relationships
• Used in behavioral diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-17
Structural Relationships
• Dependencies
• Aggregations
• Associations
• Generalizations
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-18
Behavioral Relationships
• Communicates
• Includes
• Extends
• Generalizes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-19
Diagrams
• Structural diagrams
• Used to describe the relation between
classes
• Behavior diagrams
• Used to describe the interaction between
people (actors) and a use case (how the
actors use the system)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-20
Structural Diagrams
• Class diagrams
• Object diagrams
• Component diagrams
• Deployment diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-21
Behavioral Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-22
An Overall View of UML and its Components: Things,
Relationships, and Diagrams (Figure 10.4)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-23
Commonly Used UML Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-24
Commonly Used UML Diagrams
(Continued)
• Sequence diagrams
• Show the sequence of activities and class
relationships.
• Class diagrams
• Show classes and relationships.
• Statechart diagrams
• Show the state transitions.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-25
An Overview of UML Diagrams Showing How Each
Diagram Leads to the Development of Other UML
Diagrams (Figure 10.5)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-26
Use Case Modeling
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-27
A Use Case Example of Student
Enrollment (Figure 10.6)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-28
A Use Case Scenario Is Divided into Three Sections:
Identification and Initiation, Steps Performed, and
Conditions, Assumptions, and Questions (Figure 10.7)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-29
Activity Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-30
Specialized Symbols Are Used to Draw an
Activity Diagram (Figure 10.8)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-31
Creating Activity Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-32
Swimlanes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-33
This Activity
Diagram
Shows
Three
Swimlanes:
Client Web
Page, Web
Server, and
Mainframe
(Figure
10.9)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-34
Activity Diagrams and Test Plans
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-35
Activity Diagrams Not Created for
All Use Cases
• Use an activity diagram when:
• It helps to understand the activities of a
use case
• The flow of control is complex
• There is a need to model workflow
• When all scenarios for a use case need to
be shown
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-36
Sequence Diagrams
Timing
lifeline for
the class or
object
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-38
A Sequence Diagram for Student Admission: Sequence
Diagrams Emphasize the Time Ordering of Messages
(Figure 10.11)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-39
Communication Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-40
A Communication Diagram for Student
Admission (Figure 10.12)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-42
Class Diagrams (Continued)
• Classes
• Attributes
• Private– hidden from all other classes
• Public– visible to other objects outside its class
• Protected- hidden from all other classes except
immediate subclasses
• Methods
• Standard- basic things that all classes of object know
how to do (ex. create a new object instance)
• Custom- designed for a specific class
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-43
A Class Diagram for Course Offerings: The Filled-In
Diamonds Show Aggregation and the Empty Diamond
Shows a Whole-Part Relationship (Figure 10.13)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-44
Method Overloading
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-45
Types of Classes
• Entity classes
• Interface classes
• Abstract classes
• Control classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-46
Entity Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-47
Interface or Boundary Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-49
Control Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-51
Defining Messages and Methods
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-52
A Sequence
Diagram for
Using Two
Web Pages:
One for
Student
Information,
One for
Course
Information
(Figure
10.15 )
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-53
Create Sequence Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-54
Creating a Test Plan from a
Sequence Diagram
• Does each method return correct results?
• Ensure that entity classes store or obtain the
correct attribute values.
• Verify that all JavaScript paths work correctly.
• Ensure that the server control classes work
correctly.
• Ask, “What may fail?”
• Determine what to do if something can fail.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-55
Relationships
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-56
Associations
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-57
Types of
associations
that may
occur in class
diagrams
(Figure 10.17)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-58
An Example of an Associative Class in Which a Particular
Section Defines the Relationship between a Student and
a Course (Figure 10.18)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-59
Whole/Part Relationships
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-60
Categories of Whole/Part Relationships
Aggregation:
• A “has a” relationship
• Provides a means of showing that the whole object is composed
of the sum of its parts
• A weeker relationship (whole could be removed and parts stay)
Collection:
• Consists of a whole and its members
• A weak association, members may change, but the whole
retains its identity
Composition:
• The whole has a responsibility for the parts
• A stronger relationship, If the whole is deleted, all parts are
deleted.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-61
An Example of Whole-Part and
Aggregation Relationships (Figure 10.19)
Composition
Aggregation
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-62
Generalization/Specialization
Diagrams
• Generalization
• Inheritance
• Polymorphism
• Abstract classes
• Messages
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-63
Generalization
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-64
Inheritance
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-65
Polymorphism
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-66
Abstract Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-67
A
Generalization
/Specification
Diagram Is a
Refined Form
of a Class
Diagram
(Figure 10.20)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-68
Finding Classes
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-69
Determining Class Methods
• Standard methods
• Examine a CRUD matrix
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-70
Messages
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-71
Statechart Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-72
Statechart Diagrams
(Continued)
• Created when:
• A class has a complex life cycle.
• An instance of a class may update its
attributes in a number of ways through the
life cycle.
• A class has an operational life cycle.
• Two classes depend on each other.
• The object’s current behavior depends on
what happened previously.
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-73
A Statechart Diagram
Showing How a
Student Progresses
from a Potential
Student to a
Graduated Student
(Figure 10.22)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-74
Packages
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-75
Use Cases Can Be Grouped into
Packages (Figure 10.23)
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-76
Putting UML to Work
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-77
Summary
• Object-oriented systems
• Objects
• Classes
• Inheritance
• CRC cards
• UML and use case modeling
• Components of UML
• Things
• Relationships
• Diagrams
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-78
Summary (Continued)
• UML diagrams
• Use case diagrams
• Activity diagrams
• Sequence diagrams
• Communication diagrams
• Class diagrams
• Statechart diagrams
• Using UML
Kendall & Kendall Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 10-79