1

Use Case Diagram

I've never made a use-case diagram before so I'm wondering if mine is correct or not.

Christophe
  • 68,716
  • 7
  • 72
  • 138
MarrionBerry
  • 25
  • 1
  • 6
  • 1
    Seems you have completely missed the point of UML Use Cases. These are simply all the functions that your game will support. – Geert Bellekens May 08 '20 at 06:12
  • See my answer here: https://stackoverflow.com/questions/61624906/uml-use-case-diagram-for-a-plugin-performing-various-functions-through-importing – qwerty_so May 08 '20 at 06:31
  • 2
    Not enough to create an answer. Re-read the definition of a UC. It is not a single step (like Start Game or Restart Game). It's a whole process with all possible options that lies behind (it is an oversimplification!). The good way I like to look at UC is - something is a valid UC if you can start the application, do this single UC and leave the application. None of your UCs passes this test. – Ister May 08 '20 at 11:14

1 Answers1

4

In short

This is an (almost) valid use-case diagram. But this does not make make them good use-cases. But what matters in the end is if it is useful to you.

More details

Is it formally correct according to UML?

UML is value-agnostic and defines UC on page 637 of the specs (highlight by me):

A UseCase is a kind of BehavioredClassifier that represents a declaration of a set of offered Behaviors. Each UseCase specifies some behavior that a subject can perform in collaboration with one or more Actors. UseCases define the offered Behaviors of the subject without reference to its internal structure. These Behaviors, involving interactions between the Actors and the subject, may result in changes to the state of the subject and communications with its environment.

Let's check the validity of your UC in view of this definition:

  • Start game, move paddle, restart game, and exit game are behaviors that the game (subject) offers in collaboration with the player (actor). These are valid UC according to UML.
  • Ball falls, hit all bricks, hit brick, and display score are behaviors that are more questionable: they do not require a collaboration or an interaction with the player. You could nevertheless argue that these make sense only if the user observe these behaviors, so there is an interaction with the player. So it could be claimed that these are also valid UC in regard of the UML definition.
  • Add score seems to be a purely internal behavior that is done without the user and not even observed by the user. This would not be a valid UC. However labels might be misleading: if Display score would mean the final game-over score and Add score would mean an update of the score on the screen, it could again be argued that it's a valid UC.

The use of extension (optional) and inclusion (systematic) seem also correct.

Is it a good UC?

While UML is value-agnostic, many authors define a use-case in a more ambitiuous way. In particular Ivar Jacobson, the inventor of the Use case defines it as:

A use case is all the ways of using a system to achieve a particular goal for a particular user. Taken together the set of all the use cases gives you all of the useful ways to use the system, and illustrates the value that it will provide.

According to this definition, there is only one single use case here:

  • Play a game : this is the goal of the user that brings him/her value.

All the other elements are only ways of using the system to achieve this goal. So they belong to the single use-case. A approach would be to represent them as detail of the use-case description:

  • One suitable way would be to show these in terms of intent in an essential use-case. This approach was invented by Constantine and Lockwood in 1999. It is used centered and leaves full flexibility about the sequence of actions in the user interface.

  • Another modern way is the Use-Case 2.0, invented by Ivar Jacobson in 2011. These detailes would be shown as use-case slices, in a very similar way than user-stories.

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Your answer is very clear and detailed, but all from "*Is it a good UC?*" it is out of the scope of the OP question. The OP question is tagged UML, it is not tagged for the other formalism you speak about, whatever their interest. Conversely the part "*Is it formally correct according to UML?*" is fully in the scope of the OP question. – bruno May 09 '20 at 07:37
  • 1
    @bruno Thank you for your kind words. I appreciate them even more, since I know and respect your deep knowledge of UML. However the question also has a “use-case” tag and use-cases are more that just UML. This is why I feel compelled to open OP’s mind on that aspect. Moreover, the 3 founders of UML wrote a book about how to use UML in the software development („the unified software development process“). They claim that use-cases containing implicit decision about the UI is a problem (p. 164) and that use-cases are not meant to describe the user interface (p.160). So I feel fully in scope. – Christophe May 09 '20 at 08:06
  • @bruno I therefore tried to balance both aspects fairly in my answer (P.S.: I didn‘t downvote your answer) – Christophe May 09 '20 at 08:10
  • The problem is not the DV, and I know they was done by Geer and qwerty ^^ If you want to know I UV your answer – bruno May 09 '20 at 08:15
  • Honestly, today is the first time I actually read the UML definition of UC. Embarrasing! Following that definition is why people come up with spider webs like above. I'm preaching the word of Bittner/Spence (since that's where I learned it - and it makes sense!). At least, thanks to this thread, I'm aware why people are producing things like the above - and why they get lost on it. Shame on OMG. Long live the church of added value... – qwerty_so May 09 '20 at 08:26
  • May be an additional tag must be created about (at least) UC ? – bruno May 09 '20 at 08:30
  • 2
    @qwerty_so Yes, in this regard OMG transformed UML in an abstract moloch. It did btw the same for BPMN, so it‘s a kind if trademark of this organisation. I also am more familiar with the value-added definition but fortunately Bruno is here to remind us that there are other views on the question. And diversity of viewpoints is always source of progress. – Christophe May 09 '20 at 10:19
  • 1
    @qwerty_so btw, I just noticed that the UseCase 2.0 that I promote because it’s value oriented and clearer that the UML specs, is co-authored by Ivar Jacobson together with Bittner & Spence ;-) – Christophe May 09 '20 at 10:23
  • It seems that bruno is even more dogmatic than me. Too bad since I value his general UML know-how. Well, those are the times ;-) – qwerty_so May 09 '20 at 10:27
  • 1
    Thank you for your answer, and yes, Display score would mean the final game-over score and Add score would mean an update of the score on the screen. – MarrionBerry May 11 '20 at 09:26