# Data flow diagram A data flow diagram answers a different question from a flowchart: not what happens in what order, but what data moves where. It has four elements only, which is why it stays readable when a flowchart of the same system would not. Start at context level, one process and its external entities, then expand to level 1 only if you need to. --- ## When to reach for one * Privacy and data protection work, where the question is where personal data goes. * Integration design, before anybody has written a connector. * Explaining a system to someone who does not care about the code. --- ## How to draw it in Capable | **Route** | **Use when** | | --------- | ----------------------------------------------------------- | | Graphviz | Layout is automatic, which suits diagrams that grow. | | draw.io | You want the classic DFD shapes and full control of layout. | --- ## A worked example A level 1 data flow diagram for an order system: ![Data flow diagram](https://help.gocapable.com/images/att1418493955.svg) The source, which you can paste into a new diagram and edit: ``` digraph dfd { rankdir=LR; node [fontname="Helvetica"]; customer [shape=box, label="Customer"]; warehouse [shape=box, label="Warehouse"]; order [shape=ellipse, label="1.0\nTake order"]; fulfil [shape=ellipse, label="2.0\nFulfil order"]; orders [shape=box, style=dashed, label="D1 Orders"]; customer -> order [label="order details"]; order -> orders [label="new order"]; orders -> fulfil [label="pending orders"]; fulfil -> warehouse [label="pick list"]; fulfil -> customer [label="confirmation"]; } ``` --- ## A few things that catch people out * Every process needs at least one input and one output. A process with only inputs is a data store you mislabelled. * Do not draw control flow. Arrows carry data, not sequence. * Number processes (1.0, 1.1) so level 1 and level 2 diagrams can refer to each other. --- ## Related [Decision treeBranching questions with one answer at the end.](https://help.gocapable.com/diagrams/decision-tree.html) [Decision tableDMN rules with real hit policies.](https://help.gocapable.com/diagrams/decision-table.html) [ExamplesWorking diagrams you can copy.](https://help.gocapable.com/diagrams/examples.html) --- _Draw the unhappy path too._