Identifying use cases in a poll webapp - uml

I'm trying to figure out which use cases should I put in my use case diagram. I'm developing a poll webapp: after login, an authenticated user can browse a list of polls, then may select one poll from the list and finally may answer a poll.
This is what I made.
I'm in doubt with the extend relationship, is that correct or I should separate all these use cases without the extend relationship?

Every use case should let the actor achieve some goal, so that, at the end of the use case, the actor can say: "I'm finished".
In my opinion, the best use case is "Answer poll". The actor's goal is to give his/her opinion.
"Browse questions" could also be a use case: the goal is satisfying the actor's curiosity: "See what questions there are." But this is arguable.
I don't see any added value for the actor in use case "Select question". It seems to me that this is just a required step towards answering the poll. I would eliminate this use case. Selecting a question is a step in the flow of steps of use case "Answer poll".
Now suppose we keep two use cases: "Browse questions" and "Answer poll". What relationship would these two use cases have, include or extend?
Personally, I would use an include relationship. It's more natural to say that answering a poll includes browsing the questions than to say that answering a poll is an extended way of browsing the questions. But an include will only be possible if the complete use case "Browse questions" can be inserted at a single point in use case "Answer poll" (typically at the start of "Answer poll"). This may not be the case in your situation. Maybe you want to let the actor return to "Browse questions" after having answered a poll, for example to execute some final steps specified in "Browse questions". In that case, an extend relationship can be used.
If you opt for an include relationship, then don't forget to draw an association between the actor and "Answer poll".
A minor remark to end with: extend and include should be written completely in lowercase.

No, that's just wrong. You are starting functional decomposition. You don't do that during a use case synthesis. There is just one use case here: Browse questions. This is the one bringing added value to the actor. The other ones are steps in a scenario described inside the use case.
As always I recommend to read Bittner/Spence about use cases.

Related

Extending a view items usecase

Suppose I have a use case with the name "View Items" that shows a list of items to the user. The user may optionally select a specific item to view its details and then back to the list again.
Should "View Item Details" extend "View Items" or they are stand-alone usecases?
Based on Extending definition here:
Extend is a directed relationship that specifies how and when the
behavior defined in usually supplementary (optional) extending use
case can be inserted into the behavior defined in the extended use
case.
For example (in that reference):
Registration use case is complete and meaningful on its own. It could
be extended with optional Get Help On Registration use case.
Meaning that, in Registration Use Case and in it's behavior, we may need to perform Get Help On Registration Use Case too.
It seems only a link, but it is not just a link to Get Help On Registration Use Case (we may need it to perform Registration).
For another example (from this question):
Suppose that we have Answer the Question Use Case and Research the Answer Use Case. To perform Answer the Question Use Case we may need to perform Research the Answer Use Case too. (And also this is not only a link)
For another example:
Suppose that we have Enroll in University and Perform Security Check Use Cases. To perform Enroll in University Use Case we may need to perform Perform Security Check Use Case too.
In Extend:
A behavior extends another if it is in addition to, but not necessarily part of the behavior.
Therefor: In your example to perform View Items Use Case we do not need to perform View Item Details Use Case too. In other word, in the steps of View Items scenario, we do not need to perform (or optionally) View Item Details scenario. They are stand-alone Use Cases.
I simply ask: does it add value? If yes, then just make it a stand alone use case. The use of <<extend>>/<<include>> usually indicates that someone is trying to do functional decomposition. I regard the introduction of these relations as bad move in UML which is likely sprung out of a technicians head than a business person. Added value can not really be sub-divided. Either it is, or is not.
"To add value, that is the question", and "There's something rotten in the state of UML".

Do I have this Use Case diagram correct?

With this Use Case diagram, I'm unsure if I'm currently doing it correctly or not. Checked online and each site is giving me a different answer. I just need a direction or someone to correct me.
This is interesting as I am currently going through the exact same discussion with a client...
I would say "no" simply because I am unsure of what this actually represents.
A use case must bring a benefit to a user, and I really don't this in this diagram. What does Actor0 actually trying to accomplish? I do not get this from the diagram.
Did you write down statements before trying to do this? I find that going to a whiteboard and writing down what your actor's goal and how you see this happening so that the actor achieves the goal is a good start to better understanding the use case and differentiate the system being built from external systems. One way to do this is through a set of user stories (or use case slices).
And answering Thomas Kilian's excellent questions will also help you in this task!
Also, you are doing something that I see too often from people starting with use cases (and sometimes with UML experience): use case decomposition as a set of actions - basically trying to model a set of activities by breaking it down. Doing that is typically the second step in your analysis (e.g., by using activity and sequence diagrams).
No. Only "Register" (what?) and "Add/View Details" (which?) can be regarded as use cases since they add value. Neither "Login" nor "Main Menu" are use cases. The first is a constraint and the second an implementation detail.

UML Use case: Waiting for another use case to finish

I'm trying to model a use case, basically it's how a round is played in a quiz-show. the actor in the use case is the quizmaster; he asks the questions to the participants.
There's a lot going on in this use case but my problem comes down to the point where the quizmaster has to wait for a player to buzz his button and give an answer to a question he has asked so it can be judged (Right or wrong).
There's a seperate use case the actor "Candidate" follows to answer the question the quizmaster has asked.
How do I model the fact that the quizmaster has to wait for another actor to do a use case before he can continue with his own use case? Or is it better to just seperate them all into smaller-sized use cases. My teacher advised against that though so I was looking for a second opinion here.
You can either do an include as user3934037 suggested, or you could make it separate usecases and work with the pre/postconditions
In that case you would have usecases
Ask Question
-> precondition: Candidates ready
-> postcondition: Question asked
Respond Question
-> precondition: Question asked
-> postcondition: Question responded
Judge Response
-> precondition: Question responed
-> postcondition: Response Judged
Instead of linking use cases in a sequence together you leave them independent of each other. Use Case "Judge Response" isn't waiting for a specific use case to finish, it is waiting until it preconditions are met, however that came to be.
In general I advise to keep order of execution out of use case analysis (and leave it in business process modelling)
UseCase declare usefull functionality of modeled system. There is not any way to define execution aspects as you described in your example.
If you need to define some of event processing or actions, use some of behavioral element (Activity, StateMachine or Interaction).
I agree with Geert on this, except I would more strongly advise his approach. Use cases aren't designed to explain any sort of flow, period. You can use preconditions and postconditions to infer an order of execution, but if you want to be crystal clear on the order of execution of a use case, take Vladimir's advice and map it out with an activity diagram.
I want to say this first.. there is no correct answer in UML. If you can explain your thought correctly with your uml diagram, that is the answer.
I think this can be solved with <<include>> relation. CaseA ---<<include>>-->CaseB means CaseA can be performed when CaseB is satisfied.
for example,
"withdraw money from the account" ----<<include>>----> "authenticate the user"
I guess it can also be used to describe the sequence of each use case. :)
UML explicitly does not cover this need by a recommendation (AFAIK). It seems to indicate that there's something odd in your current Use Case analysis. Maybe structuring your Use Case Diagrams using design scopes and goal levels into several levels of detail would eliminate the sequencing
This is how Alistair Cockburn suggests to balance the Use Case density in article "Use case goals versus design scopes"
See also:
uml-diagrams.org: How to Draw UML Use Case Diagram

How to document Generalization Use Cases

I have a Generalization in my use case diagram. How can I write the specification for each of them.
This should help you:
three use cases into one use case
My comment there was:
I would only add descriptions where they add value. So if you have a
general precondition for all three (login is a good example) then add
that to "manage accounts". Anything specific goes to the respective
"sub" use case. Similar to how you would deal with inheritance on code
level!
That way you'll avoid redundant documentation that you would need to keep in sync and which would be tiring to read.

UML Use Case diagram I created. Is my usage of include/extend correct?

I just want to determine if I am using extend and include correctly. If I am using either incorrectly somewhere here please indicate where, and if possible, why it is incorrect.
https://imageshack.com/scaled/large/163/nlnk.jpg
Cheers.
Rules for using <<include>> and <<extend>> are simple:
<<include>> defines a sub use-case which is always included in the general use-case: use-case -include--> sub use-case. Usually it's used to denote a distinct part of a use-case or a common part that can be reused by other use-cases.
<<extend>> defines an optional sub use-case that can be executed upon certain conditions (which should be defined at a lower level design, not in use-case diagram). Here the direction of the relation is opposite to the <<include>> relation: use-case <--extend- sub use-case.
Apply these rules to your diagram and figure out if it's correct.
It looks as though "secure login" is required to be performed prior to the other activities that you link with <<include>>. Include implies that the use case also runs the included use case every time which in this case is probably not what you intend (just one login per session). You can always create new stereotypes, such as <<precedes>> or <<requires>>. Using them consistently will allow you to convey your meaning.
I find this piece of advice before when I'm trying to distinguish the difference between using extend and intend in use case diagram.. I hope it helps you too. The original advice comes from this StackOverflow answer.
Difference between extend and include
Extend is used when a use case conditionally adds steps to another
first class use case. For example, imagine "Withdraw Cash" is a use
case of an ATM machine. "Assess Fee" would extend Withdraw Cash and
describe the conditional "extension point" that is instantiated when
the ATM user doesn't bank at the ATM's owning institution. Notice that
the basic "Withdraw Cash" use case stands on its own, without the
extension.
Include is used to extract use case fragments that are duplicated in
multiple use cases. The included use case cannot stand alone and the
original use case is not complete without the included one. This
should be used sparingly an only in cases where the duplication is
significant and exists by design (rather than by coincidence). For
example, the flow of events that occurs at the beginning of every ATM
use case (when the user puts in their ATM card, enters their PIN, and
is shown the main menu) would be a good candidate for an include.
Also, from every book I've read, it is always recommended to use include and extend sparingly. Keep It Simple Silly.
Many relationships are clearly not correct here. However, I think the main issue with this diagram is not the correct use of include and extend, but rather to complex and overall unclear relationships. Although sitactically valid, you should avoid using more than one level of these relationships.
Your diagram is really hard to follow and to interpret.
Some refactoring ideas and corrections:
show "Secure login" class separately, linked only with Actor and then apply the following precondition for all use cases that "include" it: "User is securelly logged in"
"Logout after 5 mins" should be own use case, only connected to Actor as well, with 2 preconditions: "User is securelly logged in" and "User was inactive for 5 mins"
Remove the include between "Logout after 5 mins" and "Initiate a call". Extend might be more appropriate
reverse the direcction of the include between "Transfer funds..." and "Insure adequate funds..." - it is clear that the first one includes the second one and not vice versa
consider breaking a diagram in 2 or more simple and small diagrams of only related UCs: all login/logout could for example be shown separate and simplify the view. You should not have more than 5-7 use cases on one diagram

Resources