这是我为用户注册流的第一个UML图。
经过反复检查,我觉得我有一个拥挤的图表相比,我可以找到谷歌搜索。
我的问题:
我的alt and else
分支使用正确吗?
在序列图中包含错误响应有效吗?
包括我所包括的笔记有效吗?
这是我的序列图设计:
这是我的序列图代码:
@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
发布于 2020-05-15 09:41:45
你忘了问最重要的事情:我的图表能理解吗?
幸运的是,答案是:是的,这是完全可以理解的。
对于你所问的问题,答案也是对所有的人来说,这是正确的。
有些事情我可能会以不同的方式做,或者在图表中做得不完全正确,但我不确定这在多大程度上是由于您所使用的工具的限制所致。
- ->
。通常,只有当返回值从调用的方式不明显时才会给出标签。https://softwareengineering.stackexchange.com/questions/410155
复制相似问题