I once worked with a guy named Ed. He was one of the most conscientious programmers I’ve ever met. He wrote beautiful code, well organized, easy to understand, virtually bug-free and rigorously commented. One day we were discussing programming, and he said that he wrote all those comments because he was lazy – he didn’t want to have to work hard to change the code later.
I’ve lost track of Ed through the years, but I often think about that conversation. For me, well-written unit tests are my way of being lazy. A good, use-case level automated test suite is (in my experience) an incredibly powerful way to validate the behavior of the core of the system, a great tool for teaching the key concepts, and, most importantly, an outstanding way to minimze the amount of frustration involved in changing and re-doing the system over time. And so far, it has worked very, very well – I don’t have to spend a lot of time maintaining old systems. They run, they do their job, and I revisit them occassionally to add features.
Many of you might have had a different image in your mind when I wrote “Lazy Ones.” – you were probably thinking of the slothful slackers who stealthily sneak and slither, souring source code serendipitously. (Sorry, couldn’t resist) But I don’t think they’re lazy. If anything, they are Tired.
- Lazy programmers look at the whole system, and try to find the way to satisfy as many goals as possible, having learned through experience that not satisfying as many goals as possible will surely lead to annoying rework
- Lazy programmers often seek to improve themselves, learn new languages and techniques, so they can find new ways to solve problems efficiently.
- Lazy programmers hate doing grunt work, and will, whenever possible, find ways to automate or scriptify the work, instead of doing it by hand.
- If they get work that is not only tedious grunt work, but essentially impossible to automate, Lazy programmers get very, very grumpy
- Sometimes (perhaps more often than others) Lazy programmers are prone to overbuild – overreaching the actual need
- Lazy programmers often hate/despise/deplore the concept of having to fix and debug crappy code