8 ms·
Debugging code is more difficult than writing it. If you write the cleverest code you can, you are, by definition, not smart enough to debug it. /shamelessly s
by cgrealy 7y ago
Debugging code is more difficult than writing it. If you write the cleverest code you can, you are, by definition, not smart enough to debug it.
/shamelessly stolen from somewhere I'm too lazy to look up.
- steveklabnik 7y ago"Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?" - Brian Kernighan, "The Elements of Programming Style"
- jodrellblank 7y agoWriting "for (int i=0; i<limit; i+=step) {}" is easy. Debugging the off-by-one error requires that you understand the alignment issue you ignored in the first place. That would make debugging harder, not because debugging is inherently hard, but because that's the place you're forced to deal with the hard bit you skipped earlier. I wonder how often that applies, compared to well-understood-but-implementation-mistake code?
- cgrealy 7y agoDamnit, I really should have remembered that :)
- zzzcpan 7y ago> Debugging code is more difficult than writing it. It's not. It's possible to not know how to do it well though. As it's something you have to experiment with, learn various approaches, instrumentation.
- cgrealy 7y agoI'm interested to hear what your rationale for this is. When you are writing code, you generally know what it is you are trying to achieve. When debugging code, you're frequently trying to find out why a problem is happening in the first place; often in code that someone has written or that you wrote months or even years ago. I'm not saying that debugging isn't a skill you can learn, but it's a superset of writing code, so it's by definition harder.
- zzzcpan 7y agoI disagree that debugging is a superset, it's a different skill. It's possible not to know how to design and implement an algorithm, but know how to dig into somebody else's implementation and vice versa. But being harder is not even about the skills themselves, it's about mental effort it takes to do something. And designing and implementing things is certainly much much harder, than digging into something already designed and implemented.