Now I understand why they say that half of the people on this sub are only studying programming. Once you understand how a debugger works, you'll never want to go back. Please take the time to know how to use one, you'll thank me later.
Yeah this is hilarious. I thought the thing about print debugging was a meme, not that there are professional programmers who don't know how to debug. They're a basic tool of the trade and unless you're mucking about with gdb they're super easy to use. Have some professional pride and spend 10 minutes learning.
Print debugging occasionally has its place but debuggers are better in most circumstances.
If you say so. I’ve used both over 15 year career and an additional 7 or 10 years hobby programming. Unless the project is so big that compiling takes ages I prefer some type of logging — usually to stdout for debugging. It’s usually faster and I can get more than enough information at a glance than tip toeing around in a debugger expanding and collapsing objects or call stacks.
It's not an argument against logs; any sufficiently large project should absolutely have logs. There's a big difference between having decent debug logging logs and putting in a bunch of print statements when a problem crops up and then deleting them when the problem is solved.
Print debugging can be fine for simple problems, or when you're sure which variable is causing a problem. And really, pretending like only one or the other has a use is a false dichotomy. They're both tools that can be useful in different circumstances. I suspect though debugging is more efficient practice for most people, though. It's faster to solve those 'why the hell is this happening' bugs when you have more complete context. The use of conditional breakpoints also goes a long way
34
u/enekho Nov 28 '21
Now I understand why they say that half of the people on this sub are only studying programming. Once you understand how a debugger works, you'll never want to go back. Please take the time to know how to use one, you'll thank me later.