A car magazine once declared that a car has "character" if it takes 15 minutes to explain its idiosyncrasies before it can be loaned to a friend. By that standard, every piece of software has character -- all too often, right of the box.
Most programming "peculiarities" are unique to a particular context, rendering them highly obscure. Websites that deliver XML data, for example, may not have been coded to tell the browser to expect XML data, causing all functions to fall apart until the correct value fills the field.
[ Also on InfoWorld: Find out which 7 programming languages are on the rise in today's enterprise. | Keep up on key application development insights with the Fatal Exception blog and Developer World newsletter. ]
But certain programming practices send the majority of developers reaching for their hair upon opening a file that has been exhibiting too much "character." Spend some time in a bar near any tech company, and you'll hear the howls: Why did the programmer use that antiquated structure? Where was the mechanism for defending against attacks from the Web? Wasn't any thought given to what a noob would do with the program?
Creatures of habit, we developers seem locked into certain failure modes that can't be avoided, such is the frequency with which we fall prey to a particular poor programming practice.
Below you will find the most common programming pitfalls, each of which is accompanied by its opposing pair, lending further proof that programming may in fact be transforming into an art -- one that requires a skilled hand and a creative mind to achieve a happy medium between problematic extremes.
Programming mistake No. 2: Overcommitting to detailsOn the flip side, overly buttoned-up software can slow to a crawl. Checking a few null pointers may not make much difference, but some software is written to be like an obsessive-compulsive who must check that the doors are locked again and again so that sleep never comes.
Programming mistake No. 3: Not simplifying controlToo often, developers invite disaster by not simplifying control over tasks in their code.
Subelsky, as you may surmise, is a Ruby on Rails programmer. The framework encourages lean code by assuming most of the structure of the software will fall into well-known patterns, a philosophy that Rails programmers often summarize as "convention not configuration." The software assumes that if someone creates an object of type Name with two fields first and last, then it should immediately create a database table called Name with two columns, first and last. The names are specified in only one place, avoiding any problems that might come if someone fails to keep all of the layers of configuration in sync.
Programming mistake No. 5: Trusting the clientMany of the worst security bugs appear when developers assume the client device will do the right thing. For example, code written to run in a browser can be rewritten by the browser to execute any arbitrary action. If the developer doesn't double-check all of the data coming back, anything can go wrong.
Programming mistake No. 6: Not trusting the client enoughSometimes too much security can lead paradoxically to gaping holes. Just a few days ago, I was told that the way to solve a problem with a particular piece of software was just to "chmod 777" the directory and everything inside it. Too much security ended up gumming up the works, leaving developers to loosen strictures just to keep processes running.
My book, "Translucent Databases," describes a number of ways that databases can store less information while providing the same services. In some cases, the solutions will work while storing nothing readable.
Programming mistake No. 8: Reinventing the wheelThen again, making your own yogurt, slaughtering your own pigs, and writing your own libraries just because you think you know a better way to code can come back to haunt you.
Programming mistake No. 9: Opening up too much to the userProgrammers love to be able to access variables and tweak many parts of a piece of software, but most users can't begin to even imagine how to do it.
Programming mistake No. 10: Overdetermining the user experienceSome developers decide to avoid the trouble of too many features by offering exactly one solution. Gmail is famous for offering only a few options that the developers love. You don't have folders, but you can tag or label mail with words, a feature that developers argue is even more powerful.