简体   繁体   English

OOMD-是否需要在UML类图中显示数据库连接? (一个简单的登录图)

[英]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 用户输入ID和图钉
  2. System checks login info. 系统检查登录信息。

So, I decided to create a controller for the user ( UserHandler ) and a user class ( User ). 因此,我决定为用户创建一个控制器( UserHandler )和一个用户类( User )。 UserHandler takes id and pin and checks that they are valid with a method ( isUserValid() ). UserHandler接受id和pin并使用方法( 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? 我的问题是如何显示isUserValid()方法正在连接数据库? Is there a need of showing this connection? 是否需要显示此连接?

Or should I create a userList in UserHandler and keep all the users in that list? 还是应该在UserHandler创建一个userList并将所有用户保留在该列表中?

Any help will be very appriciated. 任何帮助都会非常有用。

You would create an Authorization class that takes a user name/password to authorize. 您将创建一个使用用户名/密码进行授权的Authorization类。 This Authorization class will look into the users database. Authorization类将调查用户数据库。 You could model this as association with multiplicity. 您可以将此模型建模为具有多重性。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM