uml or unified modeling language
TRANSCRIPT
-
7/29/2019 UML or unified modeling language
1/71
1
UML
-
7/29/2019 UML or unified modeling language
2/71
2
What is USE CASE diagram?
A use case diagram establish the capability of the system as a whole.
Components of use case diagram:
ActorUse case
System boundary
Relationship
Actor relationship
Semantic of the components is followed.
-
7/29/2019 UML or unified modeling language
3/71
3
ACTOR:
What is an actor?
An actor is some one or something that must interact with the system
under development
UML notation for actor is stickman, shown below.
Customer Manager Cashier
-
7/29/2019 UML or unified modeling language
4/71
4
ACTOR:
More about an actor:
It is role a user plays with respect to system.
Actors are not part of the system they represent anyone oranything that must interact with the system.
Actors carry out use cases and a single actor may perform more
than one use cases.
Actors are determined by observing the direct uses of the
system,
-
7/29/2019 UML or unified modeling language
5/71
5
ACTOR:
Contd
Those are responsible for its use and maintain as well as other systems
that interact with the developed system.
An actor may
- input information to the system.
- receive information from the system.
- input to and out from the system.
-
7/29/2019 UML or unified modeling language
6/71
6
ACTOR:
How do we find the actor?
Ask following questions to find the actors:
Who uses the system? Who installs the system?
Who Starts up the system?
What other systems use this system?
Who gets the information from the system?
Who provides information to the system?
Actor is always external to the system. They are never part of the
system to be developed.
-
7/29/2019 UML or unified modeling language
7/71
7
ACTOR:
4-Categories of an actor:
Principle : Who uses the main system functions. Secondary : Who takes care of administration & maintenance.
External h/w : The h/w devices which are part of application
domain and must be used.
Other system: The other system with which the system must
interact.
-
7/29/2019 UML or unified modeling language
8/71
8
ACTOR:
Note:
If newly identified actor is using a system in a same way like an
existing actor, then new actor can be dropped. If two actors use system in the same way they are same actors.
-
7/29/2019 UML or unified modeling language
9/71
9
USE CASE:
What is USE case?
A use case is a pattern of behavior, the system exhibits
Each use case is a sequence of related transactions performed by an
actor and the system in dialogue.
USE CASE is dialogue between an actor and the system.
Examples:
Open new account Withdrawal of cash
from ATM
-
7/29/2019 UML or unified modeling language
10/71
10
USE CASE:
More about USE CASE:
It is a snapshot of one aspect of system.
They model a dialog between actor and system. A use case typically represents a major piece of functionality
that is complete from beginning to end.
Most of the use cases are generated in initial phase, but you
find some more as you proceed.
A use case may be small or large. It captures a broad view of aprimary functionality of the system in a manner that can be
easily grasped by non technical user.
-
7/29/2019 UML or unified modeling language
11/71
11
USE CASE:
Contd
A use case must deliver something of value to an actor.
The use cases may be decomposed into other use cases. Use cases also present a good vehicle for project planning.
-
7/29/2019 UML or unified modeling language
12/71
12
USE CASE:
How do we find the use cases?
What functions will the actor want from the system?
Does the system store information? What actors will create, read,update. Or delete that information?
Does the system need to notify an actor about changes in its internal
state?
-
7/29/2019 UML or unified modeling language
13/71
13
USE CASE:
Generic format for documenting the use case:
- Pre condition: If any Use case : Name of the case.
Actors : List of actors(external agents), indicating whoinitiates the use case.
Purpose : Intention of the use case.
Overview : Description.
Type : primary / secondary.
Post condition: If any Typical Course of Events:
ACTOR ACTION : Numbered actions of the actor.
SYSTEM RESPONSE : Numbered description of system responses.
-
7/29/2019 UML or unified modeling language
14/71
14
USE CASE:
USE CASE documentation example:
The following use case describes the process of opening a new account
in the bank.
Use case :Open new account
Actors :Customer, Cashier, Manager
Purpose :Like to have new saving account.
Description :A customerarrives in the bank to open the new
account. Customer requests for the new account
form, fill the same and submits, along with theminimal deposit. At the end of complete successful
process customer receives the passbook.
Type :Primary use case.
-
7/29/2019 UML or unified modeling language
15/71
15
Grouping USE CASES:
Those use case functionality which are directly dependent on the
system environment are placed in interface objects
Those functionality dealing with storage and handling of information
are placed in entity objects
Functionality's specific to one or few use cases and not naturally
placed in any of the other objects are placed in control objects
By performing this division we obtain a structure which helps us to
understand the system from logical view
-
7/29/2019 UML or unified modeling language
16/71
16
SYSTEM BOUNDARY:
What is System Boundary?
It is shown as a rectangle.
It helps to identify what is external verses internal, and what theresponsibilities of the system are.
The external environment is represented only by actors.
-
7/29/2019 UML or unified modeling language
17/71
17
RELATIONSHIP:
What is Relationship?
Relationship between use case and actor.
Communicates Relationship between two use cases
Extends
Uses
Notation used to show the relationships:
>
-
7/29/2019 UML or unified modeling language
18/71
18
RELATIONSHIP:
Relationship between use case and actor is often referred as
communicates .
Relationship between two use cases is refereed as either uses
or extends.
USES:
- Multiple use cases share a piece of same functionality.
- This functionality is placed in a separate use case rather thandocumenting in every use case that needs it.
-
7/29/2019 UML or unified modeling language
19/71
19
RELATIONSHIP:
Contd...
A uses relationship shows behavior that is common to one or
more use cases.
EXTENDS:
It is used to show optional behavior, which is required only
under certain condition.
-
7/29/2019 UML or unified modeling language
20/71
20
USE CASE diagram:
Use case diagram for the shown functionality.
Balance status
report
Withdraw cash
Validation
uses
CustomerClerk
Manager
extends
ATM
-
7/29/2019 UML or unified modeling language
21/71
21
Beginning Analysis and Design
Completion of first version of use case diagram initiates the processes
of analysis and design.
UML provides the framework to carry out the process of analysis and
design in form of set of diagrams.
Every diagram and notation used in the diagram carries the semantics.
First step towards analysis and design is to specify the flow of events.
-
7/29/2019 UML or unified modeling language
22/71
22
Flow of Events:
A flow of events document is created for each use case.
Details about what the system must provide to the actor when the useis executed.
Typical contents
How the use case starts and ends Normal flow of events
Alternate flow of events
Exceptional flow of events
Typical Course of Events has:
Actor Action(AA)
System Response(SR)
-
7/29/2019 UML or unified modeling language
23/71
23
Normal Flow of Events:
Forwithdrawal of cash:
1.(SR) The ATM asks the user to insert a card.
2.(AA) The user inserts a cash card.
3.(SR) The ATM accepts the card and reads its serial number. 4.(SR) The ATM requests the password.
5.(AA) The user enters 1234.
6.(SR) The ATM verifies the serial number and password with the
bank and gets the notification accordingly.
7.(SA)The ATM asks the user to select the kind of transaction.
8.(AA)User selects the withdrawal.
-
7/29/2019 UML or unified modeling language
24/71
24
Normal Flow of Events:
Contd...
9.(SR)The ATM asks for the amount of cash; user enters Rs. 2500/-
10.(SR)The ATM verifies that the amount of cash is within predefined
policy limits and asks the bank, to process the transaction which
eventually confirms success and returns the new account balance.
11.(SR) The ATM dispenses cash and asks the user to take it.
12.(AA) The user takes the cash.
13.(SR) The ATM asks whether the user wants to continue.
14.(AA) The user indicates no.
-
7/29/2019 UML or unified modeling language
25/71
25
Normal Flow of Events:
Contd...
15.(SR) The ATM prints a receipt, ejects the card and asks the user to
take them
16.(AA) The user takes the receipt and the card.
17.(SR) The ATM asks a user to insert a card.
-
7/29/2019 UML or unified modeling language
26/71
26
Alternative Flow of Events:
For withdrawal of cash use case:
9. The ATM asks for the amount of cash; the user has change of mind
and hits the cancel.
-
7/29/2019 UML or unified modeling language
27/71
27
Exceptional Flow of Events:
For withdrawal of cash use case:
3 Suspicious pattern of usage on the card.
10 The machine is out of cash.
11 Money gets stuck in the machine.
-
7/29/2019 UML or unified modeling language
28/71
28
Why flow of events?
It helps in understanding the functionality of a system to be developed.
Flow of events helps in finding objects of the system to be developed.
Happens to be most important and very first step towards analysis anddesign.
-
7/29/2019 UML or unified modeling language
29/71
29
What is Scenario?
The functionality of the use case is captured in flow of the
events.
A scenarios is one path through the flow of events for the use
case. Scenarios are developed to help identify objects, classes and
object interactions for that use case.
-
7/29/2019 UML or unified modeling language
30/71
30
What is Interaction diagram?
Interaction diagrams are models that describe how groups of objects
collaborate in some behavior
There are 2 kinds of interaction diagrams
Sequence diagram
Collaboration diagram
Sequence diagrams are a temporal representation of objects and their
interactions
Collaboration diagrams are spatial representation of objects, links and
interrelations
-
7/29/2019 UML or unified modeling language
31/71
31
What is sequence diagram?
Typically these diagrams capture behaviors of the single
scenario.
Shows object interaction arranged in time sequence.
They show sequence of messages among the objects.
It has two dimensions, vertical represents time & horizontal
represents objects.
Components of sequence diagram:
-objects
-object lifeline-Message
-pre/post conditions.
-
7/29/2019 UML or unified modeling language
32/71
32
OBJECT & OBJECT LIFE LINE:
Object are represented by rectangles and name of the objects are
underlined.
Object life line are denoted as dashed lines. They are used to
model the existence of objects over time.
Name:Class
-
7/29/2019 UML or unified modeling language
33/71
33
MESSAGES:
They are used to model the content of communication between objects.
They are used to convey information between objects and enable
objects to request services of other objects.
The message instance has a sender, receiver, and possibly other
information according to the characteristics of the request.
Messages are denoted as labeled horizontal arrows between life lines.
The sender will send the message and receiver will receive the
message.
-
7/29/2019 UML or unified modeling language
34/71
34
MESSAGES:
Contd
May have square brackets containing a guard conditions. This is a
Boolean condition that must be satisfied to enable the message to be
sent.
May have have an asterisk followed by square brackets containing an
iteration specification. This specifies the number of times the message
is sent.
May have return list consisting of a comma -separated list of names
that designate the values of returned by the operation.
Must have a name or identifier string that represents the message.
May have parentheses containing an argument list consisting of a
comma separated list of actual parameters passed to a method.
-
7/29/2019 UML or unified modeling language
35/71
35
:Customer :ATM :BankRequest password
Verify accountEnter the password
Account o.k.Request option
Enter option
Request amount
Enter the amountUpdate transaction
Transaction commit
Insert card
Dispense cash
Request take cashTake cash
Request continuation
Terminate
Print receipt ,eject card
Request take cardTake card
Display main screen and prompt for the card.
:TransactionCreateTransaction
Transaction
complete
Sequence diagram [for withdrawal of cash, normal flow]
-
7/29/2019 UML or unified modeling language
36/71
36
What is Collaboration diagram?
Collaboration diagrams illustrate the interaction between the objects,
using static spatial structure.
Unlike sequence diagram the time is not explicitly represented in these
diagrams
In collaboration diagram the sequence of messages is indicated by
numbering the messages. The UML uses the decimal numbering
scheme.
In these diagrams, an actor can be displayed in order to represent the
triggering of interaction by an element external to the system.
This helps in representing the interaction, without going into the
details of user interface.
-
7/29/2019 UML or unified modeling language
37/71
37
Components of collaboration diagram:
Named objects
Links: Links are represented by a continuous line between objects, and
indicates the exchange of messages.
Messages has following attributes:
Synchronization --thread name, step within thread.
Sequence number
Message labels : The name of the message often corresponds to an operation
defined in the class of the object that is the destination of the message.
Message names may have the arguments and return values.
*[iteration].
It uses decimal notation.
Message direction.
-
7/29/2019 UML or unified modeling language
38/71
38
Semantics of components:
Object names identify which objects are participating and the links
show which objects collaborate
A link between two objects must exist for one object to send message
to another and vice a versa.
Messages in the collaboration diagram get transformed to more
detailed signature.
They use the decimal notation system for numbering the messages.
The direction of the message defines the sender and receiver ofthe message
-
7/29/2019 UML or unified modeling language
39/71
39
Collaboration diagram [for withdrawal of cash, normal flow.]
1. Insert card
Enter password, Enter kind
Enter amount,
Take cash, Take card
cancel,Terminate, Continue
Display main screen
unreadable card message,
request password,
request kind, request amount,
canceled message, eject card, failure message,
dispense cash, request take cash
request continuation,
print receipt, request take card
bad account message,
bad bank account message Verify account,process transaction
Transaction succeed
Transaction failed
account o.k.
bad account,bad password,
bad bank code
Create Transaction
Transaction completeCUST-
OMER
BANK
ATMTRANSA-
CTION
-
7/29/2019 UML or unified modeling language
40/71
40
What is Class diagram?
A class diagram shows the existence of classes and their relationshipsin the logical view of a system
UML modeling elements in class diagrams are:
Classes, their structure and behavior.
relationships components among the classes like association,aggregation, composition, dependency and inheritance
Multiplicity and navigation indicators
Role names or labels.
-
7/29/2019 UML or unified modeling language
41/71
41
Major Types of classes:
Concrete classes
A concrete class is a class that is instantiable; that is it can have
different instances.
Only concrete classes may be leaf classes in the inheritance tree.
Abstract classes
An abstract class is a class that has no direct instance but whose
descendants classes have direct instances.
An abstract class can define the protocol for an operation without
supplying a corresponding method we call this as an abstractoperation.
An abstract operation defines the form of operation, for which each
concrete subclass should provide its own implementation.
-
7/29/2019 UML or unified modeling language
42/71
42
RELATIONSHIP:
Association
Aggregation
Composition
Inheritance
Dependency
Instantiation
-
7/29/2019 UML or unified modeling language
43/71
43
ASSOCIATION:
These are the most general type of relationship:
It denotes a semantic connection between two classes
It shows BI directional connection between two classes
It is a weak coupling as associated classes remain somewhat
independent of each other
Example:
CUSTOMER ATM system
-
7/29/2019 UML or unified modeling language
44/71
44
AGGREGATION:
This is a special type of association
The association with label contains or is part of is an
aggregation
It represents has a relationship
It is used when one object logically or physically contains other
The container is called as aggregate
It has a diamond at its end
The components of aggregate can be shared with others It expresses a whole - part relationships
-
7/29/2019 UML or unified modeling language
45/71
45
AGGREGATION:
Example:
Customer ATM card
-
7/29/2019 UML or unified modeling language
46/71
46
COMPOSITION:
This is a strong form of aggregation
It expresses the stronger coupling between the classes
The owner is explicitly responsible for creation and deletion of
the part
Any deletion of whole is considered to cascade its part
The aggregate has a filled diamond at its end
Window Client Area
-
7/29/2019 UML or unified modeling language
47/71
47
INHERITANCE:
The inheritance relationship helps in managing the complexity by
ordering objects within trees of classes with increasing levels of
abstraction. Notation used is solid line with arrowhead,shown below.
Generalization and specialization are points of view that are based on
inheritance hierarchies.Account
SavingAccountCurrentAccount
-
7/29/2019 UML or unified modeling language
48/71
48
DEPENDENCY:
Dependency is semantic connection between dependent and
independent model elements.
This association is unidirectional and is shown with dotted
arrowhead line.
In the following example it shows the dependency relationshipbetween client and server.
The client avails services provided by server so it should have
semantic knowledge of server.
The server need not know about client.
Client Server
-
7/29/2019 UML or unified modeling language
49/71
49
INSTANTIATION
This relationship is defined between parameterized class and
actual class.
Parameterized class is also referred as generic class.
A parameterized class cant have instances unless we first
instantiated it
Example:
Queue
Queue
Element
-
7/29/2019 UML or unified modeling language
50/71
50
What is Cardinality? :
Definition:Number of instances of each class involved in the dialogue
is specified by cardinality.
Common multiplicity values:
Symbol Meaning
1 One and only one
0..1 Zero or one
MN From M to N (natural integer)
0..* From zero to any positive integer
1..* From one to any positive integer
Also thought can be given about navigability to every applicable
relationship.
-
7/29/2019 UML or unified modeling language
51/71
51
Reaching the class diagram:
In collaboration diagram we have shown the objects, their interaction
and detailed message signature.
This information is carried forward to the class diagram.
At this point,we group the similar objects and form classes.
Messages get mapped to responsibilities for respective classes.
Find the attributes for every class.
Transform the links to appropriate relationships.
Relationship is further refined with respect to multiplicity and
navigability.
This complete procedure brings the minimal class diagram [for withdraw cashuse case, normal flow.]
-
7/29/2019 UML or unified modeling language
52/71
52
Class diagram[for withdrawal of cash, normal flow]
Customer
Transaction
1
0..*
1
0..*ATMSystem
1..*
1..*
1..*
1..*
Bank[Branch]1
1..*
1
1..*1
11
1
-
7/29/2019 UML or unified modeling language
53/71
53
What more to the Class Diagram?
Till this slide we have worked out the essentials of class diagram for
withdrawal of cash use case, normal flow of events.
Similar exercise required to be carried out for every scenario and
clubbed all in the class diagram.
At this point, we refine this integrated class diagram to add further finedetails. Approximate sketch for this class diagram has been shown at
the end of this module.
Refinement attributes should be updated right from sequence diagram
to class diagram.
Next few slides will take into the discussion of refinement attributes.
This process of iterative and incremental development will continue till
there is no change in two consecutive iteration.
-
7/29/2019 UML or unified modeling language
54/71
54
Refinement attributes:
Stereotypes:
Stereotypes are part of the range of extensibility mechanism provided
by UML
It permits user to add new model element classes on top of the kernel
predefined by UML
-
7/29/2019 UML or unified modeling language
55/71
55
Refinement attributes:
Contd
Constraints:
Constraints are functional relationship between the entities and object
model. The entities include objects, classes, attributes, association,
links.
A constraint restricts the values that entities can assume.
UML doesn't specify a particular syntax for constraints, other than they
should appear between braces, so they may therefore be expressed
using natural language, pseudo code, navigation expression or
mathematical expression
UML1.2 does prefer the use of a constraint language OCL i.e. Object
Constraint Language, which is subset of UML.
-
7/29/2019 UML or unified modeling language
56/71
56
Refinement attributes:
Qualifier:
UML provides a role of constraint notation to indicate different kind of
collections that may be inherent in the analysis model
Common role constraints for multi valued roles include
{ordered} Collection is maintained in sorted manner
{bag} Collection may have multiple copies of same item.
{set} Collection may have at most one copy of given item.
Some constraints may be combined such as: {ordered set}
-
7/29/2019 UML or unified modeling language
57/71
57
Refinement attributes:
Qualifier:
Another common design scheme is to use a key value to retrieve an
item from the collection. This is called as qualified association and the
key value as qualifier.
A qualified association is the UML equivalent of a programmingconcept variously known as associative arrays, maps,dictionaries
A qualified association relates two object classes and a qualifier
The qualifier is a special attribute that reduced the effective
multiplicity of an association.
One to many and manyto many association may be qualified.
-
7/29/2019 UML or unified modeling language
58/71
58
Refinement attributes:
Check for many to many relationship, if any, normalize with qualifier
or association class.
Check for the scope forming abstract classes and template classes.
Check for helper functions.
Thought can be given for using the design patterns.
-
7/29/2019 UML or unified modeling language
59/71
59
Refined Class diagram [for withdrawal of cash]
SavingAccount
AccountAccessor
TellerScreen
ATMScreenBankAssociates
CashierStation
person
Cash
BatchJob
NoteHelpForBankCard
ATMSystem
BankComputer
Area
BankCard
Bank[Branch]11
1..*1..*
Customer
1
0..1
1
0..1
11
Account
1
1
1
1
1..*
1
1..*
1
Transaction
11..*
11..*
Slips
CurrentAccount
Few morerelationship can be further added to the shown diagram:
-
7/29/2019 UML or unified modeling language
60/71
60
What is state transition diagram?
A state transition diagram shows the states of a single object, the
events or the messages that cause a transition from one state to another
and the action that result from a state change.
A state transition diagram will not be created for every class in the
system.Components of State Diagram:
Start State
Stop state
State Transition
-
7/29/2019 UML or unified modeling language
61/71
61
Semantics of every components:
State: A state is a condition during the life of an object when it
satisfies some condition, performs some action, or waits for an event.
The UML notation for a state is a rectangle with rounded corners.
Special states:There are two special states.
Start state: Each state diagram must have one and only one start
state. Notation for start state is filled solid circle.
Stop State: An object can have multiple stop states. Notation for stop
state is bulls eye.
-
7/29/2019 UML or unified modeling language
62/71
62
Semantics of every components:
Contd...
State transition: A state transition represents a change from an
originating to a successor state.
Transition label: event name[guard condition] / action
-
7/29/2019 UML or unified modeling language
63/71
63
State Transition Diagram [for Account class. ]
Operational
Dormant
Open
seized
transaction request[ validate ] / update()
close
no transaction / Transfer_to_Dormant_Ledger
fill_the_request_form / update()
Fraud or authorized instruction[Validate]
/ lockAccount()
matter_resolved[ validate ] / unlockAccount()
request and fill the form for new saving account[ validate ] / process
fill_the_request_form/update()
transactionStrart / Transfer_to_main_ledger ()
Note:Account can be closed from open state as well
-
7/29/2019 UML or unified modeling language
64/71
64
More about State Diagram:
A state diagram will not be created for every class.
state diagrams are used only for those classes that exhibit interesting
behavior.
State diagrams are also useful to investigate the behavior of user
interface and control classes.
State diagram are used to show dynamics of a individual class
-
7/29/2019 UML or unified modeling language
65/71
65
What is activity diagram?
It is a special kind of state diagram and is worked out at use case level.
These are mainly targeted towards representing internal behavior of a
a use case.
These may be thought as a kind of flowchart.
Flowcharts are normally limited to sequential process; activity
diagrams can handle parallel process.
Activity diagrams are recommended in the following situations:
Analyzing use case
Dealing with multithreaded application
Understanding workflow across many use cases.
-
7/29/2019 UML or unified modeling language
66/71
66
Consistency Checking
Consistency checking is the process of ensuring that,information in both static view of the system(class diagram)and the dynamic view of the system(sequence and collaboration
diagram) is telling the same story.
-
7/29/2019 UML or unified modeling language
67/71
67
What is component diagram?
COMPONENT DIAGRAM:
Component diagrams illustrate the organizations and dependencies
among software components.
A component may be
A source code component
A run time components
An executable component Dependency relationship.
-
7/29/2019 UML or unified modeling language
68/71
68
Component Diagram[for withdrawal of cash]
policy.dll
BranchBank.dllcustomer.dll
ATM.exe
BranchBank.exe
BankServer.exe
-
7/29/2019 UML or unified modeling language
69/71
69
What is deployment diagram?
A deployment diagram shows the relationship among software and
hardware components in the delivered system.
These diagram include nodes and connections between nodes.
Each node in deployment diagram represents some kind of
computational unit, in most cases a piece of hardware.
Connection among nodes show the communication path over which
the system will interact.
The connections may represent direct hardware coupling line RS-232
cable, Ethernet connection, they also may represent indirect coupling
such as satellite to ground communication.
-
7/29/2019 UML or unified modeling language
70/71
70
Deployment diagram
ATM_machine
Bank_server
BranchBank_
Ethernet
Ethernet
Bank.exe
BankServer.exeATM.exe
-
7/29/2019 UML or unified modeling language
71/71
71
THANK-U!