Sei sulla pagina 1di 49

UML for Analysts

Jason Gorman

© Jason Gorman 2005. All rights reserved.


"I am currently working on a
team which is [in] the process
Requirements Analysis
of adopting RUP and UML
standards and practices. After Using UML (2 Days)
one of our design sessions, I
needed to lookup some Since Autumn 2003, over 180,000 Java and .NET developers have
information and came across learned the Unified Modeling Language from Parlez UML
your site. Absolutely great! (http://www.parlezum l.com) , making it one of the most popular
Most [of] the information I've UML training resources on the Internet.
had questions about is
contained within your tutorials Modeling For A Reason
and then some."
Unlike other UML courses, Requirements Analysis using UML
introduces only the elements of modeling you w ill need to get the job
done.
"Really great site... I have been
trying to grasp UML since the Learning By Doing
day I saw Visual Modeler. I
knew a few things but there By w orking through a practical mini-project, you w ill learn key
were gaps. Thanks to your site modeling notations as w ell as useful analysis techniques within a
they have shrunk simple iterative process that you will be able to apply to your ow n
considerably." projects immediately.

Beyond Use Cases


"I went on a UML training Other analysis courses start w ith functional requirements and leave
course three months ago, and out the critical element of any software project – where do those
came out with a big folder full requirements come from in the first place?
of hand-outs and no real
understanding of UML and how
to use it on my project. I spent Requirements Analysis using UML starts at the beginning w ith
a day reading the UML for business requirements and business models, and demonstrates a
.NET tutorials and it was a simple process for getting from business goals to system use cases
much easier way to learn. and beyond, giving clear traceability at all levels of your enterprise
'Here's the diagram. Now architecture
here's the code.' Simple."
www.parlezuml.com/training.htm

advertisement

© Jason Gorman 2005. All rights reserved.


What Will I Learn?
Requirements Analysis using UML takes you on a journey from the business
goals of your project to an object oriented description of system functionality. You
will only learn what you need to know to get the job done, but enough to provide a
solid foundation for further learning.

Use Case Diagrams Object Diagrams & Filmstrips


Model the users of the Model snapshots of the running
system and the goals they system and show how actions
can achieve by using it change object state

Class Diagrams Packages &


Model types of objects Model Management
and the relationships Organise your logical and
between them. physical models with packages

Activity Diagrams User Experience Modeling


Model the flow of use cases Design user-centred systems
and single and multi- with UML
threaded code

Statechart Diagrams Enterprise Architecture


Model the lifecycle of Tracing your models
objects and event-driven through the layers of the
logic Zachman Framework

Business Modeling
Plus simple approaches to:
Apply UML to business
goals, processes, rules and
structure • Iterative & Incremental Development
• Change & Defect Management
www.parlezuml.com/training.htm • User Acceptance Testing
• Project Planning & Tracking

advertisement

© Jason Gorman 2005. All rights reserved.


In This Section
• Use Case diagrams
• Class Diagrams
• Object Diagrams & Filmstrips
• Sequence Diagrams
• State Transition Diagrams
• Packages & Model Management
• Model-View-Controller & Robustness Analysis

© Jason Gorman 2005. All rights reserved.


Use Case Diagrams

© Jason Gorman 2005. All rights reserved.


Users Achieve Functional Goals Through Use Cases
To get cash

Withdraw cash

Deposit cheques
Check balance

To deposit money
without going in to
the branch
Request mini-statement

To see how much


money is in the account

To see details of recent


transactions

© Jason Gorman 2005. All rights reserved.


Use Case Diagrams
actor
use case
ATM

use case name


Withdraw cash

Card Holder

system
boundary
actor name

Bank System
“communicates”
© Jason Gorman 2005. All rights reserved.
Relationships Between Use Cases
Make tea

<<include>>

Boil water

[out of tea] <<extend>>

<<include>>

[out of coffee] <<extend>>


Go to shops

Make instant coffee

Walk to shops Drive to shops

© Jason Gorman 2005. All rights reserved.


Class Diagrams

© Jason Gorman 2005. All rights reserved.


Classes

Class name

Account
Balance : float = 0 Attributes compartment
Limit : float = 0
deposit(amount : float)
withdraw(amount : float)
getAvailableFunds() : float
Operations compartment

© Jason Gorman 2005. All rights reserved.


Attributes
Attribute name = “FirstName”
Attribute type = “string”

Attribute default value = “Mr”


Person
First Name : string
Last Name : string
Title : string = “Mr” Only attribute name is
Age mandatory
/ FullName = FirstName + “ “ + LastName

Attribute values can be derived (denoted by


/ before attribute name)

© Jason Gorman 2005. All rights reserved.


Empty
Operations
attributes
compartment Operation name = “Wed”
Argument name = “partner”
Argument type = “Person”

Person

wed(partner : Person)
calculateWealth() : float Return type = “float”
gossip(about : Person, to : Person)

Argument #1 name = “about”


Argument #2 name = “to”

© Jason Gorman 2005. All rights reserved.


Visibility
- = private

Account

- Balance : float = 0
# = protected # Limit : float = 0

+ deposit(amount : float)
+ withdraw(amount : float)
+ = public ~ getAvailableFunds() : float

~ = package

© Jason Gorman 2005. All rights reserved.


Scope

Class
(eg,
SeaLion SeaLion.getPopulation())
- population : int
- age : int

+ getPopulation() : int Instance


+ getAge() : int (eg, mySeaLion.getAge())
+ setAge(value : int)

© Jason Gorman 2005. All rights reserved.


Multiplicity
A Mormon can be married to
more than one person at the
ame time, but may not be
Mormon married at all.

Wife[0..*] : Mormon The lower bound of the


wed(partner: Mormon) multiplicity of Wife is therefore
calculateWealth() : float 0, and the upper bound is
gossip(about[*] : Person, to[*] : Person) many (*)

A Mormon can gossip to many


people at once about many
people

* Implies a lower bound of 0

© Jason Gorman 2005. All rights reserved.


Associations
Account
Customer
holders[1..2] : Customer
accounts[0..*] : Account

Is t Association End:
he
s am Role = “accounts”
ea Multiplicity = “0..*”
s…
Type = Collection of
Account

1..2
Customer
0..* holders
Account
accounts Association End:
Role = “holders”
Multiplicity = “1..2”
Type = Collection of
© Jason Gorman 2005. All rights reserved. Customer
Navigation
myCustomer.accounts

1..2
Customer
0..* holders
Account
accounts

myAccount.holders

© Jason Gorman 2005. All rights reserved.


Navigability
myCustomer.accounts

1..2
Customer
0..* holders
Account
accounts

myAccount.holders

© Jason Gorman 2005. All rights reserved.


Aggregation
Graphics Card

1..2

0..1

0..1
1..*
Personal Computer Hard drive

0..1

1
0..1
1..4
Motherboard CPU

© Jason Gorman 2005. All rights reserved.


Composition

1
0..*
Invoice Line Item

© Jason Gorman 2005. All rights reserved.


Generalization

Person
eat(food : Food)

Scuba Diver Painter


eat(food : Food) eat(food : Food)

© Jason Gorman 2005. All rights reserved.


Abstract Classes & Operations

Person
eat(food : Food)

Scuba Diver Painter


eat(food : Food) eat(food : Food)

© Jason Gorman 2005. All rights reserved.


Interfaces & Realization

Person
<<interface>>
Person
eat(food : Food)

Scuba Diver Scuba Diver


eat(food : Food) eat(food : Food)

© Jason Gorman 2005. All rights reserved.


Dependencies

<<interface>>
Person
eat(food : Food)

Food

Scuba Diver
eat(food : Food)

© Jason Gorman 2005. All rights reserved.


"I am currently working on a
team which is [in] the process
of adopting RUP and UML
standards and practices. After UML for Managers (1 Day)
one of our design sessions, I
needed to lookup some The key to success in IT and business projects is effective
information and came across comm unication. Building a shared understanding requires that all
your site. Absolutely great! project stakeholders speak the same language.
Most [of] the information I've
had questions about is A Picture Is Worth 1000 Lines of Code
contained within your tutorials
and then some." Visual Languages enable project stakeholders to express complex
and subtle ideas in a w ay that is much easier to digest than wordy
written specifications. Visual Languages make communication and
understanding quicker and easier, and the effective use of Vis ual
"Really great site... I have been Models can greatly improve a project’s chances of success.
trying to grasp UML since the
day I saw Visual Modeler. I Many Problems. One Visual Language.
knew a few things but there
The industry-standard Unified Modeling Language can be used to
were gaps. Thanks to your site
they have shrunk describe many aspects of your business and the systems w ithin it.
considerably." UML can be applied at all levels, from your corporate strategy right
dow n to the design of your databases. This makes it possible to unify
different views of your business and to share and reuse knowledge
more effectively. It also helps you to learn m ore about your
"I went on a UML training business and how it could be improved.
course three months ago, and
came out with a big folder full Are You Ready to Parlez UML?
of hand-outs and no real
understanding of UML and how UML for Managers introduces business decision makers and IT
to use it on my project. I spent strategists to the key aspects of Visual Modeling using UML. It
a day reading the UML for highlights areas where Visual Modeling could be applied to your
.NET tutorials and it was a business, and helps you to build a practical and realistic roadmap for
much easier way to learn. adopting UML across your enterprise.
'Here's the diagram. Now
here's the code.' Simple."
www.parlezuml.com/training.htm

advertisement

© Jason Gorman 2005. All rights reserved.


Object Diagrams & Filmstrips

© Jason Gorman 2005. All rights reserved.


Instances of Class Diagrams
1
0..*
Invoice Line Item
items

<<instanceOf>>

<<instanceOf>>
<<instanceOf>>
items
Item1 : Line Item

myInvoice : Invoice items


Item2 : Line Item

items
Item3 : Line Item
Object identity [optional] Object type [optional]
© Jason Gorman 2005. All rights reserved.
Object State

: Customer
holders
Name = “Jason Gorman”

: Account
Balance = 400.00
Limit = 250.00 accounts

© Jason Gorman 2005. All rights reserved.


Filmstrips
: Invoice

/ total = 2.97 Item1 : Line Item


items
quantity = 3
Dry Wipe Marker : Product

unit price = 0.99

Board Rubber : Product

unit price = 3.99

new line item(quantity = 1, product = Board Rubber)

: Invoice

/ total = 6.96
items Item1 : Line Item

quantity = 3
Dry Wipe Marker : Product

unit price = 0.99

items Item2 : Line Item


Board Rubber : Product
quantity = 1
unit price = 3.99

© Jason Gorman 2005. All rights reserved.


Sequence Diagrams

© Jason Gorman 2005. All rights reserved.


Objects Interact over Time
A class operation message
with parameter_value
a : TypeA b : TypeB
instance

message(parameter_value)

return_value

focus of control

timeline b returns control to


a (with optional
return
© Jason value)
Gorman 2005. All rights reserved.
Object Creation & Garbage
Collection
someClient payer : Account payee : Account

FundsTransferTx(payer, payee, amount)


tx : FundsTransferTx

execute()

withdraw(amount)

deposit(amount)

© Jason Gorman 2005. All rights reserved.


Conditional Messages
tx : FundsTransferTx payer : Account payee : Account

[amount <= payer.availableFunds] withdraw(amount)

deposit(amount)

© Jason Gorman 2005. All rights reserved.


Assignments
tx : FundsTransferTx payer : Account payee : Account

fundsAvailable := getAvailableFunds()

[amount <= fundsAvailable] withdraw(amount)

deposit(amount)

© Jason Gorman 2005. All rights reserved.


Iterations

: DataAccessObject : DataReader

notEof := Next()

{while notEof}

© Jason Gorman 2005. All rights reserved.


Recursion
: DAORegistry

load()

© Jason Gorman 2005. All rights reserved.


Using Class Operations

someObject HttpContext ctx : HttpContext

ctx := Current()

session := Session()

© Jason Gorman 2005. All rights reserved.


State Transition Diagrams

© Jason Gorman 2005. All rights reserved.


Discrete States & State Transitions
Account
•Balance > 0 => in credit
Balance : float = 0
•Balance = 0 => empty
deposit(amount : float)
withdraw(amount : float)
•Balance < 0 => overdrawn

transition object
event state
start state withdraw(amount)

withdraw(amount)
deposit(amount) [amount > Balance]
empty in credit overdrawn

withdraw(amount) deposit(amount)
[amount = Balance] [amount > 0 - Balance]

deposit(amount)
[amount = 0 - Balance]

end state

© Jason Gorman 2005. All rights reserved. transition guard


Transitions & Actions
withdraw(amount) / balance = balance - amount

withdraw(amount)
deposit(amount) [amount > Balance]
/ balance = amount / balance = balance - amount

Overdrawn
empty in credit entry/ send nasty letter
do/ charge daily interest

withdraw(amount) deposit(amount)
[amount = Balance] [amount > 0 - Balance]
/ balance = 0 / balance = balance + amount

deposit(amount)[amount = 0 - Balance] / balance = 0

event triggers action(s)


© Jason Gorman 2005. All rights reserved.
Sub states & History States
reactivate super state

Sub state
active

in credit overdrawn
freeze
frozen

H empty

history state

© Jason Gorman 2005. All rights reserved.


Packages & Model Management

© Jason Gorman 2005. All rights reserved.


Organising Model Elements into
Packages
banking

objects Use cases

Transfer funds

Account 1..* 1..2 Customer

Withdraw cash

Cash Account Settlement Account customer Check balance

Deposit funds

© Jason Gorman 2005. All rights reserved.


Package Dependencies

System

Web Collections

<<import>>

© Jason Gorman 2005. All rights reserved.


Packages & Path Names

System

Web Collections

<<import>> Hashtable

DateTime

System::Collections::Hashtable
System::DateTime

© Jason Gorman 2005. All rights reserved.


Model-View-Controller &
Robustness Analysis

© Jason Gorman 2005. All rights reserved.


Model-View-Controller
Display model data & accept user actions

View

notify call

Model Controller
update

Encapsulate problem domain data & logic Execute requested actions by manipulating model

© Jason Gorman 2005. All rights reserved.


UML Stereotypes & Robustness
Analysis
<<boundary>>
Login Page <<entity>>
User Account

<<control>>
Login Controller

Login Page
User Account

Login Controller

© Jason Gorman 2005. All rights reserved.


www.parlezuml.com

© Jason Gorman 2005. All rights reserved.

Potrebbero piacerti anche