For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
By Jack Ganssle
Jean LaBrosse, well known author of the uC/OS RTOS and several embedded books, tells me that no one can identify individual authors of his company's code. At first I thought he meant the programmers maintain anonymity from embarrassment at their spaghetti mess, the usual situation in this industry. Sure, we beat the stuff into submission and finally shipped a product, but we slink away from the source whose original beautiful structure devolves into anarchy and chaos.
No, Jean assured me the software is in fact beautiful. Consistently beautiful, in fact, so consistent because everyone writes code the same way. You can't identify the developer by coding style, simply because all use an identical style, one enforced by a comprehensive firmware standard. There's no variation in indentation, brace placement, or any of the other little differences that C encourages.
Everyone thinks they write pretty firmware. Without access to his company's stuff, I did read the source to Jean's operating system. Calling it pretty is like saying Leonardo seemed to know something about art. Meaning fairly jumps off the page, not buried into the obscure naming non-conventions and mishmash of wandering spacing that's more typical of this biz.
"Do you guys have the code police, then?" I asked, wondering how they enforced any sort of discipline on developers, a breed as notoriously difficult to herd as an army of camels. Turns out that it's mostly a matter of education. Many of their people are newbies recently out of college. Once exposed to this "correct-think" they accept it as apparently the industry-standard way to create programs.
I can't help but think, perhaps a bit cynically, that Jean is doing a great service to our business via this white lie. Surely these folks will move on to other outfits over their career. Some will succumb to the pressure to forgo any styles in the mania to ship now. Like evangelists, though, surely at least a few will espouse the benefits and bring others into the fold of standardized styles.
I've long believed in enforced coding standards. Yet in talking to thousands of developers over the years I've found only one or two companies that mandate such standards. Many do have such a standard; few conform.
Why such resistance? In large part it's due to our huge egos. We're like knights of old, girded for combat with the evil aggressor (the specification). Our tools are as crude as the knight's lance; usually nothing more than an editor and compiler. We win based on our ability to outwit, out-think, and out-perform the enemy. So our final product by its nature is a reflection of our abilities.
Using a standard, especially one as effective as Jean's, strips our software of all signs of individuality. The result is sterile code, absent of any sign of the author's creativity and superior intelligence. That sounds much like being just a coder in a vast software machine.
One wag turned the tables on me. He slyly made an analogy between coding and writing, and asked if authors (meaning me) should write equally sterile prose. Sputtering I protested that these were too very different things and, ah, style is in fact part of the nature of writing. Later I realized one difference between these words and firmware is the longevity of the code. My writing is but a trifle which will soon disappear into obscurity. Firmware, though, lasts for decades.
What do you think? Should we have enforced standards? If your company already has `em, why don't you use them?