Is the correct form “a RTOS” or “an RTOS?” Michael Barr, coauthor of The Embedded Systems Dictionary , and I had an email discussion about this question of world-shattering importance recently. My initial reaction was to pronounce the two alternatives out loud and see which felt best.
Then I stopped, mildly ashamed of myself. The English language has rules. We don't make grammatical decisions based on whim or personal preference. The Index to Grammar and Writing tells how to form an article that precedes an acronym or abbreviation:
Do we say an FBI agent or a FBI agent? Although “F” is obviously a consonant and we would precede any word that begins with “F” with “a,” we precede FBI with “an” because the first sound we make when we say FBI is not an “f-sound,” it is an “eff-sound.” Thus we say we're going to a PTO meeting where an NCO will address us. We say we saw a UFO because, although the abbreviation begins with a 'U,” we pronounce the “U” as if it were spelled “yoo.” Whether we say an URL or a URL depends on whether we pronounce it as “earl” or as “u*r*l.”
Since the initial “R” in “RTOS” has a soft “arr” sound, we should use the construct “an RTOS.”
A subtle point, perhaps, yet it profoundly illustrates that power of a well-defined language. The Oxford English Dictionary (which in its latest print edition doesn't define the word “embedded” in any fashion we developers would acknowledge) defines and traces the etymology of over 500,000 words. Every word we use has a precise meaning. The Chicago Manual of Style provides 956 pages of rules that define how we're allowed to combine these half million words.
These codified rules let us write and converse effectively, though God knows unauthorized dialects thwart that easy communications. Sure, we're allowed to cheat the rules occasionally. Skip nouns. And verbs. But I wince when my daughter says “me and my friends.”
Few novelists would complain that the rules of grammar restrict their creativity. I'd argue that the OED and Chicago Manual of Style give us a framework that lets us be incredibly expressive. They're the resistors and ICs that populate a PCB that might implement any of a million different designs.
Yet software people rebel against similar standards. In my travels around the embedded world, it's rare to find a company that religiously uses any sort of standard to define how they write C or C++ code. As a result the software ranges from beautiful to simply unreadable. When there are no rules, chaos reigns. The Obfuscated C Code Contest proves that software can be written in such a fashion that no one can possibly understand how the program works. Our only weapon in the war against unreadable code is the software standard. Why don't you use one?
(And no, I'm not going to give you the URL of the Obfuscated Code Contest. These people are code terrorists and should be hunted down and shot like the animals they are).
Jack G. Ganssle is a lecturer and consultant on embedded development issues. He conducts seminars on embedded systems and helps companies with their embedded challenges. Contact him at . His website is .
I once read something that goes like this, “From cave paintings on walls toour modern languages, we didn't get anything like Shakespeare until we decided to limitourselves to 26 letters and 10 numbers, plus or minus some punctuation.”
– Charles Schell
Jack you make a good point. I'm a hardware guy who knows enough aboutsoftware to jump in and help the software guys out when crunch time comes, provided theyhaven't made their code so secret no one can figure it out. Embedded systems are alousy place to exercise every possible feature of the language you are using in everyobscure manner you can think of. You will just wind up with a big maintenance nightmareif you do, or a product that never ships. There is beauty in simplicity, andstraightforwardness, and one of the big things a standard can do is help limitunnecessary complexity, and obscurity.
– Bill Murray
Rules of programming languages are defined by international committees andare enforced by compilers.
Beyond that, the only useful rule is to use some common sense when naming functions andvariables.
A majority of what we see in “Coding Standard” binders is of dubious value, is highlysubjective, and is often created by those who have an urge to display the status ofbeing a manager.
Anyone complaining about other people's code less readable than his or hers should useone of the many avilable tools to reformat the code using a macro defined to his or herown rules, if such “rules” can be unambiguously specified at all.
– David J. Liu
You start the “an RTOS” discussion by trying to figure-out the answer basedon pronunciation. Then you decide to check the rules, only to find that the RULE ISBASED ON PRONUNCIATION.
The point? The “rules” of language can only be recorded. They are not legislated. Like it or not, proper usage is ultimately determined by practical usage.
If a grammar text (or a coding guideline) is out of sync with the actual usage of alanguage, then ultimately the text (or guideline) is wrong.
With that in mind, pre-ordaining my bracing style or blindly banning “goto”, etc. isjust pedantic drivel.
– John W. Linville
There is one benefit of the Obfuscated Code Contest. Examples from it havehelped me convince co-workers (and managers) who were impeeding the establishment of acoding standard as unnecessary that it wasn't a bad idea. However you could argue thatthe tactic I used was akin to blackmail. “So you wouldn't mind if I checked in code likethis….” (Which I could in good conscience never bring my self to do, but it is aconvincing argument none the less)
– Paul Glaubitz
I enjoyed your article on coding standards and the English language. Iappreciate your wincing when your daughter says, “me and my friends”. Butyou should only wince about half the time. If she says, “Me and my friendsare going to the mall with Stacey”, that's a “winceable” abuse of thelanguage. But if she says, “Stacey is going to the mall with me and myfriends” she's spot on. It's so common to hear “Stacey is going to the mallwith my friends and I” that we think it's correct. I'll be forever gratefulto Mrs. Richardson, who taught English Grammar Mastery in high school. Shelooked a bit like a bulldog and was about as friendly, but that woman knewhow to use the language correctly and well.
Regarding coding standards, I couldn't agree more that it's insane not touse one. I'm an analog hardware guy who, some years ago, was dragged(kicking and screaming) into embedded hardware and firmware design. I haveto admit I've developed a certain fondness for the dark side, but since Ihave no formal training in software development and design my coding styleleft much to be desired. It was not until I started working at Cirrus thatI saw my first coding standard. One of my co-workers (a real softwareprofessional) put together the one we use here. Between following thestandard and the many conversations I have with him, I've come to value thedesign and coding clarity that adherence to the standard brings. Whatlittle extra time coding to a standard may take is more than made up for inreadability and maintainability of the code base.
I'm not sure I agree that rules and semantics are the “resistors and ICs thatpopulate a PCB.” That's really a metaphor for the English (or whichever language) wordsthemselves,or, in the case of software, the keywords and operators. Grammar rules are moreanalogous to PCB design rules, though maybe there is one set for CMOS, another for ECL,and so on.
As I write code, I might choose to follow rules that make the source code:
1. highly self-descriptive, e.g. with lengthy labels
2. highly modular to correlate with the spec
3. highly modular to correlate with an object design
4. highly portable
5. compile into something fast
6. compile into something small
7. compile more quickly
8. consume less disk space
9. contain all the lyrics from “Dark Side of the Moon”
10. any combination or none of the above
Yeah, we probably don't worry so much about 7 or 8 any more. But I even knew one guywho I'm convinced wrote to minimize line count. Since he was reluctant to run Windows,he wanted to cram the most source possible on his 25-line screen.
Any of the above strategies may come at the expense of readability andmaintainability, and several come at the expense of the others. It depends on thedeveloper's past experiences, and on what seems most important at the time.
Often I include tons of detail concerning a part of the design that was unintuitiveor difficult to understand, only to be confounded years later by a completely differentpart. Other times I adopt a strict convention for tab stops, and sure enough, anotherdeveloper adds to the code using his equally strict, and quite different, tab stops.
Of course I don't mean to imply there's no place for some good practices. Rulesthat are not carefully crafted, though, rob engineers of valuable tools. A classicexample is how “goto” can be dangerous, so it gets outlawed. Sure, maybe it's likeplaying with dynamite, but then again sometimes dynamite is exactly the tool that'srequired, and the substitutes create more problems than they solve.
Currently I'm writing in assembly. Of course what makes that such fun is that theassembler provides spell checking, but there is no such thing as a grammar checker. Sojust as a spell checker is fine with, “Me and my friends went to the maul,” so theassembler silently accepts, “MOV A,INDEX XOR A,A”
Thanks for keeping us thinking!
– David M. Tomer
Keep in mind that your instinct to pronounce each was dead on (and gave theright answer). How do we develop that same instinct to write code well and view poorlywritten code as ugly? If everyone was forced to “speak” with a variety of others daily(like spoken/written language), or be corrected by our mothers when we were young (:-)),maybe we'd see more compliance to standards. And, if we could agree on the standardsthemselves…
– Jim Bell
Coding standards are important enough to me that one of my hiring questionsis, “How do you feel about coding standards?”
We all need to get along. Its time the cowboys learned other people need to use theirstuff – or do they not want to be clear because then someone would see they were merelypretending to be smart?
– Jeff Geisler
I don't think that everyone in the world should have to write code in thesame way, but it's highly important that groups collaborating on code should pick acommon standard (doesn't matter what — just pick one!). It makes reading andunderstanding easier on all in involved. (If you don't do code reviews, then maybe it'snot so important…)
I disagree with those that say let everyone do their own thing and use re-formatters andbeautifiers to fix it later. These play havoc with source code configuration managementtools (“What's the delta between Ver 5.8.3 and 5.8.4…Oh crap! Every line changed…”)
– James Thayer
I'd love it if we used coding conventions here. The main problem is we didn't try to at the start.Since then we've tried for new code but the old stuff never gets cleaned up.
p.s. And I wouldn't called participants in the Obfuscated Code Contest “code terrorists.” I think it's more aptto call them satirists, because they're pointing out exactly how things *shouldn't* be.
I agree that coding standards are important, but they are a few rungs down on the “firmware hierarchyof needs”. I would rate basic software engineering concepts like modular programming, cohesion, and couplingahead of the “curly brace war”. I would rather have well structured code with marginal style, than a handful ofhigh coupled C files that follow a coding standard.
– Mike T