3 ms·
Kris Rudin, Senior Developer and Associate Partner at digital marketing agency Ascentium says, "One 'lost skill' that I see all the time with new developers --
by schrototo 15y ago
Kris Rudin, Senior Developer and Associate Partner at digital marketing agency Ascentium says, "One 'lost skill' that I see all the time with new developers -- how to debug without an integrated debugger. When I started programming (in 1986, just after punch cards, using a mainframe & dumb terminal), we didn't have any IDEs and debuggers, we had to put trace statements in our code to track values and execution.
"Today," says Rudin, there are occasionally times with you can't use the integrated debugger in your IDE (usually with some weird web application frameworks and server configurations), and younger programmers are at a loss as to what to do, and resort to hack-and-slash coding to try to randomly fix a bug, using guesswork. Me, I just calmly put in some code to display output values on the web page, find the bug, and fix it."
Oh come on. What he's describing isn't some "lost skill". If you can't figure out to use print statements for debugging you're not much of a programmer in the first place.
Most statements in that article describe really basic, common sense stuff.
- narcissus 15y agoI work a lot in PHP, so it's kind of funny that I find that new developers in PHP are exactly the opposite: most of them don't know how to use IDE debuggers with PHP. Instead they have print statements all through their code and they end up veering away from any form of OO or 'complex' code, as it becomes hard to 'debug' this code when there's a problem. Don't get me wrong: 'debugging by echo' is useful at times, but I would say that 9 times out of 10, a proper debugger is more valuable. In my case. YMMV. etc.
- Udo 15y agoIt depends on the environment and personal preference. If I remember correctly, Linus Torvalds never works with a debugger either. A few years ago, when I was still doing desktop software, I used the Delphi and MSVC debuggers regularly. Now I do mostly web-based stuff and I find that unit tests and logging have largely made a debugger obsolete for me.
- bsaunder 15y agoI find analyzing trace statements to be far faster than setting conditional break points and stepping through a debugger. I can quickly run a test, grep/skim through the trace output and ignore/drill down into detailed minutia that are irrelevant/relevant to the problem being investigated. I also tend to write my trace statements in an easily parsible format so if I need to I can write another program to analyze what happened and find the problem. Writing a full on program to process log files happens less often than chaining several unix commands to find the needle in the haystack (usually the program happens when I need to thread together several widely separated trace lines).
- KirinDave 15y agoThis is situational in the extreme, especially when you're interested in specific conditions in tight loops. For example, if you're debugging a race condition in a render loop, it's probably not going to be easy to reproduce when you also start trying to write out megabytes of data at the same time.
- jackpirate 15y agoThe only way to debug real race conditions is to engineer your code from the beginning to avoid them. Debuggers and prints are equally powerless to help you.
- KirinDave 15y agoDebuggers can help identify race conditions by giving you insight into the state of the process at the time of the break. The reason they're superior to printf's in this regard is that debuggers can signal breaks on conditions without requiring a recompile. In general, debuggers are superior because of this. Good debuggers aso let you ask questions on the fly inside a stack frame, something printf-stuff can never do. Of course, I didn't say nor mean to say that ALL race conditions are identifiable in this way, only that it can make the results more visible for some of the more obvious cases.
- Ixiaus 15y ago
- lhnz 15y agoThis is a lot because the PHP Debuggers are very time consuming to set up and a lot of people prefer to code in Notepad++, rather than a complex IDE.
- k4st 15y agoI think that it's useful to distinguish between code that one has an intimate knowledge of / intuitive sense of and code where one does not fully understand. For example, I find printf-like debugging and using stack traces from Valgrind to be very useful for debugging my own code; however, at work, when I have no idea where the problem is, something like gdb or the debugger of Visual Studio really comes in handy.
- cpeterso 15y agoIn the proprietary, NIH world of embedded software, vendor often ship development tools whose quality ranges from flaky to totally broken. With tight deadlines to ship devices that will be obsolete within months, investing time and people to support robust dev tools across multiple platforms is deemed a low priority. printf() debugging is often the only reliable (and portable) option. :(
- prodigal_erik 15y agoSadly, the open world is not immune to this. I've seen Eclipse's remote Java debugger intermittently fall over with bizarre JPDA errors, and spewing to log4j was also my quickest workaround. I'm not invested enough in the success of Eclipse, or Java for that matter, to contribute fixes.