-2

I have an existing piece of code that uses a database. In order to understand its algorithm, I try to represent it with a flow chart. In this algorithm I need to fetch some data from the database in order to run a procedure. For example I have this algorithm that stores a reservation for a hotel room:

  1. Fetch url slug, and room booking datetime and booking name.
  2. From url slug get the hotel id from the database.
  3. In the database table booking save the name, datetime and hotel id.

So far I did the following flowchart: Hotel booking

How can I represent that I fetched some data from the database and give a clear view of data used in the algorithm? Practically the hotel id is input data that I generate in a second step and I would love to have a clean-cut representation of them.

  • I took the liberty to slightly reword your question, to make clear that it’s about flowcharts representing algorithms with database access and not about an algorithm generating a flowchart automatically based on some database content. Can you please check if it corresponds to your intent ? – Christophe Dec 9 '19 at 12:09
1

Flowchart diagrams have as primary purpose to represent the flow of control and not the flow of data. So you have no satisfying standard solution:

  • a database symbol that can be used to show data where data is fetched or stored. But to achieve your objective, you’d need to put an arrow between each process step and a database symbol, making the diagram unreadable.

  • A more pragmatic workaround could be to put a data “badge” (or “entity” token) on the process steps to visually show which data it is processing. Everybody will understand it, but this visual highlight has no well defined semantic: so it’s only a reminder for you.

A better approach could be to use an activity diagram instead of a flowchart. UML activity diagrams support by design the modelling of control flows AND object flows, with a well defined and standardized semantic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.