From the course: Debugging in C#

What is debugging?

From the course: Debugging in C#

Start my 1-month free trial

What is debugging?

- [Instructor] As programmers we write lots of code, but since we aren't perfect sometimes we make mistakes and have errors in our code. These errors can cause our code to give the wrong output, or crash our program entirely. Debugging involves locating and correcting code errors in a computer program. It is part of the software testing process and is an integral part of the entire software development lifecycle. We often call these errors bugs. And the term bug comes from computer scientist pioneer Grace Hopper who coined the term bug when she found a moth causing an error in an early electromechanical computer. In debugging we must find these bugs or errors in order to correct our code and create a working program. So what kind of bugs can we have? Well just like there are many types of bugs in real life, in computing there are also different types of bugs. First, we have a syntax bug, or syntax error. A syntax bug is an error often caused by a left out semi-colon or a misspelled variable name. It means you entered a command or piece of code that the computer doesn't understand because it's not written in the proper format. Syntax errors often cause your program to fail before it's even executed because the computer has to understand your code in order to run it. A logical bug is an error where the program is able to run and the computer can carry out its instructions but it doesn't act as the user expects. It provides some output that the programmer did not intend. This means you might have added instead of subtracted numbers, or maybe used a less than sign instead of a greater than sign. In debugging we often look for parts of the program that aren't working correctly, find its respective code and fix it. To debug or find these errors we usually use tools called debuggers, which we'll be breaking down throughout this course, specifically for C#.

Contents