Today we gonna learn about debugging. Which is it important to learn because this is our tools to fight the bugs (programming errors). As we will learn how to program in general is it necessary to know every different programming errors that we could encounter while we running the program. Such as syntax errors, runtime errors, and semantic errors. We will go in deep what is debugging.
What is syntax errors?
As the author of the book Think Python states, “syntax refers to the structure of a program and the rules about that structure”. All of the programming languages not only Python can only execute the program if the syntax is correct. What happens if the interpreter found a syntax error in the program it will display an error message. The syntax error will be such as you forgot to close parentheses example 8) is a syntax error.
May you tolerate reading this post with most syntax errors, but the interpreter of Python will not run the program when syntax error found. Python is not so forgiving. You will forget any parentheses, brackets, and so on in your programming journey as you gain experience.
What is runtime errors?
Don’t worry about this error because will encounter when a bad logic occurs. The error does not appear until after the program has started running. The explanation is when you start your program then it is running and then some exceptions appear. It is very rare when your code is short you will see when you have written a large of a code.
What are semantic errors?
You can read this without tolerating the errors I most have. The same with the semantic error in your program, the program it will run successfully without displaying error or crushing, but it will not do the right thing that you wanted. An example you wrote an instruction on how to go to B from A but taking the C way before arriving at B then your program did not go to C before B. This is the semantic error may you write not the exact instruction. Therefore, you have to write it will and correct the semantic of your instruction.
What is experimental debugging?
Debugging is not that easy you think if your thought is easy to find bugs in the program. Imagine a 100 lines of code and you have a syntax error in it. Then you have to read it line by line right. It is OK! Important to realize that one of the most important skills you will acquire is debugging.
In this case, you will experiment like seeking the idea about what is going wrong, you modify and try again. Is about hypothesis, when your hypothesis is correct you can predict the result of the modification and if not correct you have to come up with a new one.
Be a detective, as Sherlock Holmes pointed out, “When you have eliminated the impossible, whatever remains, however improbable, must be the truth.”
A. Conan Doyle, The Sign of Four
Watch the movie Sherlock Holmes, The Sign of Four in Amazon Prime.
Programming and debugging is the same thing as I read in the book. Why? Because while you writing and running your program you are debugging it. The final result is a running program.
What are the formal and natural languages?
Formal languages are languages that are designed by people for specific applications. For example, a notation of mathematicians and a Chemist represent a chemical structure of molecules.
Natural languages are the languages people speak, such as English, Spanish, and French. They were not designed by people (although people try to impose some order on them); they evolved naturally.
Syntax rules come with remembering tokens and structure. Tokens are basic elements of the language, such as word, numbers, and chemical elements. The
Referenced book Think Python:
As shown above we learn what is debugging and its part the programming errors. We have seen the different type of bugs or programming errors that we will encounter in our program. I hope to show by myself how to learn Python as I showing to you. Good luck in the journey of programming, it will be a along long journey and most important is to gain experience.