What is debug? What is it for and how to do it?

Asked

Viewed 3,822 times

5

People while I am programming always see in the IDE’s a part called debug, I don’t really know how it works and what it’s for exactly since I don’t know if it looks like code editing but I believe that it doesn’t make sense to have a session just for that being that you can edit directly while programming, then I would like to know of the people who have more experience what is this such debug, what it’s for and I don’t know how to use it properly.

1 answer

7


That one debug who is speaking is a tool that we say we use to do debugging, ie to monitor and analyze the execution of the application to understand what is happening and try to find what is occurring at odds with what you expected.

It is not used to find syntax errors and eventually semantics, but rather logic errors that make the execution produce a different result than expected (even if this result produces an error/exception).

The ideal is never to use it, but this is theory, in practice every programmer will use a lot, and knowing how to use it deeply is one of the most important skills that the programmer should have (there are several "experienced" who cannot or do not even know that this exists, terrible). The beginner should almost learn this before actually programming, because it helps to understand the code, it helps to understand what’s going on there. So for beginners it serves as a learning tool to "see" the computer run its code, even right. It is a way to create intimacy with the "computer’s way" of doing things. Without understanding this one can never call himself a programmer.

Debugging is Twice as hard as writing the code in the first place. Therefore, if you write the code as Cleverly as possible, you are, by Definition, not smart enough to debug it.

-- Brian Kernighan

Debugging is the technique of doing this. It works more or less like a table test automated, other technique that every programmer should dominate.

The debug in itself is almost always a wrong term because it is the action, what you should be asking is about the Debugger which is not part of the IDE, but is common for people to use it with the help of the IDE because it gets more visual and easier to take the required status information, see the flow happening and determine what to do, and make some settings like breakpoints and watchpoints.

This opposes or at least completes a basic technique of debugging which is to put some code stop function and print the values you want simply inserted inside the code. Although it may be an amateur form in some chaos, for those who know how to do well may be more effective than using a tool debug. Because debugging is just this, watching the flow happen and seeing the state of the variables and how they are being modified, trying to find a pattern that shouldn’t happen and then fix it and try again.

The hard part is not using the tool, it’s understanding how to do the technique more effectively and effectively. Therefore, it is more important to learn to program well in all aspects. The tool is like any other software, it has some commands you need to know to get what you want, it’s not much and decorates fast, but how to apply it the way it helps you demand experience, commitment and study, as well as logical thinking.

Some Ides allow you to modify the code on time and continue debugging the code you will already run in its new form, but it is not a function of Debugger do this.

The technique was more or less described in our goal, but not necessarily using the tool. I have already said that it is more important than the tool?

Each IDE has a slightly different way of operating, and each language can bring about differences, even if the basics are all the same. It has the code that you see running, it can go step by step, or skip some parts and let it run naturally without tracking directly, go to a certain point, or stop when a datum has a specific value, and you can see the value of all available variables and other data that may be useful.

Some people might summarize that it is a slow motion of code running, a Matrix, so something that would run in a fraction of a second will run in seconds, minutes or hours, under their control, giving the programmer a chance to see and understand what is going on. It will give photos of the memory and registers of the computer, at least on a lower level. In higher-level languages does not fail to do this, but it does so in an easier way to understand.

The question is a little broad to describe here everything this tool does and fits more specific new questions as you learn, because the question here is only about the term.

Browser other questions tagged

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