How to associate these classes in UML Class Analys

2020-04-17 02:22发布

问题:

I'm trying to design UML Analysis Class Diagram for a college project. My UML Diagram looks like this:

I have encountered two different problems:

  1. User can have multiple roles. A user with Manager role can manage other users and their roles. How to illustrate this association in UML?
  2. User uses SwipeCard to access a room. How to show this association in UML?

回答1:

You have a really good start to an analysis model. Some things I would do:

  • Reify the association between User and Role (or make it an association class) called Role Assignment.
  • Add a verb-phrased property name to every end of every association. For example, Manager authorizes Role Assignment and Role Assignment authorized by Manager.

Here's an example first cut, off the top of my head:

I left off a bunch of stuff, including operations, which I would suppress for validation with SMEs. I can't do all the work for you!