Dynamic Modeling: Defining Classes B.Ramamurthy 5/28/2016

advertisement
Dynamic Modeling: Defining
Classes
B.Ramamurthy
5/28/2016
B.Ramamurthy
1
Introduction
(User) Requirement Analysis was done using Use Case Model.
Result of this phase is a Use Case Diagram(s).
Further analysis involves using the use cases to discover classes
and relationship among them. Result of this phase is a class
diagram(s).
Next the classes need to be defined: the attributes, the methods
and dynamics of the interaction among the classes. Dynamic
Model expresses the dynamic behavior of objects of class and
the interaction among objects during the execution of a system.
Dynamic Modeling Tools are: Collaboration diagram, state
diagram, sequence diagram and activity diagram.
5/28/2016
B.Ramamurthy
2
Topics for Discussion
Revisit Weather Station analysis.
Other class diagrams from Lab2.
Class definition.
Interface, Abstract Class, Concrete Class.
Sequence Diagrams: describe how objects interact and
communicate with each other. Primary focus here is time.
Collaboration Diagrams: describe how objects interact but the focus
is on space.
Activity Diagrams: yet another way of showing interaction but with
focus on activities.
Since Sequence, Collaboration, and Activity diagrams all show
interaction, you must make a choice as what you want to use in your
practice.
State Diagrams: describe which states an object can have during its
life cycle, behavior in those states, and along with events that bring
about state transitions.
We will study Sequence Diagrams and State Diagrams.
5/28/2016
B.Ramamurthy
3
Class Definition
Class name
Class attributes/characteristics/properties/data
Class operations/capabilities/behaviors/methods
Types of methods:






5/28/2016
Constructor(s)
Destructor
Service methods
Get/set methods
Utility methods
Predicate methods
B.Ramamurthy
4
Sequence Diagrams
Sequence diagrams illustrate how
objects interact with each other.
They focus on message sequences.
Objects interact by sending messages
that invoke operations specified by the
objects receiving the messages.
Two axes: vertical axes shows time,
horizontal access shows objects.
5/28/2016
B.Ramamurthy
5
Message Types and Notation (UML)
Synchronous Message (call)
Asynchronous Message (interrupt)
Simple Message (passing of control
Flow)
Message Return
Note: Rational Rose Demo tool provides just one type
of arrow head for all the messages.
5/28/2016
B.Ramamurthy
6
Components of a Sequence Diagram
: Manager
Dan : Manager
Dan : Manager
Sue :
Employee
1: contactClient ( )
An Object
An object
which is an
instance of class
Manager
An object Dan
which is an
instance of class
Manager
Dan, the Manager is
sending a message to
Sue, the Employee
to contactClient();
contactClient() is a method of
Employee class.
5/28/2016
B.Ramamurthy
7
Job Application: Class Diagram
JobApplicant
fillupAppln( )
Secretary
Manager
recvAppln( )
nextAppln( )
putAppln( )
Intray
Application
put( )
get( )
new( )
5/28/2016
B.Ramamurthy
8
Job Application: Sequence Diagram
Ian : Job
Applicant
: Application
Tony :
Secretary
: Intray
Sue : Manager
1: new ( )
2: fillupAppln ( )
3: recvAppln ( )
4: put ( )
5: nextAppln ( )
6: get ( )
7: newAppln ( )
5/28/2016
B.Ramamurthy
9
State Diagram
Defines the semantics of a class or
operations within an object.
Basic components: Initial State, Final
State, intermediate state, state
transition and associated labels.
All objects have a state which is a result
of previous activities performed by the
object.
5/28/2016
B.Ramamurthy
10
Matrix of Diagrams
Use
Case
CRC
Class
Component
Sequence State Collabortn. Activity
Package
Deployment
Analysis
System
Design
Class
Design
Physical
Architecture
5/28/2016
B.Ramamurthy
11
Download