0% found this document useful (0 votes)
19 views

2 Intro UML

2-Intro-UML

Uploaded by

Zeno Zone
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

2 Intro UML

2-Intro-UML

Uploaded by

Zeno Zone
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

UML 2.

The Language of Modelling Software


9/14/2023 1
Handling
Complexity

Visualization is the
key …

9/14/2023 2
The Human
Body
• The Digestive System and
Excretory System
• The Respiratory and
Circulatory System
• The Muscular System
• The Skeleton System
• The Nervous System
• The Reproductive System
9/14/2023 3
The Digestive and Excretory System

9/14/2023 4
The
Respiratory
System

9/14/2023 5
The
Circulatory
System

9/14/2023 6
The Muscular System

9/14/2023 7
The
Nervous
System

9/14/2023 8
The
Skeleton
System

9/14/2023 9
The
Human
Body
Parts

9/14/2023 10
Unified Modeling Language (UML)
• A visual modeling language
• used to specify, visualize, construct and document the
artifacts of an object-oriented software-intensive
system under development
• A set of 9 diagrams (UML 1.4) and 14 diagrams (UML
2.2) each help in visualizing the system from a
different perspective
• ISO/IEC 19505-1:2012 defines the Unified Modeling
Language (UML) (version 2)
• Not an industry standard but useful in s/w
development
9/14/2023 11
• Is NOT a S/W development
methodology
– Descriptive not prescriptive
• Combines best practices from
– Data modeling (ex: ER diagram)
– Business modeling (ex:
Workflows)
UML – Object modeling, and
– Component modeling
• Combines
– Booch method (G Booch)
– OMT (J Rumbaugh)
– OOSE (E Jacobson)
• An extensible language
– Stereotypes, profiles
• Architect
• Domain expert
UML • Designer
Users • Programmer/Developer
• Instructor
UML: History

Source: Wikipedia
Important UML Diagrams
We Discuss …
• Use Case Diagram
• Sequence Diagram
• Statechart
• Activity Diagram
• Class Diagram
• Package Diagram
• Component/Deployment Diagram
• Define system functional requirements
in terms of Actors and Use cases
– Each use case specify a piece of
functionality
– A use case can be elaborated in
Use Cases terms of sequence of interactions
between Actor and the domain
objects
– Simple use cases may involve only
one interaction
– More complicated use cases may
involve several interactions
UML Notation for Use Case Diagram

Use Case

Actor Use Case A

<<extend>> <<extend>>

Use Case B Use Case C


Use Case X

<<include>> <<include>>

Use Case Y Use Case Z


Example: Use case Diagram

Passenger

PurchaseMultiCard

PurchaseSingleTicket
<<includes>>
<<includes>>

CollectMoney
<<extends>> <<extends>>

NoChange Cancel
Use Case Diagram – Complaint Management System

9/14/2023 20
Objects and Classes
• Objects represent “things” in real world
– Provide understanding of real world
– Form basis for a software solution
• An Object is a single “thing”
– E.g., John’s car
– Mary’s account
• A Class (object class) is a “Blue print” of objects
with the same (similar) characteristics
– E.g., account, employee, car, customer
• Each Object has an identity and a Behavior, and
is distinguishable from others in the class
UML Notation for Class Diagram
Class Name ClassA

class Attributes 1
Association
class Operations *
ClassB

Super class Class Whole

SubclassA1 SubclassA2 ClassPart1 ClassPart2

Generalization/Specialization Aggregation Hierarchy


An Example Class Diagram
Order Customer
Multiplicity:mandatory Class
dataReceived Name
* 1
isPrepaid address Attribute
Association
number: String creditRating(): String Method
{if Order.customer.creditrating is
price: Money “poor” the Order.isPrePaid must be
dispatch() true}
Corporate
close() Personal
contractName
creditCard#
Constraint creditRating
Line Items
* creditLimit
OrderLine
Role remind()
Quantity:integer Employee
name 0..1
billForMonth()
price:Money
dissatisfied:Boolean * 1 Multiplicity:optional
Product
• Shows sequence of object interactions in a
use case
• Emphasis on messages passed between
objects
– Objects represented by vertical lines
• Actor is on extreme left of page
– Messages represented by labeled
Sequence horizontal arrows
• Only source and destination of arrow
Diagram are relevant
• Message is sent from sending object
to receiving object
– Time increases from top of page to
bottom
– Spacing between messages is not
relevant
– Message sequence numbering is
optional
An Example: Ordering a Burger in Restaurant ,,,,

9/14/2023 25
UML Notation for Sequence Diagram
:Actor
objectB1:
objectA anObject :ClassC
ClassB

1: Input
Message
2: Internal
Message

3*: Iteration
Message

4[Condition]:
Conditional
Message
Example Sequence Diagram for Issue a ticket

:TicketDistributor :Zone :Balance


:Traveler
selectZone() getPrice()
amountDue

insertChange() updateBalance()
amountDue
insertChange()
updateBalance()

acknowledgement «create»
:Ticket
printedTicket
• Statechart
– Graphical representation of
finite state machine
– States are rounded boxes
– Transitions are arcs
• Statechart relates events and states
Statechart • Event
– Causes change of state
– Referred to as state transition
• State represents interval between
successive events
• Initial state
– Arc with black ball at end
UML Notation for Statechart Diagram
Initial State

Event

Superstate A

Substate A1 Event [condition]/


Entry/ Action Action
Substate A2
Do/ Activity
Exit/ Action

Event / Action

States can be composite …

Final State
Statechart Example: Account

Account Opened
Regular
Over
Withdrawal
Withdrawal
Account in Account
Good Standing Overdrawn
Overdraft Paid Off

Deposit

Account closed
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine

Specs (Informal)
• It delivers a chosen drink on receiving two coins
(two quarter – one quarter means 25 cents)
• It can also allow to cancel the order and return
inserted quarters before drink is not delivered,
• After delivering the drink or returning the inserted
quarters, the machine goes to the initial state
• For simplicity, assume the machine has abundant
supply of the drinks
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
A Washing Machine
Even more involved example …
Example
Suppose N is the current simple
state and transition T1 has been
selected to be taken (followed by
T2) – What will be event/action
sequence…?
1. N state exit action
2. M state exit action
3. T1 transition action
4. Branch action
In case the selected transition is T2
5. T2 transition action
6. I1 initial state pointer action (exit
and entry actions of the state L
What will be transition/ are not executed since that state
condition/action sequence…? is not exited)
7. M state entry action
8. I2 initial state pointer action
9. N state entry action
10. …
9/14/2023 40
• Models a process workflow
• Different from Statechart
– A Statechart models states
of an object/system
Activity • Models concurrency and
synchronization
Diagram • Models normal and alternate
flow of control in the same
diagram
• Can be combined with a
statechart
Activity
Diagram
An Example
• Withdrawing money
from the ATM
Swimlanes in
Activity
Diagram
Activity Diagram:
Toaster
• Structured organization of
Code
• Grouping of related classes
to help the software
engineer to identify and to
Package understand dependencies
• When to use?
Diagram – Code Organization
– Program Comprehension
– Change Management
Package Diagram: An Example
Package diagram for
“Online Banking System
• Depicts how components
are wired together to form
bigger component or system
• Component interacts with
each other though
Component interfaces
Diagram • Connect the required
interface of one component
with the provided interface
of another component.
• Designed with an eye
towards deployment
Component Diagram
Component Diagram
Deployment Diagram
Other Uses of UML …
UML: Modeling Concepts (1)
Ex: Project Project

*
Activity

is produced by * consumes
WorkProduct * Task * Resources

System Participant

Model Time

Document Equipment
Client Developer

Report problem Design change


or and
change request estimate impact

Review proposed
change
[change approved]

Update Archive
requirements request

Design Update
test design

Update code
UML:
example of
(if applicable)

Execute all
relevant tests
Process
Review actual
modeling
change
Why UML?
• Dealing with Complexity and Change
• A medium of Communication and
Information sharing needed
– To allow developers to communicate with high
levels of precision
– A lot of decisions have to be made and
communicated
– Software development – A long drawn process

9/14/2023 56
UML Criticisms
• Formal UML models are Large and Complex
• Requires effortful training…
• Some instances of Inconsistent use
• Economics of software development
• Maintenance and synchronization issues
• Claims of being semantically inadequate
– OCL to help
• Lack of Standardization? Not really….
– UML version 1.4.2 document is an ISO/IEC 19501
– UML version 2.5.1 document is now ISO/IEC 19505-1:2012
UML References
• M Fowler, UML Distilled, third edition, Addison Wesley
• Grady Booch, James Rumbaugh, Ivar Jacobson, “The Unified
Modeling Language User Guide”, Addison Wesley, 1999.
• Bernd Bruegge, Allen Dutoit: “Object-Oriented Software
Engineering: Using UML, Patterns, and Java”, Prentice Hall,
2003.
• http://www.uml.org/
• http://www-01.ibm.com/software/rational/uml/
• http://www.agilemodeling.com/essays/umlDiagrams.htm

You might also like