From pseudocode and diagrams. Programming in Linux 3

From pseudocode and diagrams

En this series of articles we are ttrying to provide a theoretical framework that allows aspiring programmers to choose the best tools from the huge selection that Linux offers for creating software.

In the previous article we had divided the programming process into five stages and we had started with the description of the first one.

From pseudocodes and diagrams

For those who are not comfortable with graphical representations using flow charts, pseudocode represents a good alternative.

The pseudocode is halfway between a long narrative description and code written in a programming language.

It is a detailed description of the steps that a program must take to fulfill the task assigned. But Being written using words from our language, allows those who participate in a project without being programmers to determine if they understood what is expected of them.

The description in pseudocode aissues the following types of instructions; process, control, description and the combination of all or some of them. For this it uses three types of structures:

  • Sequential structure: The instructions are executed in an orderly manner starting with the initial line and so on until reaching the last one.
  • Selective structure: Whether an instruction is executed depends on whether or not a condition is met. It can be double (there are two alternatives) multiple (Several mutually exclusive conditions) Multiple Cases (It is compared if a value generated by the program matches a given one)
  • Iterative structure: One or more instructions are executed without interruption until it is indicated or a condition is met. The modalities are Loop While (instructions are executed as long as a condition is held). Loop repeat (Checks if all the instructions of the loop have been fulfilled and if it has been done, it continues with the execution of the rest of the program, Loop for (The code of the loop is executed until the predetermined number of repetitions is reached), loop for each (is executed with a list of elements, Nesting (Include functions and procedures within other functions and procedures.

Pseudocode example

Suppose we have to write a program that compares two values ​​entered by the user. It is not accepted that the user enters two equal values. We would have something like this
INICIO
Poner las variables A=0 y B=0
Pedir la introducción de dos valores distintos
Leer los valores
Asignar los valores de A y B
Comparar los valores de A y B
Si A y B son iguales se vuelve a 3
Si A > B entonces escribir A es mayor que B
Si A < B entonces escribir Escribir B es mayor que A
Escribir ¿Desea introducir otro valor? (S/N)
Si se pulsa S ir a 3
Si se pulsa N finalizar programa
FIN

Open source tools for problem determination

Programs for creating flow charts.

These programs bring all the necessary symbols to represent the tasks of the future application.

LibreOffice Draw

The vector drawing application of The Document Foundation's office suite includes all necessary symbols. Although, as it was not created for that, we will not have automation features. It will be necessary to adjust position and size manually

Inkscape

It is the most complete open source tool for working with vector graphics. It uses the SVG format to all its advantages and is the ideal choice for high-quality output of flowcharts. It also has all the necessary symbols predefined

Dia diagram editor

Dia is inspired by Visio, the Windows application for creating technical graphics. Available in the repositories, it works with various graphic formats, allows printing on multiple pages and, in addition to the predefined forms, allows the use of others created by the user.

Program for writing pseudocode

PseInt

This development Spanish is great to start with writing pseudocode. DSince the pseudo-code it uses is based on our language, the learning curve is noticeably reduced. It also includes a flowchart creator, tooltips, pseudocode templates, smart indentation, and program execution.

Because pseudocode is not formalized, there are not many tools available. If there are plugins for the various code editors and integrated development environments.


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.