数据流图的定位:没有条件和循环
数据流图的本体不是“流程图”,而是“数据”。不是给“流程图”补上了数据信息,而应该是描述“数据”的流动和处理信息。如果更着重于表示“动作”,可以使用流程图。这一条在Wikipedia第一段就开宗明义:
A data-flow diagram (DFD) is a way of representing a flow of a data of a process or a system (usually an information system). The DFD also provides information about the outputs and inputs of each entity and the process itself.
A data-flow diagram has no control flow, there are no decision rules and no loops. Specific operations based on the data can be represented by a flowchart.[1]
Stack Overflow有一句话看起来很经典:
One must resist the temptation to add too much detail to DFDs.
如果将数据流图的每个process当做一个函数的话,那么即使函数内部有判断信息,但输入和输出一定是固定的,因此数据流图不需要条件判断。
以下是一些总结:
-
数据流图要素:
三要素:实体(Entity),流程(Process)和数据(Data)
其中Note部分不是必须的。注意,所有的动作都在Process中,Note只是一些“名词”。比如上图,用户要下订单,“下订单”是Process完成的,Note上只需要写“order”,意为用户将order传给Process。 -
数据流图可以分层,从粗(level 0)到细(level n),不同层的输入输出一定要一致;
-
数据流图应该避免线段交叉,为此entity和process可以重复出现
-
数据流图的Process应当适当([1] 中建议7±2个)
-
其他
两个不错的教程,可以互为参证。
[1] 数据流图指南:https://www.visual-paradigm.com/cn/guide/data-flow-diagram/what-is-data-flow-diagram/
[2] 数据流图画法详解(不错的PPT教程):https://wenku.baidu.com/view/24fc4ec7d5bbfd0a7956733a.html
[3] UML-Tutorial:https://www.tutorialspoint.com/uml/uml_activity_diagram.htm
最后,你渴望最原始的力量吗?
UML-2.5.1官方文档。