2

I'm struggling with a task as I was given to practice UML and use cases. The problem is that I should model computer version of a board game so I am unsure about a few things. obviously it does not matter if you play against the PC or another player, the actions are the same. The game is simply like tic tac toe.

E.g.

Actor Player ---(Place a diamond)-----include---->(Check for a row)---include-->(Swap players)

But the game is played on the PC, so is Check for row really a use case? And the same with Swap players? Because the system would do that. On the other hand, if it was not, how could I continue?

1

I would agree that 'Check for a row' or 'Change turns' are not use cases but activities done by computer. In that case, all that use can do would be performing a move, i.e. Placing a diamond.

1

There is no strict rule for the level of abstraction you choose for your use case diagrams, but in general I would not model them too "low level". For a real-world scenario, you would probably model the game play as just one single use case. If your game has some kind of administrative mode (for example, to change some options), that maybe seen as a different use case.

The things you mentioned above like checking for rows and swapping players are better modeled by an activity diagram.

EDIT: in terms of use cases, IMHO it does matter if you play against the PC or another player. Only because the rules of the game are the same, the interaction with the system is quite different (for example, if this is a desktop program, for playing against another human you might use a network connection, need a "chat mode", and so on).

  • Exactly but my task is to create correct use case diagram model. And as it is played on PC, I dont believe "Check for a row" or "Switch turns" are actually use cases because user cannot directly use them, they occur as a response. From my point of view, there would be two actors (Player 1 and 2), both associated to one use case - Place the sign on the board. – John V Oct 11 '13 at 13:05
  • @user970696: "Place the sign on the board" is no use case, it is also an activitiy. See my edit what might be seen as an additional use case (besides the 2 cases I already mentioned above). – Doc Brown Oct 11 '13 at 14:14
  • I disagree - Place the sign on the board is an action initiated and done by player and described by a sequence of steps, it is clearly an use case. You confuse activity diagram and use cases. Typical use cases from books "Create an order", "Find a contact". This is the same, it is just something that user can do. – John V Oct 11 '13 at 14:32
  • @user970696: as I wrote above, there is no strict rule for the level of abstraction, and for the purpose of learning it is ok to make "Place the sign on the board" a use case. But in a real world context, modeling a real system, I would not try to create use case models so low-level. – Doc Brown Oct 11 '13 at 15:19
1

Use cases model the different actions or sequences of actions that happen while "actors" are interacting with the "system", f.ex. using the application. The way I see it, "checking a row" is not a use case, it is an step in the program itself.

In UML context, consider what actions the actor, here the player, takes while playing their turns? And, what are the outcomes, in the context of the game itself?

  • Thank you. Basically user can only put the diamonds on the board and later move them. If there is a row of 3 or more, you take 1 opponents' diamond. So I would say there are only 3 USE CASES: Put the diamond, Move the diamond and Take opponents diamond which occurs only when a row is achieved..so maybe and extension to these two cases, as it can occur after each move/placement? – John V Oct 11 '13 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.