Flowcharts

A flowchart is a drawing that represents a process detailing its tasks and decisions. Its purpose is to express in a simple and visual way what happens in a process or a program, so that it is easy to understand.

Flowcharts can be presented to the programmer so that the programmer better understands what the client wants to do. The programmer then develops the program based on the flowcharts.

Flowcharts are also drawn to document a completed computer program, to communicate what the program does in a visual and understandable way.

Flowcharts are not limited to representing the operation of programs, they can also inform us of the tasks that we must perform in a given situation.

This is what a flowchart looks like:

_images/flowchart-estudiar.png

Symbols

Below are the main symbols used to draw flowcharts.

Start and end

All flowcharts must have a start symbol and an end symbol, which are represented by rounded rectangles at the ends.

_images/flowchart-inicio.png

Program start and end symbols.

Tasks

The tasks that the program performs are represented by rectangles. Inside the rectangle you must write what the task consists of. For example, add two numbers or send a message.

_images/flowchart-tarea.png

Task symbol.

Input and output data

When the task consists of data input or output such as writing on the screen, asking the user to type text, printing a sheet of paper, etc. In that case the task will have a tilted rectangle shape.

_images/flowchart-entrada.png

Entry and exit symbol.

Decisions

A very special symbol is the decision symbol. With this symbol the program can follow two different paths, depending on whether the condition is fulfilled or not.

_images/flowchart-decision.png

Decision symbol. The way to go depends on the condition.

Flow Arrows

All the symbols must be linked together by arrows that indicate how the sequence is carried out. The arrows indicate the path or flow that the computer follows from the beginning to the end of the program, through all the tasks.

_images/flowchart-flecha.png

Task union arrow.

Arrow Connectors

When the two tasks to be joined are too far apart or when it is confusing to cross many arrows, then two circles with the same number are used to indicate the beginning and end of the arrow:

Each arrow should have a different number, so there should only be 2 circles with the same number: a start circle and an end circle.

_images/flowchart-conector.png

Long arrow, separated by circular connectors.

Other symbols

So far we have seen the most important symbols. With them you can represent all the diagrams with which we are going to work. There are also other specialized symbols that allow tasks to be represented in more detail, but using them would only complicate the diagrams more, so we won't use them.

Example diagrams

Sequence diagram

In this diagram the tasks follow each other, without any decision. This type of diagram is useful to know the order in which a task must be carried out.

_images/flowchart-huevo.png

Flowchart describing how to make a fried egg.

Diagram with conditions

In this type of diagram, the flow of the task is not sequential and deviates depending on the conditions that are met.

_images/flowchart-mueve.png

How to move a character with the keyboard.

Resources

Web to draw flowcharts online:


Exercises

  1. Draw a flowchart describing the most important tasks you have to do in the morning from the time you wake up until you arrive at school. There should be between 5 and 8 tasks.

  2. Draw a flowchart of a traffic light that turns on a green light for 10 seconds, then turns off the green light and turns on an amber light for two seconds, then turns off the amber light and turns on a red light for 10 seconds. Finally, turn off the red light and start the cycle again.

  3. Draw a flowchart that explains how to fix a lamp. First you need to check if there is light in the house. Then you will check if the lamp is connected. Finally you will check that the bulb is not blown. A solution must be given to each of the above situations. If none of the above situations apply, you will call the repair service.

  4. Draw a flowchart describing a method for ordering numbered cards, from smallest to largest.

    There are two piles of letters, one unordered and one ordered. First you have to take a card from the disordered pile. It is then compared to the first card in the sorted pile. If the new card is smaller, it is placed on top of the sorted pile.

    If the new card is higher than the first card sorted, we look for the next card in the sorted pile and compare again which card is higher. We repeat this until the new card is placed in its place.

    Once the new card is placed, we again take another card from the disordered pile.

    When the pile of jumbled cards is gone, the program ends.

  5. Draw a flowchart with the help of the computer and with the Libre Office Draw program. In the next section you can download a Libre Office Draw template for drawing flowcharts.