I am creating a small Multiplayer game. It can only be played when there are two players present (not more than that).
In a typical single player game, there should be an Actor called "Player". But in this case there are two players. So is it possible to declare "Player1" and "Player2" as actors?
note: In some of the tasks, either one of them will participate. How can I represent that? (just like entering the high-score [only one of them can be the winner. Both of them cannot be the winner at the same time] ).
Is this correct ?? -
I'd just use a single actor called Player and add a constraint that there need to be exactly 2 player instances. The use cases where the number of players is irrelevant you don't have that constraint.
Play again is no use case. It's probably a simple action in the Play game UC where the question pops up.
P.S. You should read Bittner/Spence to get the idea about UC synthesis.
P.P.S.: As already mentioned in the comments, an actor is not a person, but the way some (usually) person acts. If you have a two player game and both players are equal, you have just one actor (the way they act is the same). If you have a game with two different players like one challenger and one opponent, you would use two different actors. Namely Challenger and Opponent. They both might act similarly when it comes to watching statistics or the like. Now you have a third role Player from which the actors above can inherit:
An UseCase diagram must list the possible kind of usage of your system (the Multiplyer game), the possible kind of actor and their relationship (which usecase is accessible by which kind of actor). So in the case of your game does two players are two different kind of actor (which means that they will not have the same kind of interaction with the game) or are they the same kind of actor (with the same kind of intarction with the game)?
Related
I'm practicing drawing a use case diagram for a very simple case, a color-guessing game.
I don't have a picture but it is really simple, with two bubbles for the Player actor to interact with, Play Game and Reset Game.
I would like to add a condition "initialize game" for both use cases, in Play Game it is a precondition and in Reset Game it is a post condition.
It cannot be another use case because the actor would be then System or Game and that's not feasible. Only Player benefits from performing the two current use cases.
How should I include that condition in the use case diagram? Or should I?
No.
Use cases are about added value. A single use case shows a single added value brought to its primary actor by the system under consideration. Nothing else! Use cases are a very high business view on the system under consideration.
The conditions you are talking about are part of scenarios you design to implement reaching that added value. And it's hidden in activities inside the use cases.
Other conditions like "user must be logged in" are constraints and attached to use cases somehow. No need to show these on a diagram (though you may if needed).
I wondered if anyone could let me know whether this diagram is approximately correct?
I am depicting a database booking system and am very confused about the relationships between some of these use cases. I am fairly sure that I should include them on the same diagram but unsure whether some of my actors (Vet / Nurse) should be on the right hand side because they are kind of end-users whilst also being first users (sorry can't recall the term).
So when you modeling a Use case diagram, you have to realize that you can only approach for describe the functional requirements of the system.
Your system is treated as a blackbox-that is, dealing with what the system does in response to the actor's inputs, not the internals of how it does it. And use case always starts with an input from an actor.
Before modeling a diagram, you have to identify actors(Primary, Secondary), use cases & use case relationships. Actors are who or what initiates events involved in the task of the use case. Actors are simply roles that people pre objects play.
According to your problem,
A dog owner calls the clinic to make an appointment for a yearly
checkup. The nurse finds the nearest empty time slot in
appointment book and schedules the appointment for that time slot.
in here you can see that two people, dog owner and nurse involving the scenario, but the actual actor who interacts with the system is the nurse.
And the use case is a summary of scenarios for a single task or goal. So, you can see that Nurse is Making the appointment for the dog owner.
So to finally, you have to identify what are the relationships. simply relationships are representing communication between actor and use case or dependencies between use cases.
Dependencies between use cases can be defined by using include & extend relationships.
Include is using for determine to identify common sequences of interactions in several use cases. (Can be extracted and reused)
& extend is using for model alternative paths that a use case might have.And you have to keep in mind that base use case doesn't depend on the extension use case
If a player could be assigned to a team then the use case would be Assign Player but if a player could also be reassigned then would another use case, Reassign Player, be created, which could include Assign Player?
Or would the single use case of Assign Player be enough and just state the assumption that Assign Player would handle the event of that player being currently assigned?
This depends, as always.
However, this might well be worth a use of an <<includes>> relation. Re-assigning a player might eventually be more complex and in the end you'll just Assign player as usual. Eventually. But as well the re-assignment might be a completely different thing in which case you have two different and independent use cases. Or it's a "don't care of the previous assignment" in which case you have just one single UC Assign player.
Edit As per Patrick87's comment I add the following: A UC represents a single added value a system under consideration delivers to one of its actors. Now, an added value is something unique. Finding that is hard, which is why it need business analysts that know their job. I for myself try seeing a UC as something like a unique selling proposition. It's not obvious in most cases. But once you placed the right bubble it feels right. Don't start decomposing it into single "functions". That's a different story and it can only start after all UCs are settled. Only then you start construction scenarios inside each UC to describe the how-to.
And my general recommendation: read Bittner/Spence who really get to the point.
I do not know what your teams are playing. It could be a game like chess, or a kind of sports like soccer.
So your use case would be something that tells us about the overall goal of your system under construction:
Is it "play soccer game" or "play chess"?
You can decompose that into more fine grained scenarios, as long as you still describe actual goals of your system.
For actual functional decomposition, you should use other diagramtypes, namely activity diagrams, state diagrams and possibly sequence diagrams.
I have a equipment which I am representing with a class and there are two actors a remote and local operator who can put the equipment on or off. Both actors will use the functionality of the equipment. But How do I now represent them using sequence diagram, since if I draw an event from both local and remote its going to show at the equipment the one happened after the other but in reality two actors are using the same function and can invoke it any time. So how do I represent the two actors in the below sequence diagram.
P.S. The RAN40L is the equipment and CMS is remote operator and Simulator Operator is the local operator.
As it happens I have extensive experience from the defence industry, including naval CMS, so I am familiar with the domain.
The crucial question is, as always with UML, what you want to show in the diagram, which of course ties in with what you are showing in other diagrams. No diagram is ever read in isolation and you will never capture the entire radar functionality in a single sequence diagram.
Remember that a sequence diagram is intended to show things happening in a strict sequence. It is possible to show some rudimentary concurrency using the appropriate fragment, but if you want to show that the two actors do exactly the same thing, that the sequence is in fact one and the same in both cases, then the sequence diagram is the wrong place to show that.
Assuming that this sequence is intended as an elaboration of a use case, then the solution is to replace the two actors with a single actor, eg "Radar Controller". This actor can then be specialized into CMS and Simulator, which makes sense if the radar is unaware of, or unconcerned with, who is interacting with it in some (use) cases but not in others.
If the radar never makes the distinction, there shouldn't be two actors at all. The actors must make sense to the system they're interacting with, otherwise there's something wrong with your actor model.
So one solution is to structure the use cases as below.
http://sdedit.sourceforge.net/images/webserver.png
This is a good example where two actors are used. It is default to put one actor to the opposite the other (this is not done in the example).
Actor is considered to be just another object in the sequence diagram. You can plase arbitrarily many actors and use them just like any other object, no restrictions in this sense.
There are some stylistic guidelines though, most of all regarding Actors positioning on the diagram. It is a common practice to show the actores on the border of the diagram, keeping internal system objects inside. Moreover, human actors are typically shown on the left side, while system actors are kept on the right. Actors should not be "mixed" with system objects. Here is a simple example:
Everything in behavioral diagram is executed after behavior defined by diagram started.
If actors interacts individually, and their interaction are not moxed in single execution, you must draw diagram for each case.
I would say you need two diagrams, each for one actor.
I have made this use case diagram of a game called Tictactoe.
Please correct it if it is wrong.
Here is an image of the use case diagram:
the difference between players is too small to differ players 1 and 2. There is only one actor - player
Player does not check who won. This is NOT outer behaviour of the system and that means, it is not a use case.
So, the start use case diagram could be shown as:
But as we have only one actor, we don't need to show actors at all. And we can group the use cases into subsystems/packages. Maybe you haven't seen such UC diagrams, but in the UML standard 2.5 documentation there such ones, too.
The next step could be joining the state machine diagrams right here or as standalone diagrams.