Question

I'm starting to learn UML and have a question about Actor Generalization:

Imagine I'm writing a use case diagram for some kind of application for a College . I've identified there are two Actors; Student and Teacher.

Now, to keep it short, lets say the requirements are fairly simple (and not really important to my question):

  • A student can search for a class
  • A student can register for a class
  • A student can submit a paper
  • A student can pay his course fees
  • A Teacher can grade a paper
  • A student can contact a teacher for one of his classes (e-mail type message, but all managed within the system)
  • A teacher can contact all students for one of his classes (again all handled by the system).

All jolly good.

Where I get stuck is this:

  • A Student has a username and password and must login to use the system
  • A Teacher has a username and password and must login to use the system
  • A Student can reset his password via an online portal
  • A Teacher can reset his password via on online portal

So my question is ... How best to handle the common use cases for the system?

On one hand, I could see that both Student and Teacher are a specialized type of User, and the User actor is associated with the common use cases (so A User has a username and password and must login, A user can reset his password via an online portal etc).

On the other hand it seems kind of strange to have Teacher and Student have the same super-actor (correct term?) as they seem to be two very different users of the system. Should I not therefore keep with the two actors (Student and Teacher), and simply make associations between Student to common use cases and Teacher to common use cases?

I've tried both approaches. As I mentioned, the User generalization approach feels off due to the Teacher and Student being very different, but having several of the same use cases for different actors seems a little unoptimized (or redundant, or just funny looking on paper!).

Is there a right or wrong answer on this or is it just down to preference?

Was it helpful?

Solution

One of the most important usages of actor generalization is to "factor out common actor behavior".

The best way to do this is to make the User actor abstract. That way, you don't have to worry about its details and how teacher and student vary so much. "Judicious use of abstract actors simplify your diagram and improve readability".

So I say go with generalization but make the parent actor abstract. Although not doing so is not wrong at all, as you said: no wrong or right.

Quotes are from UML 2 and the Unified Process - section 5.2 - Actor Generalization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top