11

The most likely answer is no, but I've come with this doubt. Can an actor act as a class?

I know actors trigger events and can have prompts, but if there's a class modeling an actor (such as an user class) can we call methods over them? Or is this a complete misunderstanding of the actor role, which is getting mixed with the representative class?

Supposed as correct:

Supposed Correct Example

Doubt if correct:

enter image description here

8

In UML, an Actor is always something (a system or person) that is outside the scope of the system/software that you are building. It would be completely wrong to equate an actor with an instance/object of a class that happens to model certain aspects of the actor in your system.

In the shown UML diagrams, the actor "User" (with it's stick-figure icon) represents the real-world human being that operates your system. The class User represents a model of that person that captures the characteristics that are relevant for you. This class only exists within your system.
This makes that the class and the actor are two distinct entities and should also be shown as such in your diagrams.

  • "Actor is always something outside the scope of the system/software that you are building." Nevertheless the actor interacts directly with the object of some Class by initiating the call stack. Therefore he somehow is a part of the system (he is represented by another arbitrary class from a UI layer that is most likely not modelled by the class diagram). This seems really counterintuitive at first and is probably the source of confusion for some folks. – dvdblk Nov 28 '18 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.