Search code examples
inheritanceumlactoruse-caseuse-case-diagram

Same use case with different behaviour for inherited actor in UML


I want to model the following behaviour: When an administrator creates a blogpost, then it is something different compared to when an user creates a blogpost, as for example the moderator is involved in the create blogpost use case, as he verifies the blog post. However, when the administrator doesn't have his role as administrator, his blog posts also needs to be verified by a moderator, as he himself inherits the behaviour of the user.

This example below may only make sense if an administrator can remove his own role, when he doesn't want to use the system as administrator.

I hope this makes sense.

enter image description here


Solution

  • Keep it as simple as possible

    You should not have twice the same use-case name to represent different behaviors in the same model. This is extremely confusing.

    By the way, the UML specification do not defined what exactly is meant when multiple actors are related to the same use-case: it can be multiple actors each involved separately in different occurences of the use-case, but it can be as well be that all actors must be involved each time.

    As a consequence, I'd suggest to keep a single Create blogpost use-case related to User and Moderator. You can still keep the Administrator being a specialization of User and use this specialization in the detailed description of the use-cases behaviors.

    enter image description here

    But not simpler as necessary

    If you think that this does not express sufficiently accurately your situation, you have two possibilities.

    1. Keep a single Create blogpost use-case associated only to the more general User, and «extend» it with an additional Moderate blogpost use-case associated only with a Moderator. THis makes sense, because the moderation use-case is a goal of its own for a moderator, that it can be reused (e.g. could also be an extension to Update blogpost).
    2. Since actors and use-cases are both classifiers, you may also think imagine a use-case Create unmoderated blogpost being a specialization of a more general Create blogpost. However this requires some more precision about redefinitions, and is in my view less expressive that #1.

    The first case would look like:

    enter image description here

    Additional thoughts

    A Moderator is in principle also a User. By curiosity: what happens if a Moderator creates a blogpost: can he/she self modereate the own content? Or musta four eyes principle make sure that a different moderetor moderates this post ;-)