Developers often find themselves in situations where the code they've written is not working quite right. When that happens, a developer debugs their code by instrumenting, executing and inspecting the code to determine what state of the application does not match the assumptions of how the code should be correctly running.
There are bugs in every modest sized or larger application. Every developer has to learn how to debug code in order to write programs that work as correctly as time and budget allow.
In addition to fixing bugs, debugging is an important skill for improving the efficiency of an application by optimizing performance and improving the logic. Debugging is a complex skill that takes time and practice for a developer to gain as a capability.
Some common debugging techniques include:
Printing out or displaying values of variables and state at certain times during the execution of an application
Changing the state of a program to make it do different things. This is called altering the "path" of the program
Stepping through the execution of a program line by line
Breakpoints
Trace Points
Stopping the program at certain events
Viewing the output of a program in a debugger window
There are many debugging tools, some of which are built into