The Programmer’s Virtues

larry-wall-perl-virtues

One of the first bits of wisdom I ran across in my career as a programmer was Larry Wall‘s “Three Great Virtues of a Programmer.” For those of you who aren’t familiar, Larry Wall is famous as being the creator of the Perl programming language. In the first edition of his book Programming Perl, Wall wrote: “We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.”

Stained-glass image of an angel with a computer for a head

The patron saint of programmers apparently suffers from chronic Blue Screen issues.

I’m sure that Wall got a lot of comments about this statement after the book was first published; “Those don’t sound like virtues,” “When is laziness ever a good thing,” “How exactly would these traits make me a better programmer?”

I imagine this was the case because for the second edition of the book, Wall defined each ‘virtue’ in the book’s glossary:

  • Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer.
  • Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer.
  • Hubris: Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer.

It’s hard to find an issue with these definitions. I’ll admit that at first blush my reaction was a negative one – laziness, impatience, and hubris are often spoken of in unfavorable terms, and the idea of striving after them is a bit strange. But when you read the details of Wall’s philosophy, it makes a lot of sense – automating time-consuming tasks almost always pays off, so maybe laziness isn’t the evil we all thought it was. We all want to write smart software that knows when to skip unnecessary questions and use intelligent shortcuts and not brute force. And if people look at my code and have nothing but good things to say, that always feels good.

But as I thought about it, I realized that there are some aspects of these “virtues” that aren’t very attractive. Laziness might lead you to write time-saving code, but it also might prevent you from taking the time to learn something new. Impatience might help you write code that anticipates your needs, but it also might lead you to take dangerous shortcuts to save time. Hubris might help you write better code, but it might also prevent you from understanding why the new design your coworker is proposing could be better than yours. Especially in today’s world of tweets and soundbites, it’s dangerous to tell new developers that above all else, they need to be lazy, impatient, and excessively proud.

In light of this, I’d like to propose a new set of virtues in the spirit of Wall’s definitions:

  • Frugality: You have limited resources, especially time. Anything you can do that helps you maximize what you get out of your limited resources will allow you to get more done, faster.
  • Mindfulness: Every line of code you write (or, for that matter, don’t write) is a decision that affects you and everyone else who will use your software. Never make those decisions lightly, and always keep the user experience in mind. Mindful code can sometimes be hard to write, but it is always a joy to use.
  • Empathy: Maybe not today, maybe not tomorrow, maybe not five years from now; but the odds are good that someone in the future (maybe even yourself) is going to have to look at your code, figure out what it does, and make changes. Keep that future programmer in mind as you write your code and give her the information she needs to get her work done with as little friction as possible.

What do you think? Are Wall’s virtues fine, or do you like my recommendations? Are there other virtues that you think define what it means to be a great programmer?

Tommy Morgan

Tommy's been a software developer for seven years, and was working with a consulting firm before he joined the Treehouse team. Now he spends most of his time making Treehouse awesome - whether that's through support, fixing bugs, or adding new features to the site. Originally hailing from the state of South Carolina, Tommy's now located in Atlanta, Georgia.

Comments

Comments are closed.