Be Virtuous

The Three Virtues of a Programmer

  1. Laziness – The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labour-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.
  2. 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.
  3. 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.
(Source: http://en.wikipedia.org/wiki/Larry_Wall#Virtues_of_a_programmer)
 

When you write code, it should be a joy to write. When you write code, it should be code that you or someone else will enjoy working on later. The less effort you spend on solving your problem makes the problem more enjoyable to solve. The more elegantly you solve the problem makes the problem more enjoyable to solve. Every time you solve a problem, you should be developing the tools to make solving related problems easier in the future. You maximize future joy by creating solutions without creating new problems.

Avoid False Virtue

  1. False Laziness – We’ve all fallen into the trap of using cut-and-paste when we should have defined a higher-level abstraction, if only just a loop or a subroutine.
  2. False Impatience – To be sure, some folks have gone to the opposite extreme of defining ever-growing mounds of higher-level abstractions when they should have used cut-and-paste.
  3. False Hubris – Caught somewhere in the middle are the people who have a balanced view of how much abstraction is good, but who jump the gun on writing their own abstractions when they should be reusing existing code.
(Source: Programming Perl, Chapter 10 (http://tinyurl.com/falsevirtue))