As I am still off on my vacation, we have another guest blogger. This time it is Meador Inge, a member of the Mentor Graphics embedded software products engineering team, who, just like Scott last week, has chosen a subject that interests me greatly and, by coincidence, picks up on theme that I highlighted recently. -Colin
C is great, but C alone makes you a bad programmer. My introduction into computing started in a desktop-centric world. My first love was programming languages and I was fortunate enough to spend several years of my professional career working on compilers. As such, I came to value more the concepts that a programming language can offer rather than the instantiation of a particular concept in a particular programming language…
With this love of programming languages in mind my life took a very strange turn when I started to delve into embedded programming for my work. I know the C programming language quite well, which is good, because that is all we really use in my workplace. In fact that is all that several people I know in the embedded programming community ever use and ever want to use.
On top of that, you typically find embedded programmers using a stricter form of C. Sometimes I think I am living in some sort of programming bizzaro world where function calls (well, abstraction in general) are evil and macros and global variables are the bee’s knees. The mere utter of the word recursion would probably get me fired (which is sad, because this is probable one of the most fundamental CS skills).
I can’t imagine what would happen if I wanted to use a real programming language with concepts such as first-class functions, closures, duck typing, reflection, and garbage collection. It wouldn’t be pretty. And, yes, I do understand the resource constraints of an embedded environment. However, resource limitations should not limit you from exploring other options even if you can not apply those options.
Who knows, maybe a language with some of these features could be applied in an embedded context in some limited form. If I take the stance from the get-go that these features are bad things, then I am limiting my options.
I am probably going to have to live with the fact that more powerful programming languages will not be used in most embedded projects. I do, however, encourage folks to go out and learn other languages in their own time. Learning a new computer language is about learning new concepts, concepts that transcend any language alone.
C is great. C is something that every programmer should learn at one point in time. C alone may make you a wizard embedded programmer, but C alone will make you a bad programmer.