Search code examples
umlclass-diagram

What is the right way to represent a controller in a uml class diagram?


I am new to UML class diagrams and now I had to start a java project by making a class diagram first on my own. It is about a company, and I want to store employees(through EmployeeInterface) and projects with DAO. As you can see I created a controller, but I don't really know what is the right line type to use and where should it point. I did this in Astash. Thank you in advance.

PS: Also, I am not sure about my other lines neither(especially compositions). I would be glad if anyone can check them.

enter image description here


Solution

  • I'd use role names rather than typed attributes:

    enter image description here

    This way it's clear how the relation between classes is set.

    FWIW: I used lower first char for the two attributes/roles as it's a common convention to have types start with upper and attributes/operations start with a lower case char.

    For the rest of your relations it looks ok. Personally I'd not use shared aggregation and just use simple associations. Shared aggregations have almost no semantics (as per UML spec it explicitly states that you need to define the semantics in your domain).