Good programmers aren't lazy

February 8th, 2009 by comment

It goes something like this. A really good programmer, who obviously does not have a lazy cell in his or her brain (the body is another matter entirely!) declares, “I program because I’m too lazy to do the same thing again and again!”.

Variations abound, all coming back to the idea that “laziness” == an aversion to repetition.

Really?

It’s a fallacy, like the skinny girl standing in front of you declaring, “I’m so fat!”. It’s a cry for attention that points out the obvious opposite, and generates a protest, spoken or not. “No, you’re not! You’re (skinny|smart|efficient)!”

Some of the worst code I’ve ever written has been when I’m in genuine lazy mode. Laziness makes you not mind if you copy and paste a function 40 times without abstracting it. Laziness lets you avoid figuring out how to do something better, because you really don’t want to think about it. Laziness lets you put off finding a solution, copy code without understanding it, hard-code values in your applications, or stuff inline css in your html tags ‘just for now’.

Laziness is the ability to tolerate boredom and inefficiency. Good programmers lack that tolerance.

For programmers who still hide behind that phrase, it’s time to drop it. Try something else, like “I am unable to be bored”, “I cannot tolerate repetition”, or “my skin itches and I start squawking when I see DreamWeaver-generated JavaScript”.

Simplicity and elegance are hard. Striving for them is many things, but not lazy.

Comments

18 Responses to “Good programmers aren't lazy”

  1. Victoria Wang says:


    Well put. I’ve never heard this point of view before but it makes so much sense to me now — repetitive manual labor is easier than critical thinking, so actual laziness defaults to the former.

  2. ace says:


    laziness in this context means that good programmer will find better ways. or as pascal wrote in the letter to his sweetheart paraph: i am sorry my dear because this letter is too long, i had no time to write it shorter.

  3. Tiago Rodrigues says:


    Well, that depends on how you see laziness. Laziness for me is thinking “let me make this reusable and comment it so I won’t have to waste any time doing this again”. Laziness for me is “let me note this procedure down on my wiki or bookmark this useful link on delicious so I can find it more easily the next time”.

    I agree that laziness can be a good programmer habit but only if you define certain rules and behaviors, which many persons don’t.

  4. ts says:


    Good point, but you’re overlooking the other side of the coin:

    Bad programmers will do “non-lazy” things like not learn more about language features (e.g., arrays) to best accomplish the task. See the Daily WTF for numerous examples of what programmers can do when they’re not opposed to taking the long, dumb route to coding.

    Lazy can mean, “I want to do this right the first time, so I never have to do it again.” When a programmer says they’re lazy, you are free to interpret it however you please, but you’re missing the point if you think the programmer is just bragging about how they get by with minimal effort.

  5. rs says:


    You’re right – it’s not lazy, it’s efficiency, and being adamant about it

    I would say “I am efficient” :)

  6. Niels Joubert says:


    Excellent article, finally someone’s saying this! The whole idea of lazy programmers seem simply terrible.

  7. Feldenkraisian says:


    our nervous system is built for one purpose: learning. consequently it suffers when burdened with repetition.

  8. sarah g says:


    @ts — My main observation is that the drive to avoid repetition is not laziness, but I often hear the two being conflated in our field. It’s less about bragging, more about what I see as a false equivalency.

    @tiago — you say “Laziness for me is thinking “let me make this reusable and comment it so I won’t have to waste any time doing this again”. I say, Wow! If you’re lazy, let me find someone who’s efficient ;)

    Thanks for commenting!

  9. hippy says:


    I would semi disagree, think abstracting is caused by laziness, when the copy and pasted 40 times code has to be changed, noticed it would have been lazier in the long run to abstract rather then fix 40 broken copies =]

  10. Jock says:


    “Laziness makes you not mind if you copy and paste a function 40 times without abstracting it.”

    Until you have to go back in and make a change. Now you have to change it 40 times. And the next time you are faced with the same situation, you will abstract that function so you don’t have to change it 40 times.

  11. richard says:


    I agree with you.

    Laziness != disciplined work motivated by an aversion to repetitious or otherwise unpleasant tasks.

    Laziness == failure to apply oneself to the pursuit of the goods at hand (e.g., elegant, maintainable, functional code) even though one is aware of and desirous of those goods.

    Try “diligence” or perhaps the Cardinal virtues (powers) of Prudence and Courage.

    OTOH misuse of the word “laziness” is actually lazy.

  12. Dotan Dimet says:


    I wondered if you weren’t referencing the 3 Virtues of a programmer: Laziness, Impatience and Hubris. Of course a lot of bad programming is motivated by these three, but as Larry Wall and co. point out, it makes you a good programmer to be really committed to them. Copy-Pasting the same code in 40 different places doesn’t really speak to you laziness if you need to fix the same stupid syntax error (or tricky bug) in each of the 40 occurrences (and I’m pretty sure, from bitter personal experience, that the more times you paste a block of code, the more likely it is to contain an annoying careless mistake), or if you otherwise need to modify it later.

  13. Hank Beaver aka blasterpal says:


    I fell into programming to automate tasks I was constantly doing manually as a sysadmin. So I vote for the wax/kill repetition mantra. Secondly, bad programming can also involve ALOT of effort, like reinventing the wheel or succumbing to not-invented here pitfalls. Great post. Kick me if I say I’m lazy again.
    H

  14. Ken says:


    Good programmers *are* lazy, but *pre-emptively* lazy. That same code pasted 40 times, or that Dreamweaver-generated JS, is going to be a gigantic pain to maintain in 2 months (right before a release, doubly so).

    I mentioned to one of my mentors once, “You know, doing it the Right Way doesn’t really take that much more work”, and he said “YES, EXACTLY!”. A small amount of foresight saves tenfold next month.

    So we are lazy. We just don’t apply our laziness greedily.

  15. sarah g says:


    I guess it’s a matter of semantics, and which definition you use for “lazy”. I would say good programmers are pre-emptively *efficient*, rather than pre-emptively lazy, though we’re getting at the same thing.

    The determination I’m making is on the quality of the task, not the quantity of it. If you tell me, “hey, I’m too lazy to type the same thing 500 times so I wrote a shell script to automate it”, I’m not going to think, “Geez, what a slug: this guy’ll do anything to avoid working — I should fire him and get more folks in here who can do repetitive tasks and ask no questions!”

    Instead I’d say, “That’s awesome! You sound pretty efficient to me”, and then I’d give you another job or a promotion. And if you didn’t want that, you’d have that much more time to watch TV :)

    Wow. Nothing like a little semantic nit-picking before bed!

  16. S. Potter says:


    I loved, “my skin itches and I start squawking when I see DreamWeaver-generated JavaScript”. I couldn’t agree more with this thought.

    On the broader topic of laziness though, I concur that laziness isn’t the same as someone that wants to make something more useful more of the time (like abstracting functionality to DRY up code). Yet when there is a balance between writing effective and DRY code but not over-abstracting the code you could view that as a form of laziness since it took less time overall (and that was the intent).

    I find personally that reducing my workload overall definitely motivates me to balance the abstraction-”pragmatic” rope when designing and writing software, so I would argue that I am lazy in some form:)

  17. Sarah says:


    um… I always thought the whole “lazy programmer” thing was just a slightly self-deprecating, humorous was of saying “efficient.” Sometimes it is more effective to advise an inexperienced engineer to be lazy (with a bit of a mischievous grin) than to be efficient. I think that is reflected in the “3 Virtues” by Larry Wall referenced earlier, which I find both true and entertaining.

  18. Jonathan Parker says:


    I think that the saying ‘be more lazy’ is to encourage people to learn more by tricking them into thinking it will be easier (it will actually in the long run).

    The trick is to try to get people to think more long term. In this way you have too classes of lazy people.

    1. Stupid lazy. They only think about finishing the task they’re doing right now so they can go home without realizing/caring that they’re creating more work later. They probably don’t care if they’re productive or not.

    2. Smart lazy. They think ahead to save time later (i.e. overall or grand total effort is less). This requires more work up front. More thinking at least.

Got something to say?


cheap research papers