Search code examples
umlclass-diagram

If a control class uses a method from another class, how do we model the association?


If a control class uses a method from another class, how do we model the association?

For example, if I have a User class and a PortalController class that allows users to add or delete another user, how do I model the association in UML?

I suppose User should be a dependency for PortalController since it uses methods from User to create a new user.

User <--- PortalController

But a user would also be the one using the PortalController, so there should be another association:

       uses
User --------> PortalController

Should I draw two arrows?


Solution

  • If a class A uses a method from another class B, you should model it as a Usage dependency from A to B depicted below enter image description here

    Now I am pretty sure that you mix two differents User.

    When you said that you PortalController is able to manage a set of User, you are dealing with the structure/implementation of your system so it seems normal to have two classes.

    When you said that a User logs to your system, you are dealing with the use case of your system. So in this case the User would be an actor using your system.

    Does it help?