描述过程的流程图或序列图?
说我要描述一个登录过程,其中涉及一些步骤。尽管每个步骤都可能是异步的交互,但例如HTTP请求&响应,整体步骤按顺序进行。
似乎流程图和序列图都可以完成工作。哪一个更适合哪种情况?我不是指UML图,而是指通常意义上的流程图和序列图。
现在,我只有一个简单的规则,即如果我有几个分支逻辑,流程图似乎更合适,因为那时它更简单。但是对于登录过程,分支逻辑很简单,例如,a。如果帐户不存在,请跳到寄存器过程; b。如果帐户/密码不匹配,请允许用户重置密码,然后再次登录; c。登录后,基于帐户偏好向用户提供不同页面。
因此,如果分支逻辑很简单,它只是偏好还是其他规则要应用?
Say I what to describe a login process, which involves some steps. Although each step may be an asynchronous interaction, e.g. a http request & response, the overall steps happen in a sequential order.
It seems that both flowchart and sequence diagram can do the job. Which one is more appropriate for what situation? I am not referring to UML diagram but flowchart and sequence diagram in general sense.
Now I only have a simple rule that if I several branching logics, flowchart seems more appropriate because it is more straightforward then. But for login process the branching logics are simple, e.g., a. if account doesn't exist, jump to the register process; b. if account/password don't match, allow users to reset password then login again; c. after log in, based on the account preference presenting the user with different page.
So if the branching logic is simple, is it just a preference or there are other rules to apply?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您在问题中已经指出的那样,这两个图都适合描述一系列操作或活动。
这实际上取决于您要显示的系统的哪个方面:
A 序列图适用于显示两个或多个对象之间的相互作用。这通常涉及一些请求和响应消息以及可能的参数。
相比之下,A 流程图适用于显示一个过程的控制流,重点是决策(如果是else)和并行处理(叉子)。
因此,对于登录过程示例,如果您需要描述例如客户端和服务器过程与数据库之间的消息序列,则应使用序列图。但是,如果您需要描述用户所经历的系统的行为,并且不显示与其他组件的交互,则可能应该使用流程图。
As you have already pointed out in your question, both diagrams are suitable for describing a sequence of operations or activities.
It really depends on what aspect of the system you want to show:
A sequence diagram is appropriate for showing the interaction between two or more objects. This typically involves some request and response messages and possibly their parameters.
In contrast, a flowchart is appropriate for showing the control flow for one process, focusing on things like decisions (if-then-else) and parallel processing (forking).
So for your login process example, if you need to describe the sequence of messages between for example a client and a server process and a data base, you should use a sequence diagram. If however you need to describe the system's behavior as experienced by the user and without showing the interactions with other components, you should probably use a flowchart.
在提出这个问题超过1年之后,我偏爱大多数高级设计文档而不是流程图。因为在HLD中,我主要想在设计中显示关键组成部分以及它们之间的相互作用(谁 do )。如果交互中有一些分支逻辑,我可以在其中添加注意。
让我在文章“ ”(我也强烈建议对Spa感兴趣的人进行本文)。因此,控制流在单词和回环箭头中显示。
我看到有些人可以称其为 swimlane flowchart 或跨官能流程图。但是如果没有免费的工具和正确的版本控件,我必须坚持序列图(并使用 Mermeraid ) 。顺便说一句,美人鱼对 swimlane
After raising this question for more than 1 year now I have a preference for sequence diagram over flowchart for most of high level design documents. Because in HLD I mostly want to show key components in my design and the interaction between them (who does what). If there is some branching logic in the interaction I can add note in it.
Let me quote this sequence diagram from the article "Single page application: from monolithic to modular" (I also highly recommend this article to someone who is interested in SPA). So the control flow shows in words and a loopback arrow.
I see some people may call it swimlane flowchart or cross-functional flowchart. But without a free tool and proper version control, I have to stick with the sequence diagram(and use mermaid). BTW, mermaid has an open issue for swimlane