How do YOU debug?
- debugger?
- print statements?
- log files?
- sending messages to your phone?
- super simple setup?
- super complicated setup?
How do YOU debug?
For further actions, you may consider blocking this person and/or reporting abuse
TechDogs -
VISDOM 04 -
Vikas76 -
Oliver Bennet -
Top comments (18)
honestly in js, I always
console.log
, if I want to go deeper, I right-click store as variable and inspect it from the console. I've wanted to setup a debugger before, but it seems like a lot of setup. Am I wrong in thinking that?Same here.
I also love to use console.log ))
I am with the others so far, print statements cover 95% of my debugging. Most of the time I can trim it down to a very small quick running chunk and a couple of print statements, gives me enough insight.
I would also say that I heavily use the ipython repl which gives me a lot of power to inspect things as I am running things.
I also recently learned about the built in python debugger. I had something buried deep into a pipeline that would only error after running for 10 minutes. Python gives you a very convenient
breakpoint()
in 3.7+ orimport pdb; pdb.set_trace()
for python 3.7-. ipython also gives you an incredible magic command to run %debug after an error occurs, to allow you to jump into a debugger right where your last error occurred. Again I am still heavily in theprint
statement debugging camp.Front end here so we don't tend to keep logs.
95% of the times I debug the scope is fairly small.
Other options:
Good one with git bisect. I didn't even think to categorize that as a debugging technique.
Do you fully setup dev tools in your editor to get a debugger running on the front end? I have never done it, so I wonder what the different levels of setup look like. I imagine there is a quick and dirty use browser dev tools up through setting up everything into your editor.
Yeah I use git bisect rarely, it can be quite good :).
Ah I haven't really done that in a while because the browser (I do web development) has really good debugging tools. I have used an editor debugger before that "latches on" to the browser debugger, but I haven't used that since my last job because I didn't need to. To use the browser debugger you can write
debugger
in the JavaScript code where the debugger should start, or just use the browser debugger directly which is fully functional.Other than that I do use debuggers that don't run in the browser, such as for Node.
I'm all about the print statements. Can't quite wrap my head around debug tools when I want to work fast.
When totally lost, deleting code until the problem shows up is my process of elimination technique.... Thank god for modern version control.
Heck yes. Version control is so valuable for a good debug session. Slice away all you want then figure out what you actually changed once its all said and done.
Commonly in the browser, I debug using
chrome inspect
and a lot ofbreakpoints
.Working with React + Redux I use this redux-logger nice middleware to help debug or add my own middleware to Redux, like:
Note: networkMiddleware and thunk are the middleware that is enabled in the project I'm working at this moment.
When working with
React Native
I like to use Reactotron and in some cases, I use this simple package called logger.js for add simple logs withemojis
with a more visible way :)Pry Rails is a must for me when working with Ruby. Debugger that allows me to stop the code and peek around and test variables. Plus it makes the console format better and with color!
github.com/rweng/pry-rails
Mostly with print statements and log files.
problematic_function_old
OMG, I've been simulating a debugger with print statements. xD
In most cases, I don't use debuggers because they suck!
🤣
I like the idea of copying the function. For some reason I only do this when developing cli tools, but sometimes I will make a
verbose
flag, then make a separate print function that does anif versbose
fro me and i just callvprint
for example.Print statements all the way.
Debuggers are, to me, very slow and painful when I can often achieve better/faster results just by logging my app's data.
I only recently started using a debugger at all. I am still with you for 90% of my use cases though!
Everyone here is a genius so far... print statements all the way :D
For JS, this is what I do:
dev.to/richardeschloss/3-minimally...
Thanks for the Link Richard!