3 ms·
I agree about multiplying 4-digit numbers (though I suspect ability to do that correlates a lot with good working memory and concentration, which are useful for
by gjm11 4y ago
I agree about multiplying 4-digit numbers (though I suspect ability to do that correlates a lot with good working memory and concentration, which are useful for other things too). But the ability to dive into an unfamiliar body of code that isn't perfectly documented and exhaustively unit-tested, and figure out what it's trying to do even in the presence of minor errors, is useful, because there is lots of code out there that isn't perfectly documented and exhaustively unit-tested. And this sort of challenge exercises (and maybe improves?) that ability.
If you're chasing a bug, then yes, using a debugger will likely get you there quicker than staring at the code hoping for enlightenment. But you might instead be wanting to understand the code, and while running it in a debugger might be useful for that I think being able to read it and grasp what's going on is a genuinely valuable skill. (Maybe the code you're reading runs on some embedded system that doesn't have a good debugger. Maybe it's deep in the source code for your OS and there's no plausible way to hook a debugger into there. Maybe you're reading it on a webpage and it would be a nuisance to get all the code needed to run it onto your computer at all. These are all situations I have come across fairly recently.)
Disclaimer: this is a thing I am (I think) unusually good at, and there is a near-universal human tendency to overvalue one's own strengths.
It's a bit like doing chess tactics puzzles. When you're actually playing a game, usually there isn't a startling tactic available, and when there is you don't have the advantage of knowing there is, and winning slowly and mundanely may be a better approach than looking for a tactical brilliancy. But if you want to get better at chess, doing tactics puzzles should be part of what you do, because it helps make you better at spotting tactics when they do appear and at analysing them accurately. Also, if you enjoy playing chess, solving them can be fun in the same way as playing chess is; similarly, if you enjoy the small-scale work of designing and implementing algorithms and finding algorithmic bugs, solving puzzles like the one we're discussing can be fun in the same way as programming and debugging can.