What is considered a "gambiarra" or a bad code? [closed]

8

For example, I create a code, and it works, but I'm not sure it's okay for me to do the same thing that way. Is this a gambiarra? Do I have to make sure that the code is made in such a way that it is considered a "good code"?

    
asked by anonymous 28.06.2017 / 18:36

1 answer

8

Gambiarra is the term used for poor quality and poorly made code, which does not always work (but sometimes it works, but in a way that should not be used).

It's often confusing code, tied up with a lot of stuff that has little or nothing to do with the purpose of the code, and brings unwanted side effects and problems. It may also be a fragile code that does not work in abnormal situations.

For example:

Knowing what gambiarra is or is not is very subjective. An example of a real-world programming problem would be instead of passing a value X as parameter of function A to function B, saving the X in a file in function A and reading that file in function B. This is gambiarra because file would be used for the application to communicate with itself without saving data from one execution to another and neither saving memory, and generating side effects because it depends on the use of the disk, is slower, etc. And it is also an inadequate way to do it, as there is a much simpler and more straightforward solution and files were not designed for this purpose.

    
28.06.2017 / 18:43