multimedia & website design use cases in uml. what’s up today? what you’ll learn in this...

21
Multimedia & Website Multimedia & Website Design Design Use Cases in Use Cases in UML UML

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Multimedia & Website DesignMultimedia & Website Design

Use Cases in UMLUse Cases in UML

What’s Up What’s Up Today?Today?

What you’ll learn in this lecture :-What you’ll learn in this lecture :-

Use Case diagrams and their applicationUse Case diagrams and their application– Why they existWhy they exist– What they areWhat they are– Their importanceTheir importance– Extending use casesExtending use cases– How to construct themHow to construct them

Working with the Working with the CustomerCustomer

Use case analysis takes place in partnership Use case analysis takes place in partnership with the customer for the systemwith the customer for the system

Intending to discover how the planned Intending to discover how the planned system should be used in practical termssystem should be used in practical terms

Should be an iterative process - first Should be an iterative process - first generate high level diagrams, then add generate high level diagrams, then add detail where neededdetail where needed

What are Use What are Use Cases?Cases?

Use Cases represent the users Use Cases represent the users and their interaction with the and their interaction with the systemsystem

A use case model partitions A use case model partitions functionality into ‘transactions’ functionality into ‘transactions’ that are meaningful to ‘actors’that are meaningful to ‘actors’

Applications, networks and Applications, networks and other systems are other systems are represented by boxesrepresented by boxes

actor

Use case

Park car

System

Why Use Cases?Why Use Cases?

Use Cases are built to be simple to Use Cases are built to be simple to understand. understand.

Non technical people can interpret them Non technical people can interpret them with easewith ease

They provide an overview of the system They provide an overview of the system diagrammaticallydiagrammatically

Diagram Diagram ElementsElements

Actor to initiate use caseActor to initiate use case

PreconditionsPreconditions

Steps in ScenarioSteps in Scenario

PostconditionsPostconditions

Actor benefiting from Actor benefiting from Use CaseUse CaseUse Case

System

Actor Actor

Use Case Use Case AnalysisAnalysis

Use Case Analysis is simply breaking down Use Case Analysis is simply breaking down the functionality of an application into a set the functionality of an application into a set of diagramsof diagrams

It is performed by identifying areas of It is performed by identifying areas of functionality and the users involvedfunctionality and the users involved

It’s designed to be fast and simple, and they It’s designed to be fast and simple, and they are easily translatable from your planningare easily translatable from your planning

Use Case Use Case RelationshipsRelationships

Use Cases have relationships between Use Cases have relationships between themselves and actorsthemselves and actors

Very similar to Class DiagramsVery similar to Class Diagrams– InclusionInclusion– ExtensionExtension– GeneralisationGeneralisation– GroupingGrouping

InclusionInclusion

Use Cases can often be used Use Cases can often be used more than once, in which more than once, in which case they are ‘included’case they are ‘included’

eg, a car salesman and valet eg, a car salesman and valet both need to open the car both need to open the car doordoor

It is the same principle as It is the same principle as reusable operations in reusable operations in ClassesClasses

Show Car

Car Sale

Open Door

Clean Car

Open Door

<< include >>

Salesman Customer

<< include >>

Valet

ExtensionExtension

Extensions are similar to inclusion, Extensions are similar to inclusion, but instead of just reusing the but instead of just reusing the code, they extend itcode, they extend it

E.g. if you make a sale on a E.g. if you make a sale on a website, you’ll register it in your website, you’ll register it in your own systems, own systems, andand process a process a credit card if requiredcredit card if required

Extension can only take part at Extension can only take part at specific points called Extension specific points called Extension Points. The extension would Points. The extension would occur after the normal Use Caseoccur after the normal Use Case

Register Sale

Extension point(Process credit card)

Register Salewith Credit Card

<< extends >>Process credit card

GeneralisationGeneralisation

In the same way that classes inherit In the same way that classes inherit from each other, so can Use Casesfrom each other, so can Use Cases

For example, ‘Display Cars’ might be For example, ‘Display Cars’ might be extended to ‘Display Cars on Sale’.extended to ‘Display Cars on Sale’.

Generalization in Use Cases are Generalization in Use Cases are notated the same way that Class notated the same way that Class Generalization isGeneralization is

Generalization can also occur Generalization can also occur between Actorsbetween Actors

Display Cars

Display CarsOn Sale

GroupingGrouping

Grouping is the collection Grouping is the collection of Use Cases into of Use Cases into similar categories, the similar categories, the same way as same way as ClassesClasses

A box represents the A box represents the groupgroup

Group / System / Application

Worked ExampleWorked Example

Vending MachineVending Machine

Look at the use case Look at the use case scenarios for a chocolate scenarios for a chocolate vending machinevending machine

Work out who the actors areWork out who the actors are

Understand the activities that Understand the activities that need to take placeneed to take place

““Buy a product” Buy a product” use caseuse case

Who is the Actor?Who is the Actor?

What steps do they What steps do they take?take?

Buy a product

Self service machine

Customer Customer

““Restock” use Restock” use casecase

Who is the Actor?Who is the Actor?

What steps do they What steps do they take?take?

Restock

Self service machine

Supplier Supplier

““Collect Money” Collect Money” use caseuse case

Who is the Actor?Who is the Actor?

What steps do they What steps do they take?take?

CollectMoney

Self service machine

Collector Collector

More Detail - More Detail - InclusionInclusion

Supplier and collector Supplier and collector must both open and must both open and close the machine to close the machine to accomplish their accomplish their taskstasks

Opportunity for Opportunity for inclusioninclusion

Restock

OpenMachine

CloseMachine

<<include>>

<<include>>

CollectMoney

OpenMachine

CloseMachine

<<include>>

<<include>>

Restock Restock ExtensionExtension

Extend Extend RestockRestock

Fill according Fill according to salesto sales

OpenMachine

CloseMachine

<<include>>

<<include>>

Restock

Extension Pointfill the compartments

Restockaccording to sales

<<extend>>{Fill the compartments}

GeneralisationGeneralisation

In many cases, the In many cases, the collector and the collector and the restocker are the restocker are the same personsame person

Restocker Collector

Supplier’s Agent

Full DiagramFull Diagram

Customer

Supplier’s Agent

OpenMachine

CloseMachine

<<include>>

<<include>>

RestockExtension Point

fill the compartments

Restockaccording

to sales

<<extend>>{Fill the compartments}

CollectMoney

OpenMachine

CloseMachine

<<include>>

<<include>>

Buy aProduct

Self Service Machine