Elegance

There’s an old H. L. Mencken quote that’s popular among mathematicians and programmers:

For every complex problem, there’s an answer that is simple, clear, and wrong.

But both in math and in programming we strive for elegance, anyway. We want the beautiful, obvious solution—even if it may not have been obvious at all from the start. The solution that proves that the universe itself makes some sense, we just get confused sometimes.

Sometimes programmers or mathematicians start down one path and before long we’ve lost sight of the forest because of the damn trees. And if we could just chop one more down…

My favorite commits are those that really embody the Zen of Python (regardless of language). Particularly “beautiful is better than ugly” and “simple is better than complex.” Those “hmm, but what if I…” moments that come before deleting a ton of code.

Sometimes we do need to solve lead-bullet problems. But those tend to be obvious. “I have to change this API call everywhere but it’s so much better” or “this changed a fundamental assumption and there will be fallout.” A lot of real lead-bullet problems happen after you’ve found a silver bullet somewhere else.

So if you find yourself wading through the muck of a lead-bullet problem and you’re not damn sure why, well…

there's got to be a better way!

There’s got to be a better way!

Take a step back, take a breath. Re-evaluate the problem.

Then consider deleting a bunch of code and starting over.

(If you’ve got tests. You’ve got tests, right?)