Search code examples
oopdesign-patternsumlclass-diagram

OOMD - Is there a need of showing database connection in UML Class diagram? (A simple login diagram)


I want to design a class diagram of a simple login operation. Use case is:

  1. User enters id and pin
  2. System checks login info.

So, I decided to create a controller for the user (UserHandler) and a user class (User). UserHandler takes id and pin and checks that they are valid with a method ( isUserValid() ).

In my opinion, a class should not include all database records for only one of them. I mean there should not be a list of users to check whether login info is correct or not. This is a simple operation with just a requirement of connecting to database.

My question is how can I show that isUserValid() method is connecting to the database? Is there a need of showing this connection?

Or should I create a userList in UserHandler and keep all the users in that list?

Any help will be very appriciated.


Solution

  • You would create an Authorization class that takes a user name/password to authorize. This Authorization class will look into the users database. You could model this as association with multiplicity.

    enter image description here