Why should you care about debugger?
Developers... Are you wasting your time as well? 😱Loggers, prints, stdouts... however you may call them…those fellas are every developer's first love.... ❤️
They helped you write your first "Hello world",...
They helped you understand your first for loop,...
They helped you understand reading files,...
And they helped you debug your first bugs...
But at some point, you have to say goodbye 😢 ... well not entirely...
In some cases, loggers are still useful.
But regarding debugging, the debugger is a much better choice, and here is why...
1. Loggers are not ideal for debugging
They are usually forgotten in code and pushed to production. This is not just bad for clean code, but also for your production logs monitoring. Logs are also not good at formatting output, which leads to troubles reading your enormous arrays.
2. Stop execution and take a deep breath with a breakpoint
With a breakpoint you can stop execution of your code at any line. You can skip through lines to reach a certain state you wish to debug. You can even set conditional breakpoints which could stop in certain iteration step in a huge loop.
3. Inspect variables during the execution
Stopping the execution also provides you to inspect all variables and their values at that specific state. With this you can see the changes much faster as you would with logging them. Those variables are also nicely formatted, this comes especially handy, when you have nested objects, and want to expand only specific properties.
4. Evaluate your code, before it’s being run
This was one of the great discoveries of my programming journey. Stopping execution and then running code with variables that are available at that specific state. For example, you can adjust your query and run it while stopping the execution.
And this is just the tip of the iceberg 🗻...
If you would like to see me explain more advanced features and see them in action make sure to let me know :)
