“We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.” — Larry Wall
Good programmers are like Judo masters — they both practice the art of maximizing efficiency.
Larry Wall (the founder of Perl) defined laziness as:
“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.”
He’s not talking about programmers with bad work ethic here. No, he’s talking about expert programmers who know how to make every keystroke count.
From Wikipedia’s article on Judo:
“The word “judo” shares the same root ideogram as “jujutsu”: “jū” (柔, “jū”?), which may mean “gentleness”, “softness”, “suppleness”, and even “easy”, depending on its context. Such attempts to translate jū are deceptive, however. The use of jū in each of these words is an explicit reference to the martial arts principle of the “soft method” (柔法, jūhō?). The soft method is characterized by the indirect application of force to defeat an opponent. More specifically, it is the principle of using one’s opponent’s strength against him and adapting well to changing circumstances. For example, if the attacker was to push against his opponent he would find his opponent stepping to the side and allowing his momentum (often with the aid of a foot to trip him up) to throw him forwards (the inverse being true for pulling.) Kano saw jujutsu as a disconnected bag of tricks, and sought to unify it according to a principle, which he found in the notion of “maximum efficiency”. Jujutsu techniques that relied solely on superior strength were discarded or adapted in favour of those that involved redirecting the opponent’s force, off-balancing the opponent, or making use of superior leverage.
Master software developers have a strong command over their tools. One of the most important tips from The Pragmatic Programmer is to Use a Single Editor Well:
“The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.”
They’re also fluent in multiple programming languages and understand how to choose the best one for the job. When more than one language may be appropriate, they choose the most expressive language available.
Consider The FizzBuzz Problem (a simple “weed-out” problem given to interview candidates) which has been stated as:
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
There are many general purpose programming languages that could be used to solve this problem. Programmers have invented a game called Code Golf. The rules are simple — solve a problem with the shortest possible program.
Here’s a list of scores which demonstrates how various languages stack up to solve the FizzBuzz problem. We see Ruby and Python coming in at 56 characters each. Compare that with C# (123) and Java (130) and you start to get the idea here. If you were the policy carrier responsible for insuring these programmers against carpal-tunnel syndrome, who would you rather cover?
Tags: codegolf, efficiency, fizzbuzz, judo, larry wall, laziness, perl, pragmatic programmer, programming, python, ruby, virtues
December 24, 2008 at 8:44 pm |
Efficiency might look like laziness to the untrained eye. Yet the reverse must be about equally true! So I feel it’s counterproductive to suggest a novice programmer would know the difference well enough to be coaching using such poisonous terms.
What’s wrong with saying “A good programmer acts with clarity, and knows how to make the best use of their time and the time of others, choosing approaches that balance current needs with future?” Studying good industrial or product design serves the mind much better than platitudes about intentionally seeking paths of least resistance:
Then again, I’m not too surprised Larry Wall would be promoting “laziness, impatience, and hubris”. Those do seem to me the founding premises of many people building large systems out of the likes of Perl and PHP! 😛
FizzBuzz strikes me as a bad in-person interview question for anyone you have in front of you at a white board in your office. If someone cannot solve this (and you put out feelers for a programmer with claimed proficiency in *any* programming language) then your HR process is fundamentally broken. As this post prescribes, you should take the long-term “lazy” view and figure out how to screen better, e.g. with Brainbench:
http://www.brainbench.com/xml/bb/common/testcenter/freetests.xml
…I’ll now leave the disproof of how # of characters needed to solve a problem this pathologically trivial indicate programming language viability on the whole as an exercise to the reader. 🙂 If I want to print the sum of two numbers, a calculator watch doesn’t even require me to say “print()”, but good luck writing a device driver in its dialect!
Regards,
Fork