简体   繁体   English

如何生成(不是绘制/渲染)序列图

[英]How to generate (not draw/render) sequence diagrams

I'm looking for ways to generate Sequence Diagrams out of programmed Logic.我正在寻找从编程逻辑中生成序列图的方法。 I do not mean rendering them out of eg text.我并不是说用例如文本渲染它们。 A lot of post talk about generating, but I see that as rendering/drawing.很多帖子都在谈论生成,但我认为这是渲染/绘图。 I've searched the internet and most found textual tools (like PlantUML) or intuitive graphical payed tools.我在互联网上搜索过最多的文本工具(如 PlantUML)或直观的图形付费工具。 I'm not looking for either.我也不在找。 But I want to program the message flow and let the system draw it based on possible choices.但是我想对消息流进行编程,让系统根据可能的选择来绘制它。 One reason for it is that the conditional if then else with 'alt' is not very useful (my opinion) if the else triggers a whole different path.原因之一是如果 else 触发了完全不同的路径,则带有“alt”的条件 if then else 不是很有用(我的观点)。 It works for one different return, but it becomes very ugly soon (again my opinion).它适用于一种不同的回报,但很快就会变得非常丑陋(我再次认为)。 The other reason is that I'm busy developing such a generating tool myself and I'm wondering if I do not try the make something nobody is waiting for.另一个原因是我自己正忙于开发这样的生成工具,我想知道我是否不尝试制作没人在等待的东西。 Except the fact that it is a nice hobby project for myself.除了这对我自己来说是一个很好的爱好项目。 For me it made sense to make it as it Interactively creates the Message Diagrams which are very helpful during the development process or pass on knowledge.对我来说,这样做是有意义的,因为它以交互方式创建消息图,这在开发过程中非常有帮助或传递知识。 Perhaps it could even validate the logic on dead ends.也许它甚至可以验证死胡同的逻辑。 The third reason is that the text becomes complex by itself to maintain (see example below).第三个原因是文本本身变得复杂而难以维护(参见下面的示例)。 The fourth reason is that I believe in automating a process that can/should be automated as we should not be busy drawing stuff but writing logic.第四个原因是我相信自动化可以/应该自动化的过程,因为我们不应该忙于绘制东西,而应该忙于编写逻辑。 So is anybody aware of generating (not draw/render) tools available for sequence diagrams?那么有人知道生成(不是绘制/渲染)可用于序列图的工具吗?

The following examples were created where the difference started at invalid/valid card, which is difficult to capture in an if/then/else.以下示例是在差异从无效/有效卡开始的情况下创建的,这很难在 if/then/else 中捕获。 And even so other choices are made along the way.即便如此,在此过程中也会做出其他选择。

Invalid card, choices: electronic -> chip -> invalid card -> keep goods无效卡,选择:电子->芯片->无效卡->存货

Merchant             Customer         Terminal  
|                    |                |
+-inform-amount      |                | 
|---choose-method--->|                | 
|<--chooses-terminal-|                | 
+-enters-amount      |                | 
|------------start-payment----------->| 
|                    |<--show-amount--| 
|                    +-inserts-card   | 
|                    |-method-chosen->| 
|                    |<--card-invalid-| 
|                    +-pay-different  | 
|<-----------payment-failed-----------| 
+-goods-left-behind  |                | 
+-customer-leaves    |                | 

Valid card, choices: electronic -> chip -> valid card -> auth valid -> enough balance有效卡,选择:电子->芯片->有效卡->验证有效->足够余额

Merchant              Customer           Terminal           Secure-Intf       Acc-Srv                 Acc-DB  
|                     |                  |                  |                 |                       |
+-inform-amount       |                  |                  |                 |                       | 
|----choose-method--->|                  |                  |                 |                       | 
|<--chooses-terminal--|                  |                  |                 |                       | 
+-enters-amount       |                  |                  |                 |                       | 
|-------------start-payment------------->|                  |                 |                       | 
|                     |<---show-amount---|                  |                 |                       | 
|                     +-inserts-card     |                  |                 |                       | 
|                     |--method-chosen-->|                  |                 |                       | 
|                     |<----card-valid---|                  |                 |                       | 
|                     +-enter-pin        |                  |                 |                       | 
|                     |---validate-pin-->|                  |                 |                       | 
|                     |                  |--sec:authorize-->|                 |                       | 
|                     |                  |                  |--verify-login-->|                       | 
|                     |                  |                  |                 |---get-login-details-->| 
|                     |                  |                  |                 |<-----login-details----| 
|                     |                  |                  |<-login-response-|                       | 
|                     |                  |<--sec:auth-valid-|                 |                       | 
|                     |                  |---sec:transfer-->|                 |                       | 
|                     |                  |                  |----transfer---->|                       | 
|                     |                  |                  |                 |------get-balance----->| 
|                     |                  |                  |                 |<-----balance-info-----| 
|                     |                  |                  |                 |-upd-checking-balance->| 
|                     |                  |                  |                 |-upd-merchant-balance->| 
|                     |                  |                  |                 |----commit-changes---->| 
|                     |                  |                  |                 |<---changes-committed--| 
|                     |                  |                  |<---transferred--|                       | 
|                     |                  |<-sec:transferred-|                 |                       | 
|<-----------payment-successful----------|                  |                 |                       | 
+-goods-given         |                  |                  |                 |                       | 
|                     |<-------paid------|                  |                 |                       | 
|                     +-customer-leaves  |                  |                 |                       | 

Textual code valid for several free drawing tools.文本代码适用于多种免费绘图工具。 If any changes are needed then I think it becomes difficult to maintain.如果需要任何更改,那么我认为它变得难以维护。 I rather generate them.我宁愿生成它们。

title MSG-Flow for 'Merchant-flows'
participant "Merchant" as Merchant
participant "Customer" as Customer
participant "Terminal" as Terminal
participant "Secure Intf" as Secure_Intf
participant "Acc Srv" as Acc_Srv
participant "Acc DB" as Acc_DB
note left of Merchant: inform-amount
Merchant -> Customer: choose-method
Customer -> Merchant: chooses-terminal
note left of Merchant: enters-amount
Merchant -> Terminal: start-payment
Terminal -> Customer: show-amount
note right of Customer: inserts-card
Customer -> Terminal: method-chosen
Terminal -> Customer: card-valid
note right of Customer: enter-pin
Customer -> Terminal: validate-pin
Terminal -> Secure_Intf: sec:authorize
Secure_Intf -> Acc_Srv: verify-login
Acc_Srv -> Acc_DB: get-login-details
Acc_DB -> Acc_Srv: login-details
Acc_Srv -> Secure_Intf: login-response
Secure_Intf -> Terminal: sec:auth-valid
Terminal -> Secure_Intf: sec:transfer
Secure_Intf -> Acc_Srv: transfer
Acc_Srv -> Acc_DB: get-balance
Acc_DB -> Acc_Srv: balance-info
Acc_Srv -> Acc_DB: upd-checking-balance
Acc_Srv -> Acc_DB: upd-merchant-balance
Acc_Srv -> Acc_DB: commit-changes
Acc_DB -> Acc_Srv: changes-committed
Acc_Srv -> Secure_Intf: transferred
Secure_Intf -> Terminal: sec:transferred
Terminal -> Merchant: payment-successful
note left of Merchant: goods-given
Terminal -> Customer: paid
note right of Customer: customer-leaves

So is anybody aware of generating (not draw/render) tools available for sequence diagrams?那么有人知道生成(不是绘制/渲染)可用于序列图的工具吗?

Have you tried ZenUML( https://zenuml.com )?您是否尝试过 ZenUML( https://zenuml.com )?

在此处输入图像描述

It can also generate sequence diagram from Java code (as an Intellij Idea plugin).它还可以从 Java 代码(作为 Intellij Idea 插件)生成序列图。 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM