There are plenty of mediocre and even downright bad computer programmers out there. So what is it that makes a good programmer? Is it the ability to solve difficult problems, or to write fancy code that uses all the bells and whistles of a language, or to write a program in the fewest possible lines of code, or just turning out something that works in the shortest possible time?
Perhaps there is a flavour of all those ingredients in a good programmer, but for me, this one nugget of wisdom encapsulates what makes a good programmer and, by implication, drives a developer towards many best practices:
Programming is the art of telling another human what one wants the computer to do.
– Donald Knuth
The implications of that statement are really quite profound. Many, perhaps most, programmers view code as something that only the computer needs to understand. It certainly needs to be machine readable, but it should be much more. Code should clearly express intent to other human beings, it should be simple to understand, well laid out, in fact much more like a book than strange symbolic language intended only for a compiler. I have always believed this, but the book metaphor was recently crystalized for my by Cory House. According to House,
You’re an author! […] An author is someone who practices writing as a profession. Developers write all day [and] each line of code we write is likely to be read 10 or more times by humans during its lifetime. […] Great authors are known for writing books that tell a clear, compelling story. They use tools like chapters, headings, and paragraphs to clearly organize their thoughts and painlessly guide their reader. Developers work in a very similar system, but simply use different jargon of namespaces, classes, and methods.
– Cory House, http://blog.pluralsight.com/7-reasons-clean-code-matters
I highly recommend Cory House’s presentation of Clean Code – Writing Code for Humans at Pluralsight.com.