Modelling use cases that are possible only after random event occurs or at specific date and time

StackOverflow https://stackoverflow.com/questions/19282379

  •  30-06-2022
  •  | 
  •  

質問

I am creating a use-case UML diagram for an android application.

Let's say it will trigger alarm when user shakes the phone. User has some options when alarm triggers, for example turn off the alarm. Alaram can also be triggered on date and time specified by the user. How would I add something like this to a use-case diagram? The only thing that pops in my mind is to add alarm use case which <<extends>> all other use cases, but it doesn't seem right.

役に立ちましたか?

解決

Think simple and practical ...

So First Question : Who is the Primary Actor?

Android Phone User is obviously Primary Actor.[ User ]

Then Ask : What can Primary Actor do with my application?

Forget the details and how you implement the system. Just simply ask the question above.

From given context it seems that Actor [ User ]

  • Can Trigger Alarms When Shake Phone
  • Can also Setup Alarms which will be triggered automatically when time is reached.
  • Can Stop any Alarm when triggered

So Possible Use Cases: Trigger Alarm, Set-up Alarm, Stop Alarmenter image description here

Then instead of just drawing diagrams lets write simple steps of Trigger Alarm Use Case Scenarious:

Use Case Name : Trigger Alarm

Primary Actor : Android Phone User

Trigger: Actor Shakes the Phone, or Alarm Trigger Time is passed-reached

Main Success Scenario:

A. User Shakes The Phone

  1. Our Android Application(OAA) detects the user shake
  2. OAA trigger the Alarm X
  3. .... 4 ....

B. An Alarm Trigger Time is passed-reached

  1. Our Android Application(OAA) check the current time and detects the triggers that time is passed-reached.
  2. OAA trigger the time passed-reached alarms. 3....

Now the question,

Stoping-Alarm is a real use case? Or just a step of a Trigger Alarm use case scenario?

You can discover it while writings use case for it on your context. For me stopping an alarm is seem to be just a step in Trigger Alarm scenario.So I can simplify my diagrams by just deleting Stop-Alarm and make it a step of Trigger Alarm use case as in Extension or Alternative Flows such as

Alternative Flows [ For Trigger Alarm ]

User Can Stop any Triggered Alarm.

But may be later I may think that to show alternative flow "stop alarm" on my diagram will give more complete picture about overall features of my applictaion, so i may use extends relationship to show it:

enter image description here

You may ask that, when the user shake the phone it is obvious that he-she is primary actor, but when the " An Alarm Trigger Time is passed-reached" system automaticaly trigger it , not the user. So may be an artifical Time actor exist.But Time can not be a primary actor, since Time does not have a goal to satisfy like user.

But when you think carefully, The User is the guy behind the alarms even automatic ones since he/she set up those alarms.So even for the automatically triggered alarms, the primary actor is actual User.

Maybe we think that we should make "Time" factor more clear on our diagram, suppose for the "purist UML" guys :-)

Can put Time as an "secondary actor" on our diagram.But I think this ONLY make your diagrams UGLY and open "philosophical" questions about Use Case Actors. :-)

enter image description here

Check Rational Nice Paper : Dear Dr. Use Case: Is the Clock an Actor?

Dear Dr. Use Case: Is the Clock an Actor?

Last But Not Least

Do not waste your time with UML Use Case Diagrams much. The important things are Use Case Scenarious.

他のヒント

Could you give us a first draft? Because for me this kind of question is too much detailed for an use case diagram. In this kind of diagram you have to focus on the main feature of your application and you should not have more than, let's say, 20 use cases.

Regards,

BR

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top