In any program, mistakes can be of two types – Logical Errors Semantics and Syntax error. it is not difficult to trap and resolve syntactical mistakes as the compiler or language can help you in that, but it is extremely tough to trap logical mistakes. Debugging is a practice of trapping and solving both logical and syntactical mistakes.
Bugs are true show stoppers. As somebody said that – To err is human, to debug is divine. In this article will attempt to put the best practice like anti debugging which can be used to debug. These practices are useful to developers in addition to other administrator who compose SQL Queries and Shell Scripts.
Procedure for Debugging
Debugging can have two instructions, these are measures when cause is identified and when origin is just suspected. We take different actions in both directions.
When Cause is just suspected – We need to do some extra test. This will change the status of suspected origin to identified trigger or not a cause in any way. If this occurs we can opt for the subsequent step.
When cause is identified – If the cause is identified, today it’s time to fix the cause. This is important to remember that even an identified cause may be not able to debug the issue. In such cases we must search further.
The process of debugging is quite simple and clear, but our goal is not to get obvious procedures, but to search best practices for quick debugging.
Some proposed methods can be:
Consider the box – this strategy is very useful when you are trying to debug our own program and – all alone. What generally happens, you think that the code is error free and logic has no defects, but the majority of the time, you are incorrect. Just try to read every code line and assume it is incorrect, this way you can quickly catch some mistakes.
Dry run – our C and++ instructor was discovered of dry running in his words imitate the compiler, and then automatically you may create mistakes. The logic behind dry run is easy, have a sheet of paper and implement the entire code line by line. In the mean while make sure you write all alterations from the variable value. You can catch many bugs created only due to change in values. This is also referred to as walk through.
Bug patterns – Bugs lurk at borders, it is proven truth that bugs basically come in the border values. Programmers have a propensity to misuse less than equal to or more than equal to. This contributes to error. Always be certain that your logic is not failing at the border values.