Monday, October 13, 2008

Dogma in Programming

One of the more harmful trends the programming industry is the tendency of programmers to create dogma to define good programming. I believe there is a basic laziness in people encouraging us to boil down a chapter of thought provoking rational into a bumper sticker or a tag line: "Goto Considered Harmful". In addition to laziness, I think this trend is enforced by a system that ensures that most programmers start with a solid foundation in math, science or engineering - fields of study with provable right and wrong answers to just about everything. I think this conflict leaves a lot of developers in limbo, unable to make forward progress because they will never accept programming as a craft.

Good resources for programmers are everywhere. Books like Effective Java, The Pragmatic Programmer and Clean Code seem like an echo chamber of good programming practices. With the growing popularity of Agile methodologies and test driven development, there is no shortage of resources on how to write good code... from the concept to delivery. But no matter how careful an author is when writing their advice, it will always be taken out of context. I suspect that is the case more in our industry than most due to the relative immaturity of our craft.

Everyone knows a programmer who quotes books, and doesn't understand the meaning behind them. Someone who insists on consistency at the cost of maintainability (hmmm.. why did I want consistency again?). Someone who quotes 'You aren't going to need it' back to a customer advocate who is asking for a new feature. Sometimes context is everything. Sometimes concepts are more important than rules.

Another common type of programmer I've seen a lot will read a great book like Agile Principles and try to turn its practices into laws. Once they identify two seeming conflicting 'laws' or find a rule that conflicts with the reality of their workplace, they stop in their tracks... unable to move forward. "This stuff doesn't work! It doesn't deal with this situation!" Of course all the principles still stand and would apply with a little flexibility, but doing so would require admitting that programmers are more craftsmen than engineers.

Obviously the entire industry doesn't work this way, and the abilities of the typical developer vary greatly between regions, industries and even employers. From time to time, I catch even catch myself over-generalizing things1. At those times I like to recite my rule: "Dogma in programming is always bad".2

1 Several times, just while writing this
2 Yes, it's meant to be ironic. Its a play on one of my favorite quotes: "All extremists should be shot"