Search code examples
oopumlclass-diagram

UML class diagram implementing Registration for login


I am trying to model a class diagram model where a user needs to login to a Java swing application. The user would have to register before being able to login. Here I have shown this through the composition relationship. I am not sure if this is correct. I feel Registration could be a generalisation of user and named "New user" but if this is the case I feel I would need to make another generalisation called "Returning user" but the User class and the the generalisation "Returning user" would have the exact same methods and attributes and so I assume this is wrong. I was wondering if someone could help me understand this part of the class diagram. Thanks in advanceenter image description here


Solution

  • I feel Registration could be a generalisation of user and named "New user" but if this is the case I feel I would need to make another generalisation called "Returning user" but the User class and the the generalisation "Returning user" would have the exact same methods and attributes and so I assume this is wrong

    Yes this is wrong, a Registration is not a User nor the reverse, so there is no generalization between these two classes.

    Your can have the compositions you indicate, but why the classes User and Register have the attributes email and password ?. Do you want to save the initial values in Register while the current values (can be the same) are in User or the reverse ?

    Of course the class checking the password must have access to the (current) password whatever the way for.

    Why the class Admin has the attribute adminName, the name is already managed by User and Register

    All your attributes are String, for the dates/durations this is strange.

    Your operations do not have parameters, some of them certainly need parameter(s) to work

    As I understand the class Register is not only used during the registration, its name is not very clear then, Registration which is closed is more clear