Software Engineering - Mr. Ahmad Al-Ghoul

advertisement
Software Engineering
- Mr. Ahmad Al-Ghoul
Learning Objectives


Describe Unified Modeling
Language (UML) tools and
techniques, including class
diagrams, sequence diagrams,
state transition diagrams, and
activity diagrams
Explain how to organize an object
model
2
Object-Oriented analysis and
design using UML

Class Diagram





A class is a collection of objects with common
structure, common behaviour, common relationships,
and common semantics.
A class diagram represents a detailed view of single
use case
Show the classes that participate in the use case
Document the relationship among the classes
Class diagram is a logical model, which evolves into a
physical model and finally becomes a functioning
information system
3
Object-Oriented analysis and
design using UML

Class Diagram
 A class is drawn as a rectangle with the class name at
the top
 Classes should be named using the vocabulary of the
domain
Naming standards should be created
The class’s attributes
The class’s methods
Lines show relationship between classes and have labels
identifying the action that relates the two classes





When you construct the class diagram, the first step is to
review the use case and identify the classes that
participate in the underlying business transaction
4
Object-Oriented analysis and design using
UML

Cardinality describes how instances of one class
relate to instance's of anther class
Examples of UML notations that indicate the nature of the relationship
between instances of one class and instances of another class. [1]
5
Object-Oriented analysis and design using UML



Class diagram for a
sales order use case
(attributes and methods
omitted for clarity).
Notice that the sales
office has one sales
manager who can have
anywhere from zero to
many sales rep.
Each sales rep can have
anywhere from zero to
many customers, but
each customer has only
one sales rep
[1]
6
Object-Oriented analysis and
design using UML



The use case diagram presents an outside view
of the system
Interaction diagrams describe how use cases are
realized as interactions among societies of
objects
Sequence diagrams, state transition diagrams,
and activity diagrams are dynamic modeling
tools that can help a systems analyst understand
how objects behave and interact with the
system.
7
Object-Oriented analysis and
design using UML

Sequence Diagrams




A sequence diagram is a dynamic model of a use case
Sequence diagrams show classes interactions
arranged in a time sequence
A sequence diagram graphically documents the use
case by showing the classes, the messages, and the
timing of the messages
specified by the flow of events.
8
Object-Oriented analysis and
design using UML

Sequence diagrams include symbols that
represent
Classes
 Lifelines
 Messages
 Focuses

9
Object-Oriented analysis and
design using UML

Classes



A class is identified by a rectangle with the name
inside.
Classes that send or receive messages are shown at
the top of the sequence diagram
Lifelines



A lifeline is identified by a dashed line
The lifeline represents the time during which the
object above it is able to interact with the other
objects in the use case
An X marks the end of the lifeline
10
Object-Oriented analysis and
design using UML

Messages



A message is identified by a line showing direction
that runs between two objects
The label shows the name of the message and can
include additional information about the content
Focuses


A focus is identified vertical shape that covers the
lifeline
The focus indicates when an object sends or receives
a message
11
Object-Oriented analysis and
design using UML
The sequence diagram for the ADD NEW STUDENT use case. [1]
12
Object-Oriented analysis and
design using UML

State Transition Diagrams


A state transition diagram shows how an object changes from
one state to another, depending on events that affect the object
A state transition diagram shows







The life history of a given object
The events that cause a transition from one state to another
The actions that result from a state change
In a state transition diagram, the states appear as rounded
rectangles with the state names inside
The small circle to the left is the initial state
The lines show direction and describe the action or event that
causes a transition from one state to anther
The circle at the right with a hollow border is the final state
13
Object-Oriented analysis and design using UML



An example of a state transition diagram for a bank
account.
A bank account could be opened as NEW or EXISTING
account, and eventually become a CLOSED or FORMER
account
Anther possible state for a bank account could be
FORZEN, if the account’s assets are legally attached
[1]
14
Object-Oriented analysis and
design using UML

Activity Diagrams

An activity diagram resembles a horizontal
flowchart that shows the actions and events
as they occur
15
Object-Oriented analysis and
design using UML




Activity represented as rounded
rectangles.
Activities are typically action states, it goes
automatically to the next state after the
action is complete.
The filled in circle represents the start
Transitions shown as arrows show how
you move from activity to activity
16
Object-Oriented analysis and design using
UML


An activity diagram shows the actions and events
involved in withdrawing cash from an ATM machine.
Notice that the customer initiate the activity by inserting
an ATM card and requesting cash
[1]
17
Object-Oriented analysis and
design using UML

Organizing the Object Model




Each diagram or object definition should be supported by clear,
relevant documentation that can be accessed easily by anyone
who reviews the object model
You should organize your use cases and use case diagrams so
they can be linked to the appropriate class, state transition,
sequence, and activity diagrams
Your diagrams and documentation are the foundation for the
system’s design
It is much easier to repair a diagram now than to change the
software later
18
Sequence Summary


A class diagram represents a a detailed view of a single
use case, showing the classes that participate in the
underlying business transaction, and the relationship
among class instances, which is called cardinality
A sequence diagram is a dynamic model of a use case,
showing the interaction among classes during a specified
time period




Sequence diagram include lifelines, messages, and focuses
A state transition diagram shows how an object changes
from one state to anther, depending on events that
affect the object
An activity diagram resembles a horizontal flowchart that
shows actions and events as they occur in a system
At the end of the object modeling process, you organize
your use cases and use case diagrams and create class,
sequence, state transaction, and activity diagrams
19
Sequence Summary

In this Sequence we have



Explained and described how to draw different UML
diagrams including class diagrams, sequence
diagrams, state transition diagrams, and
activity diagrams
Defined the terms lifelines, messages, and focuses
Explained how to organize your use cases
and use case diagrams and create class,
sequence, state transaction, and activity
diagrams
20
Reference
[1] System Analysis and Design, Sixth Edition
Authors: Gary B. Shelly, Thomas J. Cashman and Harry J. Rosenblatt
,
Publisher: SHELLY CASHMAN SEWIES.
[2] system analysis and design, sixth edition
Authors: Kenneth E. Kendall and Julie E. Kendall
Publisher: Prentice Hall
[3] Modern Systems Analysis and Design Third Edition
Authors: Jeffrey A. Hoffer , Joey F. George, Joseph S. Valacich
Publisher: prentice hall
21
Download