Conversion from flowchart to code

Asked

Viewed 865 times

-1

I am trying to convert a sizable size flowchart to Arduino code. The flowchart is as follows::

fluxograma

Considering your size, I’d feel more comfortable using the remote goto as a flow control. However I have always heard that its use is a bad programming practice, since it is easy to get lost in the flow of the program and end up with something impossible to be debugged. In this particular flowchart which would be the best option to use, cycles or the command goto?

1 answer

3


Whatever. After all this flowchart is an excrescence :) Thing done by those who are not programmers.

Actually flowcharts are horrible. They served well in the '50s/60s in very small code. They even serve to give a basic instruction for a beginner to understand the flow of code. In fact they are even reasonable in the hands of those who know how to use them. It is not the case who did this. The error starts with the basic one where the person only knows two execution blocks. He is lame and is macaroni. I tried to follow him and he bent my head :D

Flowcharts encourage the use of goto (an instruction that actually should be avoided, but not completely abolished. Although it is possible to do it structurally, it is rare.

To follow this flow chart is really easier to use the goto. If you try to turn this into more structured control blocks, it will end up changing a little, or a lot, which it does, even if the result, in theory, is the same.

To be honest, I would throw it away and do something else. If this is the only source of information about the problem, I would interpret it, understand the problem and make a code without relying on that flow.

If you don’t want to follow my advice then I think it’s best to use the goto even, trying to modify the flow of something so confusing can give too much trouble.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.