Last week, following the publication of this article on Builder.com, I was approached by an editor at Wiley & Sons (Makers of the “...For Dummies” books) in the UK about reviewing a draft of a book they are working on. I agreed, and the past two weeks have been fabulously interesting. I can't discuss the book yet (BELIEVE ME, when I can, I will) but I can say that it now comes in #2 on Robert's List of Books Every Programmer Should Read™, right behind Writing Secure Code, Second Edition.
So I'm working on my review, and it got me thinking about the difference between a mediocre programmer and a great one. What single factor makes a developer a master of their craft? Well, think back to the last piece of code you saw. How good do you think it was? If it was really good, what made it so? I consider great code to have the following characteristics:
- Well formatted
- Accurately commented
- Easy to understand
Wouldn't you agree? We'll get back to that in just a minute.
In this day in age, I think the term “programmer” is a misnomer. I prefer to think of it as “code writer”. If you think about it, while code is meant to be interpreted and compiled into instructions that operate a machine, code is meant to be read by humans. In performing code reviews, when questioning the coder about their style, I've often been told “I'm a programmer, not an English major.” But often times, great code shares the same qualities as a great book. Code that is well written is engaging and fun to read. It makes you want to dive in and learn every nuance, watching for little details that make it stand out. Great code spawns creativity and new ideas. Invention begets invention.
(In the following paragraph, I will make a broad generalization that may or may not apply to you. If it does not, do not take offense. I realize that this generalization does not apply to most of the other people that blog here, but bloggers here are not the only ones that read this stuff.)
Now, consider most programmers. The stereotypical programmer spends lots of time in front of computers. Often when they were younger, they had trouble interacting with others. Human behavior is frustrating and unpredictable, which is confusing to many people of intelligence. At one point or another, these people discover computers, and fall in love with their predictability. You tell it to do something, and more often than not, it does what you ask. They find comfort in this, and eventually become developers.
So why are many programmers mediocre? Because they are poor communicators. They write hodge-podge, unmanageable, unmaintainable code because they cannot organize their thoughts in a concise and understandable fashion. Their code does not simultaneously contain instruction and convey intent. This is readily apparent at all levels, from code to comments to documentation to UI. A lack of instruction and practice in communication and social interaction makes mediocre communicators mediocre (or bad) coders. I believe that this is the reason so many people are frustrated with computers today. Poor communication of intent at the lowest levels are intensified exponentially at the highest levels. if you see a program with a UI that is nonintuitive and horribly unnavigable, it's a safe bet that the code is in the same shape or worse. Is it any wonder that so many people are calling “social computing” the next big thing?
So what is the lesson here? If you want to be a Software Master Craftsman, you must consistently practice and refine your skills as a communicator. Coders SHOULD be more like English majors. Code should go through an edit process identical to the edit process for a literary work. All code should be printed and checked for clarity, consistency, and accuracy. It should convey intent quickly and with precision, and should be as engaging as any spy thriller or romance novel.
But hey, I'm preaching to the choir, right? Isn't that what we're doing here every day... refining our communications skills?