[英]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:
用例是:
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. 任何帮助都会非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.