Presentation is loading. Please wait.

Presentation is loading. Please wait.

Project Support: Actors and Use cases

Similar presentations


Presentation on theme: "Project Support: Actors and Use cases"— Presentation transcript:

1 Project Support: Actors and Use cases
Telematics systems and their design Doc.Ing. Ondřej Přibyl, Ph.D. Department of applied mathematics Faculty of Transportation sciences, CTU

2 Project Task 3 Task #: Actors
1) Define graphically all actors in the system and relations among them Task #: Use case analysis 1) For the defined subsystems create structured UC. 2) Demonstrate traceability among requirements and UC

3 Actors

4 What is an actor? Definition
An actor in the UML "specifies a role played by a user or any other system that interacts with the subject." An actor is a person, organization, or external system that plays a role in one or more interactions with your system. Actors are drawn as stick figures

5 Why to talk about Actors?
Actor is everybody who interacts with the system i.e. he is using some of the functions (use cases)

6 Example: actors and use cases

7 Relationships among actors
UML 2 does not permit associations between Actors Yet, this constraint is often violated in practice since the generalization/specialization relationship between actors is useful in modeling overlapping behaviours between actors

8 Relationships among actors (2)
There are several types of relationships: An association between an actor and a use case An association between two use cases A generalization between two actors A generalization between two use cases

9 Additional text (source: UML by example by Ghinwa Jalloul )

10 Additional text (source: UML by example by Ghinwa Jalloul )

11 Example of actors Generalization

12 Alternative view (Example)

13 Actor description!! (Example)

14 Additional text (source: UML by example by Ghinwa Jalloul )

15 Writing effective use cases (Example ebay) - Actors
Define your use case actors There are possibly over a dozen actors that interact with Ebay, from buyers and sellers, down to suppliers, wholesalers, auditors, and customer service. But we're going for grass-roots, so who are the basic users of Ebay? BUYERS and SELLERS. So lets put them down as our first actors. Do you notice how the actors aren't John and Sue which would be people? While John may be a seller and Sue may be a buyer, an actor is a Role. And a role in this case would be that of a buyer and that of a seller. Now that things are clicking, lets throw some more actors on your paper just so we can try and identify more possible users. Now we have a bunch of actors. Wait a minute? Paypal? That's not a person. An actor can be a system, because a system plays another role in the context of your new system and has goals and interacts with other actors as you will see later.

16 Identifying Actors Look for: the users who directly use the system
also others who need services from the system To find actors that are people/roles ask: Who will be a primary user of the system? (primary actor) Who will need support from the system to do her daily tasks? Who will maintain, administrate, keep the system working? (secondary actor) Who or what has an interest in the results that the system produces ? To find actors that are external systems ask: Which hardware devices does the system need? With which other systems does the system need to interact with?

17 Sources Actor in Wikipedia Use case in Wikipedia
Use Case document in our course web-sites

18 Use Cases

19 Major types in Use Case diagrams
Use cases. A use case describes a sequence of actions that provide something of measurable value to an actor and is drawn as a horizontal ellipse. Actors. An actor is a person, organization, or external system that plays a role in one or more interactions with your system. Actors are drawn as stick figures. Associations.  Associations between actors and use cases are indicated in use case diagrams by solid lines. An association exists whenever an actor is involved with an interaction described by a use case.  Associations are modeled as lines connecting use cases and actors to one another, with an optional arrowhead on one end of the line. The arrowhead is often used to indicating the direction of the initial invocation of the relationship or to indicate the primary actor within the use case.  The arrowheads are typically confused with data flow and as a result I avoid their use. System boundary boxes (optional). You can draw a rectangle around the use cases, called the system boundary box, to indicates the scope of your system.  Anything within the box represents functionality that is in scope and anything outside the box is not.  System boundary boxes are rarely used, although on occasion I have used them to identify which use cases will be delivered in each major release of a system.  Figure 2 shows how this could be done. Packages (optional).  Packages are UML constructs that enable you to organize model elements (such as use cases) into groups. Packages are depicted as file folders and can be used on any of the UML diagrams, including both use case diagrams and class diagrams. I use packages only when my diagrams become unwieldy, which generally implies they cannot be printed on a single page, to organize a large diagram into smaller ones.  Figure 3 depicts how Figure 1 could be reorganized with packages.

20 Recommended process: actors and use cases
Place Your Primary Actor(S) In The Top-Left Corner Of The Diagram Draw Actors To The Outside Of A Use Case Diagram Name Actors With Singular, Business-Relevant Nouns Associate Each Actor With One Or More Use Cases Actors Model Roles, Not Positions Actors Don’t Interact With One Another Introduce an Actor Called “Time” to Initiate Scheduled Events

21 Finding Use Cases For each actor, ask the following questions:
Which functions does the actor require from the system? What does the actor need to do ? Does the actor need to read, create, destroy, modify, or store some kinds of information in the system ? Does the actor have to be notified about events in the system? Does the actor need to notify the system about something? What do those events require in terms of system functionality? Could the actor’s daily work be simplified or made more efficient through new functions provided by the system?

22 Introduction A use case describes a actions that provide a measurable value to an actor. Use Case Names Begin With a Strong Verb Name Use Cases Using Domain Terminology Place Your Primary Use Cases In The Top-Left Corner Of The Diagram Imply Timing Considerations By Stacking Use Cases.  As you see in Figure 1, the use cases that typically occur first are shown above those that appear later.

23 Example

24 Generalization Shows inheritance and specialization
One use case is simply a special kind of another

25 Includes “Factor out” of a use case commonly used behavior
Allows reuse of functionality by multiple use cases

26 Extends Indicates that one use case adds or replaces behavior of another Must have a an associated extension point May have a condition

27 How to prepare right Use cases? Example
Chapter 1 - The Context of Systems Analysis And Design Methods

28 How to prepare right Use cases? Example
How is a UML Use Case Diagram different from a traditional flow chart? As mentioned above, UCDs represent functionality in a top-down way, whereas flow charts represent behavior in a linear, time-based way. Also, the way you develop them is all-together different. Example: (This text refers to the diagrams below.) When constructing a UCD, the initial step is to identify all of the top-level behavior. Once you have done this (not a very tricky process) you have already described, at least in a high-level way, all of the things your system knows how to do. You can then continue to add detail by decomposing your use cases into more use cases which are used by the top-level use cases. At every stage of development, though, your UCD is a complete description of the system's functionalty: it may lack detail, but it will not lack feature set elements. And if functionality or behavior is added or deleted over the life of your project, the scope of the change you need to make is proportional to both the scope of the change in the system itself, and the maturity of your model. This is useful because it means that when your model is very young (only high-level diagrams drawn) making sweeping changes to the system does not involve throwing very much work away. A flow chart, however, does not correctly describe the system until you have finished drawing it, and even then small changes in the system will result in significant reworking of your flow charts. In general, UCDs support the process of analysis and design much better than flow charts. How is a UML Use Case Diagram different from a traditional flow chart? As mentioned above, UCDs represent functionality in a top-down way, whereas flow charts represent behavior in a linear, time-based way. Also, the way you develop them is all-together different. Example: (This text refers to the diagrams below.) When constructing a UCD, the initial step is to identify all of the top-level behavior. Once you have done this (not a very tricky process) you have already described, at least in a high-level way, all of the things your system knows how to do. You can then continue to add detail by decomposing your use cases into more use cases which are used by the top-level use cases. At every stage of development, though, your UCD is a complete description of the system's functionalty: it may lack detail, but it will not lack feature set elements. And if functionality or behavior is added or deleted over the life of your project, the scope of the change you need to make is proportional to both the scope of the change in the system itself, and the maturity of your model. This is useful because it means that when your model is very young (only high-level diagrams drawn) making sweeping changes to the system does not involve throwing very much work away. A flow chart, however, does not correctly describe the system until you have finished drawing it, and even then small changes in the system will result in significant reworking of your flow charts. In general, UCDs support the process of analysis and design much better than flow charts. Chapter 1 - The Context of Systems Analysis And Design Methods

29 Example

30 Example

31 How to prepare right Use cases? Example
How do you know what to put in the "System" box? The system box only appears on the top-level diagram (remember that a typical UML Use Case description will be composed of many diagrams and sub-diagrams), and should contain use case ovals, one for each top-level service that your system provides to its actors. Any kind of internal behavior that your system may have that is only used by other parts of the system should not appear in the system box. One useful way to think of these top-level services is as follows: if a use case represents a top-level service, then it should make sense for the actors who interact with it to request only that service of your system in a single session (in whatever sense a "session" is intelligible in your system.) Example: In the diagram below we would like to represent the use cases for a camera. Suppose we choose "Open Shutter", "Flash", and "Close Shutter" as the top-level use cases. Certainly these are all behaviors that a camera has, but no photographer would ever pick up their camera, open the shutter, and then put it down, satisfied with their photographic session for the day. The crucial thing to realize is that these behaviors are not done in isolation, but are rather a part of a more high-level use case, "Take Picture". (Note that it does make sense for a photographer to "Take Picture" just once during a session with their camera.) Chapter 1 - The Context of Systems Analysis And Design Methods

32 How to prepare right Use cases? Example
The actors in my diagram have interactions. How do I represent them? If there are interactions between the actors in your system, you cannot represent those interactions on the same diagram as your system. What you can do instead is draw a separate UCD, treating one of the actors itself as a system, and your original system (along with the other actors) as actors on this new diagram. Example: Suppose you wanted to diagram the interactions between a user, a web browser, and the server it contacts. Since you can only have one system on the diagram, you must choose one of the obvious "systems", such as the server. You might then be tempted to draw interaction lines between the actors, but this is a problem because it isn't clear what the interaction means, so it isn't helpful to show it here. A more useful solution would be to draw two diagrams, showing all of the interactions, as below. Chapter 1 - The Context of Systems Analysis And Design Methods

33 How to prepare right Use cases? Example
When do I use the uses arrow? The uses arrow (or uses edge as it would be called in traditional graph thoery) is drawn from a use case X to another use case Y to indicate that the process of doing X always involves doing Y at least once (although it may involve doing it many times, "at least once" is the only relationship guaranteed by this symbol.) This symbol can be referred to as an aggregation operator, because it indicates that a given use case is an aggregate (made up of parts) whose components are the use cases that it uses. If a certain use case uses several others, that means that all of the component use cases must be completed in the process of completing the aggregate use case, although there is no specification in UCDs of the order in which these are completed. A brief, mnemonic way to think about the uses arrow is that it it can be read X uses Y means that "X has a Y" as part of it's behavior. Example: Suppose you wanted to add detail to the diagram shown below, representing an airline reservation system. First, you would create a separate diagram for the top-level services, and then you would add new use cases that make up the top-level ones. There is a uses edge from "Check in Passenger" to "Weigh Luggage" and from "Check in Passenger" to "Assign Seat"; this indicates that in order to Check in a Passenger, Luggage must be Weighed and a Seat must be Assigned. Similarly, the diagram indicates that in order to add a reservation to the system, the available space must be checked and the passenger's information must be recorded. You could imagine breaking these use cases down further to show more detail. Chapter 1 - The Context of Systems Analysis And Design Methods

34 How to prepare right Use cases? Example
When do I use the extends arrow? The extends arrow (or extends edge) is drawn from a use case X to a use case Y to indicate that the process X is a special case behavior of the same type as the more general process Y. You would use this in situations where your system has a number of use cases (processes) that all have some subtasks in common, but each one has something different about it that makes it impossible for you to just lump them all together into the same use case. Example: Suppose you wanted to add detail to the diagram shown below, representing an airline reservation system. Specifically, what you would like to show is that not all of the seats aboard the airplane are exactly alike (some window and some aisle seats), and sometimes passengers will express a preference for one of these types of seats but not the other. But of course, they cannot just be given their preference right away, because the seat they want might not be available. Therefore, the process of assigning a window seat involves checking for the availability of window seats, whereas the process of assigning an aisle seat involves checking for the availability of aisle seats. But even though these processes are different, they are quite similar in a number of other ways, so it doesn't make sense to ignore their similarities. Fortunately, UML lets us have both: we write that assigning these two types of seats are different processes, but they are similar in that both processes extend a common, more general process (assigning seats.) Chapter 1 - The Context of Systems Analysis And Design Methods

35 How to prepare right Use cases? Example
What is the difference between uses and extends? Probably the best way to think about these diagram elements is as follows: - "X uses Y" indicates that the task "X" has a subtask "Y"; that is, in the process of completing task "X", task "Y" will be completed at least once. - "X extends Y" indecates that "X" is a task fo the same type as "Y", but "X" is a special, more specific case of doing "Y". That is, doing X is a lot like doing Y, but X has a few extra processes to it that go above and beyond the things that must be done in order to complete Y. Example:indicates that inorder to successfully "Check-in", you must "Weigh luggage" and "Assign a seat", some number of times, in some order. The key, though, is that all UCs used by a use case MUST BE DONE before that use case be considered to be complete. Once you realize that there are several types of seat assignment, you might be tempted to draw a diagram using the uses edge like the one below, but this doesn't make sense: This diagram says that in order to assign a seat you must assign both a window seat AND an aisle seat to the passenger. Never fear, however; this situation is correctly handled by the extends relationship. Using the extends relationship (as shown in the following diagram), we can express that there are two ways to assign a seat: assigning a window seat and assigning an aisle seat, but only one need be completed in the process of assigning the passenger a seat. Chapter 1 - The Context of Systems Analysis And Design Methods

36 You are "done" when: You have named all the primary actors and all the user goals with respect to the system. You can captured every trigger condition to the system either as a use case trigger or an extension condition. You have written all the user-goal use cases, along with the summary and subfunction use cases needed to support them. Each use case is clearly enough written that the sponsors agree they will be able to tell whether or not it is actually delivered. the users agree that is what they want or can accept as the system’s behavior. the developers agree they can actually develop that functionality. The sponsors agree that the use case set covers all they want (for now). . . .

37 Sources


Download ppt "Project Support: Actors and Use cases"

Similar presentations


Ads by Google