首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用户注册流程UML图

用户注册流程UML图
EN

Software Engineering用户
提问于 2020-05-15 00:39:37
回答 1查看 361关注 0票数 0

这是我为用户注册流的第一个UML图。

经过反复检查,我觉得我有一个拥挤的图表相比,我可以找到谷歌搜索。

我的问题:

我的alt and else分支使用正确吗?

在序列图中包含错误响应有效吗?

包括我所包括的笔记有效吗?

这是我的序列图设计:

这是我的序列图代码:

代码语言:javascript
运行
复制
@startuml

actor Client
participant Controller
participant UserRepository
participant UserProfileRepository
database MongoDB

Client -> Controller ++ : Registration Request
note left
Http Method: POST
Token Type: CREDENTIALS
Token: EMAIL:PASSWORD
end note

Controller -> Controller : Validate token type,\nemail, password\nand email not already\nused

alt if all are valid
Controller -> UserRepository ++ : Create new user
UserRepository -> MongoDB : Save created\nuser in DB
UserRepository -> Controller -- : Return created user

Controller -> UserProfileRepository ++ : Create new user profile
UserProfileRepository -> MongoDB : Save created user\nprofile in DB
UserProfileRepository -> Controller -- : Return created user profile

Controller -> Client : Return user id
note left
Http Status : 201 Created
User id returned in Header
Location: /users/USER_ID,/usersProfiles/USER_ID
end note
else if invalid token
Controller -> Client : invalid request
note left
Http Status : 400 Bad Request
end note
else if invalid email
Controller -> Client : invalid email
note left
Http Status : 400 Bad Request
end note
else if invalid password
Controller -> Client : invalid invalid password
note left
Http Status : 400 Bad Request
end note
else if email already used
Controller -> Client -- : user already exist
note left
Http Status : 409 Conflict
end note
end

@enduml
EN

回答 1

Software Engineering用户

发布于 2020-05-15 09:41:45

你忘了问最重要的事情:我的图表能理解吗?

幸运的是,答案是:是的,这是完全可以理解的。

对于你所问的问题,答案也是对所有的人来说,这是正确的。

有些事情我可能会以不同的方式做,或者在图表中做得不完全正确,但我不确定这在多大程度上是由于您所使用的工具的限制所致。

  • 函数调用的返回箭头应该是带有打开箭头的虚线箭头,如这个- ->。通常,只有当返回值从调用的方式不明显时才会给出标签。
  • 就我个人而言,我会使用HTTP状态代码作为相应箭头上的标签,而不是在单独的注释中提到它。您正在使用HTTP的事实已经从初始请求消息的注释中得到了明确的说明。
票数 2
EN
页面原文内容由Software Engineering提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://softwareengineering.stackexchange.com/questions/410155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档