The Three Virtues of a Programmer
- 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.
- 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.
- 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.
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
- 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.
- 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.
- 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.