Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 2.01 KB

coding-and-debugging.md

File metadata and controls

11 lines (6 loc) · 2.01 KB

Coding and Debugging

As a software developer, it's essential to have debugging skills, as it's a fundamental aspect of improving and extending a system. Debugging allows you to identify and correct any errors, ensuring that your code is working correctly. As a junior developer, getting stuck for extended periods is natural, but it's essential to learn how to unstuck yourself quickly.

There are two primary types of debugging: print-based and debugger-driven. Print-based debugging involves inserting print statements at different points in the code to track the execution path and print the current state of variables. The upside of this method is that it's universal to any language and is easy to implement. The downside is that you have to edit the code, which can take time to clean up, and sometimes you need to rebuild/reload the project to see the prints.

Debugger-driven debugging, on the other hand, is a more sophisticated approach that allows you to debug your code frame-by-frame, seeing the state of any variable in that frame. This method is more efficient than print-based debugging and can help identify issues that may not be easily spotted with prints. However, the downside is that it is slower to start up and can sometimes cause lags or freezes in your IDE/Text Editor.

It's essential to get acquainted with both types of debugging, as they complement each other. Using the debugger too often may harm your logging skills, while using prints too often can take more time since you need to clean up. Knowing when to use which method is also essential. Usually, debugging via the debugger is faster, but debugging via prints may show places in your systems where you need extra traces.

Mastering debugging skills is critical to the success of any software developer. Whether you're a junior or a senior, getting unstuck quickly is vital to improving and extending the system you're working on. Knowing the pros and cons of both print-based and debugger-driven debugging is essential to choose the right approach for the task at hand.