gpt4 book ai didi

uml - 为网络论坛制作 UML 类图

转载 作者:行者123 更新时间:2023-12-04 05:14:08 26 4
gpt4 key购买 nike

我正在尝试创建一个论坛,其中有用户创建各种类别的主题。其他用户可以发表回复
这些是我下面的表格

categories
id
category_title
category_description
last_post_date
last_user_posted

posts
id
category_id
topic_id
post_creator
post_content
post_date

topics
id
category_id
topic_title
topic_creator
topic_last_user
topic_date
topic_reply_date
topic_views

users
id
username
password
email
forum_notification

我在为我的论坛创建 uml 类图时遇到问题,但我有点困惑我可以为用户创建下面的一个图,但我不知道如何创建其余的图
  ┌─────────────────────────┬
│ Users │
├─────────────────────────┬
|username: String |
|password: String |
├─────────────────────────┼
|+logIn() |
|+logOut() |
├─────────────────────────┼

最佳答案

首先,你应该知道你需要做更多的“行为图”来显示系统上应该发生什么,以便更深入地了解如何设计“结构图”,如果我应该说的话,它可以更技术地描述系统.行为图的示例是用例图和序列图。

Structure diagrams show the things in a system being modeled. In a more technical term they show different objects in a system. Behavioral diagrams shows what should happen in a system. They describe how the objects interact with each other to create a functioning system.



那么我们要通过你的问题,“类图”,简而言之

Class diagrams show the classes in a system, attributes and operations of each class and the relationship between each class. In most modeling tools a class has three parts, name at the top, attributes in the middle and operations or methods at the bottom. Different relationships between diagrams are show by different types of Arrows.



举个例子
  ┌─────────────────────────┬
│ Users │
├─────────────────────────┬
│id: int |
|username: String |
|password: String |
|email: String |
|forum_notification: bool |
├─────────────────────────┼
|+logIn() |
|+logOut() |
|+Reqigster() |
|+CreateTopic() |
|+EditTopic() |
|+AddNewPost() |
|+EditPost() |
|+DeletePost() |
|+SendMessage() |
|+ReportIssue() |
├─────────────────────────┼
| ..1
|
|
|
|
| 0..*
┌─────────────────────────┬
│ Posts │
├─────────────────────────┬
│id: int |
|category_id: int |
|topic_id: int |
|post_creator: int |
|post_content: String |
|post_date: DateTime |
├─────────────────────────┼
|+PostDelete() |
|+PostUpdate() |
|+UpdateContent() |
|+GetViewers() |
|+ChangeCategory() |
├─────────────────────────┼

在帖子类中,您将通过将该类与类别和主题类等相关联来继续工作。 beer 始终牢记您应该考虑所有实体之间的关系。

祝你好运。

关于uml - 为网络论坛制作 UML 类图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14500308/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com