UML Use Case Diagrams PDF
Document Details
Uploaded by AdoredSanAntonio
null
Tags
Summary
This presentation provides an introduction to UML use case diagrams. It explains what use case diagrams are, their components (actors and use cases), and how they are used in software design. It also gives specific examples.
Full Transcript
Modeling UML Use Case Diagrams and Capturing Use Case Scenarios Lecture 3 Objectives After completing this lesson, you will be able : to identify different actors and use cases from a given problem statement to associate use cases with different types of relationships to draw a use-c...
Modeling UML Use Case Diagrams and Capturing Use Case Scenarios Lecture 3 Objectives After completing this lesson, you will be able : to identify different actors and use cases from a given problem statement to associate use cases with different types of relationships to draw a use-case diagram 2 Introduction Use case diagram is a platform that can provide a common understanding for the end-users, developers and the domain experts. It is used to capture the basic functionality i.e. use cases, and the users of those available functionality, i.e. actors, from a given problem statement. In this lecture, we will learn how use cases and actors can be captured and how different use cases are related in a system. 3 Use case diagrams Use case diagrams belong to the category of behavioural diagram of UML diagrams. Use case diagrams aim to present a graphical overview of the functionality provided by the system. It consists of a set of actions (referred to as use cases) that the concerned system can perform, one or more actors, and dependencies among them. 4 Actor An actor can be defined as an object or set of objects, external to the system, which interacts with the system to get some meaningful work done. Actors could be human, devices, or even other systems. For example, consider the case where a customer withdraws cash from an ATM. Here, customer is a human actor. 12/08/2024 PRESENTATION TITLE 5 An automated teller machine (ATM) lets customers to withdraw cash anytime from anywhere without requiring involvement of any banking clerk or representative. Customer must insert his ATM card into he machine and authenticate himself by typing in his personal identification number (PIN). He cannot do any of the facilities if the PIN entered is wrong. Authenticated customers can also change their PIN. They can deposit cash to their account with the bank. Also they can transfer funds to any other account. The ATM also provides options to the user to pay electricity or phone bill. Everyday morning the stock of cash in the ATM machine is replenished by a representative from the bank. Also, if the machine stops working, then it is fixed 6 ACTOR Actors can be classified as below , [i] : Primary actor: They are principal users of the system, who fulfill their goal by availing some service from the system. For example, a customer uses an ATM to withdraw cash when he needs it. A customer is the primary actor here. In a use case diagram primary actors are usually drawn on the top left side of the diagram Supporting actor: They render some kind of service to the system. "Bank representatives", who replenishes the stock of cash, is such an example. It may be noted that replenishing stock of cash in an ATM is not the prime 7 Use Case A use case is simply a functionality provided by a system. Continuing with the example of the ATM, withdraw cash is a functionality that the ATM provides. Therefore, this is a use case. Other possible use cases includes, check balance, change PIN, and so on. Use cases include both successful and unsuccessful scenarios of user interactions with the system. For example, authentication of a customer by the ATM would fail if he enters wrong PIN. In such case, an error message is displayed on the screen of the ATM. 8 Subject Subject is simply [iii] the system under consideration. Use cases apply to a subject. For example, an ATM is a subject, having multiple use cases, and multiple actors interact with it. However, one should be careful of external systems interacting with the subject as actors. 12/08/2024 PRESENTATION TITLE 9 Graphical Representation An actor is represented by a stick figure and name of the actor is written below it. A use case is depicted by an ellipse and name of the use case is written inside it. The subject is shown by drawing a rectangle. Label for the system could be put inside it. Use cases are drawn inside the rectangle, and actors are drawn outside the rectangle, 10 12/08/2024 PRESENTATION TITLE 11 Association between Actors and Use Cases A use case is triggered by an actor. Actors and use cases are connected through binary associations indicating that the two communicates through message passing. An actor must be associated with at least one use case. Similarly, a given use case must be associated with at least one actor. Association among the actors are usually not shown. However, one can depict the class hierarchy among actors. 12 Use Case Relationships Three types of relationships exist among use cases: 1. Include relationship 2. Extend relationship 3. Use case generalization 13 Include Relationship Include relationships are used to show common behaviour that are shared by multiple use cases. This could be considered analogous to writing functions in a program in order to avoid repetition of writing the same code. Such a function would be called from different points within the program. 14 Include Relationship Example For example, consider an email application. A user can send a new mail, reply to an email he has received, or forward an email. However, in each of these three cases, the user must be logged in to perform those actions. Thus, we could have a login use case, which is included by compose mail, reply, and forward email use cases. 15 Example Notation Include relationship is showed by a dashed arrow with a «include» stereotype from the including use case to the included use case 16 Extend Relationship Use case extensions are used used to show any variation to an existing use case. They are used to the specify the changes required when any assumption made by the existing use case becomes false [iv, v].. 17 Extend Relationship Example Let's consider an online bookstore. The system allows an authenticated user to buy selected book(s). While the order is being placed, the system also allows to specify any special shipping instructions [vii], for example, call the customer before delivery. This Shipping Instructions step is optional, and not a part of the main Place Order use case. 18 Notation Extend relationship is showed by a dashed arrow with a «extend» stereotype from the extending use case to the extended use case 19 Generalization Relationship Generalization relationship are used to represent the inheritance between use cases. A derived use case specializes some functionality it has already inherited from the base use case.. 20 Generalization Relationship Example To illustrate this, consider a graphical application that allows users to draw polygons. We could have a use case draw polygon. Now, rectangle is a particular instance of polygon having four sides at right angles to each other. So, the use case draw rectangle inherits the properties of the use case draw polygon and overrides it's drawing method. This is an example of generalization relationship. Similarly, a generalization relationship exists between draw rectangle and draw square use cases 21 Notation Generalization relationship is showed by a solid arrow from the specialized (derived) use case to the more generalized (base) use case. 22 Identifying Actors Given a problem statement, the actors could be identified by asking the following questions : 1. Who gets most of the benefits from the system? (The answer would lead to the identification of the primary actor) 2. Who keeps the system working? (This will help to identify a list of potential users) 3. What other software / hardware does the system interact with? 4. Any interface (interaction) between the concerned system and any other system? 23 Identifying Use cases Once the primary and secondary actors have been identified, we have to find out their goals i.e. what are the functionality they can obtain from the system. Any use case name should start with a verb."like, "Check balance 24 Guidelines for drawing Use Case diagrams Following general guidelines could be kept in mind while :trying to draw a use case diagram 1. Determine the system boundary 2. Ensure that individual actors have well-defined purpose 3. Use cases identified should let some meaningful work done by the actors 4. Associate the actors and use cases -- there shouldn't be any actor or use case floating without any connection 5. Use include relationship to encapsulate common behaviour among use cases , if any 25 “ Business opportunities are like buses. There's always ” another one coming. Richard Branson 26 Bibliography 1.Object-Oriented Modeling and Design with UML, Michael Blaha, James Rumbaugh, Prentice-Hall of India, 2nd Edition 2.Object-Oriented Analysis and Design using UML, Mahesh P. Matha, Prentice-Hall of India, Webliography 3.Use Case Diagrams 4.Use case diagram -- Wikipedia 5.Unified Modeling Language, Superstructure, V2.1.2 6."Functional Requirements and Use Cases", Ruth Malan and Dana Bredemeyer, Bredemeyer Consulting 7."A Use Case Template: draft for discussion", Derek Coleman, Hewlett-Packard Software Initiative 8.X. J. Zheng, X. Liu, & S. Liu. (2010). Use Case and Non-functional Scenario Template-Based Approach to Id entify Aspects. Computer Engineering and Applications ICCEA 2010 Second International Conference on (V ol. 2, pp. 89-93) 9.Extend relationships 10.Requirements Trace-ability and Use Cases 11.UML Use Case Diagrams: Tips and FAQ Thank you