"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan
Remark: If the code is complex enough to be at the limits of your skills, then debugging that code will exceed your skills. In other words, don't make code so complex that you can't maintain it. "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?", quoted from Kernighan (and Plauger, in "The Elements of Programming Style").
I've found that using weaker tools can help with complexity. It's hard to write a complicated C program because it can't do very much. C programs tend to use lots of arrays because that's all you get, but it turns out that arrays are great -- compact memory representation, O(1) access, good data locality. I'd never advocate intentionally using a weak tool, though. Instead, my lesson has been: write Python code like it was C.--"Complexity is the enemy" written by Evan Martin.
April 24, 2011
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment