Use Case Diagrams Use Case n Use case

  • Slides: 29
Download presentation
Use Case Diagrams

Use Case Diagrams

Use Case n Use case n n n A view to system seen from

Use Case n Use case n n n A view to system seen from outside(user) User’s requirements on system A set of scenario for an actor to achieve useful works Withdraw Transfer Balance check Bank client deposit Bank system

Basic Concepts n Actor n n User Case n n n Each describes a

Basic Concepts n Actor n n User Case n n n Each describes a possible interaction between an actor and the system Use cases are actions that a user takes on a system System n n n An external person, process or thing interacting with a system or class The entity that we are going to build Can have subsystems in it Relationship n Connection between actors and use cases or use cases and use cases.

Actors n A user of the system n n a person or another system

Actors n A user of the system n n a person or another system Identify the actors in terms of their roles

Use Case n actions users take on system n can be very high level

Use Case n actions users take on system n can be very high level or so fine-grained n Use “verb” or “verb+noun” style naming borrow return

System n module that performs the function n System or the sybsystem is shown

System n module that performs the function n System or the sybsystem is shown as a rectangle enclosing the use cases, with the system name in the rectangle Library System

Relationship (Use Case Diagram) n There are four kinds of relationships n n Association

Relationship (Use Case Diagram) n There are four kinds of relationships n n Association Extend Include generalization

Association Relationship n Shown by a line connecting actors to use cases

Association Relationship n Shown by a line connecting actors to use cases

Include Relationship Between a use case and another use case n use case A

Include Relationship Between a use case and another use case n use case A includes the function of use case B (has-a relationship) n A <<include>> B

Extend Relationship Use can be extended by another use case n At the extension

Extend Relationship Use can be extended by another use case n At the extension point, use case is extended n Extension point n n n Shows the exact extension point between the two use cases Shows the actual logic necessary for one use case to extend another

Example : Extend Relationship

Example : Extend Relationship

Generalization Relationship Indicate an inheritance of an item in UML n Can be applied

Generalization Relationship Indicate an inheritance of an item in UML n Can be applied to actors as well as use cases n

Example

Example

Activity Diagram

Activity Diagram

What is Activity Diagram • Shows overall flow of control (just like flowchart) •

What is Activity Diagram • Shows overall flow of control (just like flowchart) • A simplified look at what happens during a process • Business and operational step-by-step workflows of components in a system

Activity Diagram Notations

Activity Diagram Notations

Decision Wake Up Activity 1 Activity 2 [hungry] Eat Breakfast Wake Up [Not hungry]

Decision Wake Up Activity 1 Activity 2 [hungry] Eat Breakfast Wake Up [Not hungry] Go Back to Sleep [hungry] Eat Breakfast Transition from one activity to another [Not hungry] Go Back to Sleep Two ways of showing a decision

Concurrent Path , Signal Synchronization bar Television Remote. keyln(channel) Work Out Shower Show New

Concurrent Path , Signal Synchronization bar Television Remote. keyln(channel) Work Out Shower Show New Channel Relax Change(channel) Press Channel Number Change (channel) Watch Concurrent Path Signal : when received, the signal causes an activity to take place (send : convex , receive : concave )

Swimlanes • show who has responsibility for each activity. (role) 1. A salesperson calls

Swimlanes • show who has responsibility for each activity. (role) 1. A salesperson calls the client and sets up an appointment 2. Onsite appointment(In the consulting firm’s office) - corporate technicians prepare a conference room for a presentation 3. Offsite appointment(at the client’s office) - a consultant prepares a presentation on a laptop 4. The consultant and the salesperson meet with the client at the agreed-upon location and time 5. the salesperson follows up with a letter 6. If the meeting has resulted in a statement of a problem, the benefit – the activities of each role are clarified 9

Activity Diagram Example Call client and set up appointment [appointment onsite] [appointment offsite] Prepare

Activity Diagram Example Call client and set up appointment [appointment onsite] [appointment offsite] Prepare a conference room Prepare a laptop Meet with the client Send followup letter See the Activity Diagram for Creating a Document [no statement problem] [statement of problem] Create proposal Send proposal to client 10

Swimlane : shows “who” for each activity Sales Person Consultant Corporate Technician Call client

Swimlane : shows “who” for each activity Sales Person Consultant Corporate Technician Call client and set up appointment [appointment onsite] [appointment offsite] Prepare a laptop Prepare a conference room Meet with the client Send followup letter [statement of problem] Create proposal [no statement problem] Send proposal to client See the Activity Diagram for Creating a Document

Example

Example

Sequence Diagram

Sequence Diagram

Purpose of Sequence Diagram n shows the sequence of messages for a particular task

Purpose of Sequence Diagram n shows the sequence of messages for a particular task from a use case diagram n Understand how use case(scenario) can be refined with detailed information

Sequence Diagram n Time, object, and message n Lifeline and activation Notation : Name

Sequence Diagram n Time, object, and message n Lifeline and activation Notation : Name

Basics n Focus on order in which messages occur time objects : Name 1

Basics n Focus on order in which messages occur time objects : Name 1 object message activation lifeline : Name 2

Messages n The first message starts at the top, typically located on the left

Messages n The first message starts at the top, typically located on the left side n Subsequent messages are then added to the diagram slightly lower then the previous message : synchronous call operation : method on the arrow : asynchronous signal : return message (optional) : return value on the arrow n Messages can be sent to itself

Sequence diagram example Object Time constraint Message Activation Comment

Sequence diagram example Object Time constraint Message Activation Comment

Example n Sequence for “withdraw-money” use case

Example n Sequence for “withdraw-money” use case