4 ms·
It's somewhat language-specific, I think. With languages like Python or Lisp or Haskell or indeed Javascript, it's an interesting question what "using a debugg
by retrac 3y ago
It's somewhat language-specific, I think. With languages like Python or Lisp or Haskell or indeed Javascript, it's an interesting question what "using a debugger" means. They do have debuggers, but In a safe language with a REPL the need for a debugger significantly decreases. The only times I've painfully, desperately wanted a debugger has been when dealing with unsafe languages where stack frames can get overwritten, buffers can overflow, and I have no idea where the instruction pointer has wandered off to -- you know, when I can't even get printf() to work. One of the main things I would use gdb for when working with C is just to inspect values inside variables etc. and get the sort of insight into the program that comes free at the Javascript console.
- shortrounddev2 3y agoPython is a common example. You can use a debugger in vscode but I rarely see people do this, opting instead for print statements everywhere. But for javascript, the ability to put breakpoints into sourcemaps is invaluable, because trying to debug minified or transpiled javascript is a pain in the ass, and yet I still see people console.log everything
- skydhash 3y agoMore often than not, with python and other dynamic languages, the main source of bugs is not knowing the type of the variable you're dealing right now or what it contains at this point. Setting up breakpoints can be troublesome especially if your IDE/editor is not the one launching your process (attaching to PID is often not trivial). Strongly typed language often obscures logic with verbose syntax, that's where a debugger comes in handy. Compiled languages often only have a single start point and a debugger is more useful than print statement.
- shortrounddev2 3y agoI find debuggers are more useful in a dynamic language because of the uncertainty of the state of the program. I am better able to write lots of code without testing frequently in C++ than I am in Python or Javascript
- anditherobot 3y agoIn a statically typed language and explicit type definitions. int age = will never have string "December". But in python both: age = 42 and age = "December" are possible.
- shortrounddev2 3y agoYes, that's why I find it much easier to write code without a debugger in c++, though I do use one frequently