More generally, complicated code is a sign that you don’t understand your program well enough to make it simple. —Code Complete, Second Edition
I don’t think I’ve ever seen a better, more succinct rule of thumb for programmers. If you ever find yourself looking at a chunk of code and wondering what it does, you should ask yourself if there is any possible way to simplify it. Almost every time I’ve ever had a feeling that a block of code is too complicated but left it as is (for whatever reason), I’ve regretted that decision later.
P.S. I haven’t forgotten about the updates I promised in The Education of a Programmer, but it turns out that writing a post that does justice to the source material is non-trivial. I’ve spent at least three times as much time writing and erasing and rewriting the first update as I did on the reading/exercises I was going to post about.
Back to flipping out…