UML/序列/包/... JavaScript和Electron应用程序的替代图? [英] Uml / sequence / package / ... diagram alternative for JavaScript and Electron application?

查看:64
本文介绍了UML/序列/包/... JavaScript和Electron应用程序的替代图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,是否可以绘制某种图表以可视化电子和JavaScript应用程序?

My question is if there are any kind of diagram I could draw in order to visualise and Electron / JavaScript application?

对于不同的uml图(例如类图或包图),我将需要替代方案,但是由于JS是基于原型的,并且不像Java或C#,所以我不知道该怎么做.

I would need alternative for the different uml diagrams, like class or package diagram but since JS is prototype-based and it's not like Java or C# I don't know what I could do.

我唯一可以制作的是序列图,但我也应该(可能必须)制作其他图.

The only one I might be able to make is a sequence diagram, but I should (probably must) make other diagrams as well.

推荐答案

首先,您完全没有必要在UML图中记录所有内容.因为有效的软件比全面的文档更重要.但是,UML在突出显示软件中一些琐碎的方面方面非常有用,这些方面在代码中不容易找到.我的建议是将重点放在这些方面.

First of all, you're not obliged to document everything in UML diagrams at all. Because working software is more important than comprehensive documentation. However, UML can be extremely useful to highlight some less trivial aspects of your software that can not be easily found in the code. And lmy advice would be to focus on these aspects.

现在在UML中应该做什么取决于您打算在模型中表示什么以及如何使用js.

Now what you should do in UML all depends on what you intend to represent in your model, and how you're using js.

UML区分结构图以显示您的软件上的静态视图和行为图以显示它的动力.

UML distinguishes structure diagrams to show the static view on your software and behavioural diagrams to show its dynamics.

这可能对您没有吸引力,因为JS是基于原型,并且与基于UML的基于静态类的静态视图相反,该方法在类型逻辑方面提供了极大的灵活性.

This could be less attractive to you, since JS is prototype-based and offers a great flexibility regarding the typing logic in contrary to the rather static class based view of UML.

尽管如此,您仍然可以从类的概念中受益,并使用类图为了显示您的设计意图(即您对对象分类的看法)或用于实例化对象的原型(尤其是如果您设计一些对象本质上充当原型,那么实际上使它们成为类的代表).当然,如果您的JS设计根本不是面向对象的,则将您的程序映射到OO概念毫无意义(请参阅这里).

Nevertheless, you could still benefit from the concept of classes and use class diagrams in order to show either your design intent (i.e. your mental view on the object categorisation) or the prototype used to instantiate objects (especially if you design some objects to act essentially as prototype, making them de facto as representatives for classes). Of course, if your JS design is not at all object oriented, it would make no sense to map your program to OO concepts (see here).

请注意,旧版对象图可以

在两种情况下,您可能对使用依赖项有助于将静态元素(即对象或类)链接到行为意图.

In both cases, you may be especially interest in usage dependencies that help to link the static elements (i.e. objects or classes) to the behavioural intent.

最后,例如,包装图您的 .js 文件及其依赖性的大图片.这不是传统的Java包的意义,但也可能有用.

Finally package diagrams could be used for example to show the big picture of your .js files and their dependencies. It's not in the sense of the traditional java packages, but could also be useful.

在这里,我假装所有这些图表对您来说都是有意义的.

Here, I would pretend that all these diagrams could make sense for you.

首先想到的是序列图.因为它有助于可视化几个 对象 之间的预期交互,而仅通过浏览代码很难找出这些交互.

The very first that comes to my mind is the sequence diagram. Because it helps to visualise expected interactions between several objects, and these are difficult to find out just by browsing through the code.

在某些情况下,状态机图可以为您提供帮助出色地.如果行为取决于某个状态变量,或者您想要显示对象的整个生命周期,则这特别有意义.

In some cases, the state machine diagram could help as well. This makes particular sense if the behaviour depends on some state variable, or if you want to show the full lifecycle of an object.

最后,您可以考虑活动图.如果要显示整个系统中的控制流或对象流,这些功能特别有用.如果您不熟悉它们,并且为了简化到极致,那是一种超级流程图,但是其中的箭头不是绝对的,代表下一个操作",但也可以代表在操作之间传递的对象.

Finally, you can consider the activity diagram. These are especially useful if you want to show the flow of control or of objects across your system. If you're not familiar with them, and to simplify to the extreme, it's a kind of super-flowchart, but where the arrows not jus represent "next operation" but could also represent objects that are passed between operations.

这篇关于UML/序列/包/... JavaScript和Electron应用程序的替代图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆