From the course: Computer Science Principles: Programming
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Debug problems
From the course: Computer Science Principles: Programming
Debug problems
- No programmer is perfect. And along the way you will make mistakes that will generate errors and bugs. Part of being a programmer is dealing with these types of issues, and learning how you can debug your code. There are a few ways you can go about fixing problems. One common scenario is that you are going through your program and you get a value at the end that seems to be completely off. For instance, maybe you are calculating a shopping cart. And the total amount is crazy high. Something is clearly wrong. But you can't find out where. In your code, you can monitor the values of variables by sending them to places in your app that can display text, or send yourself messages as the program runs. With these messages, you can pinpoint where things go wrong and work to fix them. There are also tools you can use to control how your code runs. Many developer coding tools called Integrated Development Environments, or IDEs, have a special debugging mode that allows you to interactively…