There’s some good discussion here about when and when not to use debugging
So, when do I not need a debugger?
I am not the smartest coder, nor the most experienced, but still, sometimes I do not need to use the debugger. That is when:
The code is mine or well-written AND
It is written in a readable language AND
The overall project is small.
When do I rely on a debugger heavily?
Short Answer: often.
When an application crashes. Particularly when it is deployed. Having VS2010 installed on that computer can make a difference between "Unknown Error" and FileNotFoundException.
When a 3rd party library crashes or misbehaves.
When the code is poorly written. Particularly if the same file was touched by 10 different people in the last 10 years, 7 of which are no longer with the company.
When the project is large
When the code is rather monolithic.
When there are several tiers (GUI, SQL, BL) involved.
But it’s a little outdated (2011).
Personally I feel:
Don’t use a debugger
For a technically simple website with very limited features
Prototype
Codebase you work in every day
Use a Debugger
Large codebase, including a microservices codebase
Mainly for backend django code, JS code in my exp. is serviceable with console.log(), css is usually the pain.
An unexpected crash
I was wondering what the Django communities’ thought’s were?
<opinion>
A debugger is just another tool in the toolbelt. It’s not magic and it’s not a silver bullet.
Personally, I think it’s more important to know how to use one, and to understand the information it can provide to you when trying to diagnose problems.
You can then make an informed decision on a case-by-case basis as to whether it’s going to help you or not.
It’s a whole lot better to be in the position of “I don’t need to use a debugger here, I understand what’s happening in the code” than to have to say “I don’t understand what’s happening in this code and I can’t figure out how to find out where things are going wrong.”
Learning how to effectively use all the tools available to you is part of one’s personal development as a programmer. This transcends all other considerations of language, framework, operating system, etc. </opinion>
I guess I would say I don’t start with “I’ll use a debugger”. I gather whatever information is available to me and see if I can find the cause of the problem.
I either have enough information or I don’t.
If I don’t, then I figure out what information I need and decide how I’m going to get it. It may or may not be by using a debugger. There isn’t a hard & fast rule, it’s purely a judgement call.
Thanks for the info, I think intuitively I think in similar patterns. What kind of coding work do you do? Full-time job, contracting, side project work, etc. and what kind of systems do you contribute code to?
While I understand the curiosity behind your questions, I don’t believe this is necessarily the right forum for discussing such topics. It’s getting out of the realm of being a Django-related topic, and I really don’t want to get the moderators upset with me. I’m open to continuing this conversation in other channels.
I’ll use a debugger if it’s easier to do than throwing in a print/console.log statement. I haven’t found an easy way to integrate PyCharm, Poetry and our environment variables yet (I’m due for another attempt), so I tend to use a lot of print and logger statements when I’m dealing with the backend of my day to day application. However, on the frontend, I’m much more likely to use a breakpoint on the frontend and div into the code there. Browsers make it so easy these days.
As Ken mentioned, it’s a tool. A particularly useful tool when your mental model of the code doesn’t match the code which you seem to agree with: