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. He founded two companies specializing in embedded systems. Contact him at jack@ganssle.com His website is www.ganssle.com.
Reader Feedback:
Language issues are so strongly linked with the compilers. Proponents of Ada argue that the compile time checking increases the chances that your application will work.
This is an immensly valuable feature which is also attributable to Pascal and Occam, both of which I dropped because there are few cost effective high quality compilers available for a wide range of targets. In my group we use C++ on 16 bit micros, and find it very effective. We do however avoid some of the more heavyweight features such as multiple inheritance to help with code maintainance. I have also written a Forth interpreter myself for a DSP, but came to the conclusion that Forth is not appropriate for large applications.
Oliver Sedlacek
System design manager
Bio-Rad Miocroscience Ltd
As a technical clarification, Ada is not an acronym but the name of the first computer programmer Augusta Ada Byron.
The Ada language was developed specifically for large embedded, real-time systems. The syntax of this "huge and complex beast" as you put it was designed to make the source code readable and easily maintainable. It is the first (only?) internationally standardized object oriented programming language. The Ada language was built on the principles of enforcing good software engineering, and it is this last point I believe that sends lesser programmers running back to their "C" code comfort zones. A particularly telling article concerning the effectiveness of embedded programming in "C" versus Ada was written by John McCormick of the University of Northern Iowa. Briefly, he found that in teaching an undergraduate real-time systems course over many years, students' success rate developing control code went from 0% to nearly 50% when the language used was changed from "C" to Ada.
While "C" may have a place in application programming - it is quick to write, everyone knows it, and the compilers are very forgiving - the language soon becomes unsuitable as the size of the application grows. I must agree, and your poll illustrates that, given Ada's design for support of embedded real-time systems, we do not in general pick the most appropriate language for a particular application. The only place C++ should be embedded is in a Windows application.
Personally, I think Ada is the only language ever written designed to reduce programming errors.... what a novel concept! And, the compilers are essentially perfect due to the validation process. Brilliant ideas. Yet for some reason it has almost zero market share in the embedded space. Why?
Karl Woelfer
Software Architect, Embedded Systems
Heartstream Philips
I guess these new eXtreme programmers never used Forth and so don't know the heady eXperience of working in a moldable object type language where you have the ability to modify the compiler till it fits the problem.
As far as the slow vanishing of Forth, there are a number of good reasons -- quite a few political within the so-called Forth standards groups. But that is another story, perhaps best titled "How to ruin a company with a language guru."
Note: I have seen some wonderful Forth projects. The great Canon Cat by Jef Raskin and Information Appliance, Inc. crammed a massive amount of code in a small space with a very efficient tokenized Forth.
Today there is a very sweet object oriented Forth called Mops for the PowerPC and Win32Forth Windows. Both are free and available on a server, taygeta.com. The docs and tutorial for Mops are very good and worth reading just to see what the minority is up to. The object model is better and more intuitive than c++ by a long shot.
Charlie Springer
(1) Availability -- Is the language available for this micro? If it isn't, forget about it. The company I work for uses the (extinct) National Semiconductor HPC16083. There is an almost-ANSI C compiler, and an assembler. At my previous job, the chief engineer learned on an 8085, so guess what we used? There was assembler. No C, no BASIC, no Forth, no nothing.
(2) Ease of use -- Can I just run the language, and get usable output, or do I need to recompile the source to make it work on my machine, or otherwise fiddle with it? -- We dropped a "more advanced" C compiler because it could not work with code written with the previous version.
(3) How easy is this language to learn? The big problem I have with Forth is that once you get past "DUP-DROP-ROT" and the RPN, you are on your own, basically.
(4) Ease of Application -- I am familiar with Assembler(s), C, BASIC, and Pascal. When I needed a program to monitor RS232 communications, Pascal couldn't do it, and with C I'd need to write the low-level interrupt drivers myself (Not to mention debugging them!). With BASIC, I just OPENed the COM port, and was up and running in less than half a day. However, C is good for writing character-stream filters.
One of the difficulties with Forth is lack of documentation -- not in the code people have written themselves, but documentation that explains what all the words mean. Type in "words" and the vocabulary zooms by on your screen. Try to find out how to (1) Read in a string from the user, (2) Manipulate said string, and (3) Show that string in a specific location on the screen. There are dozens (hundreds?) of books available on C, BASIC, Pascal, all written in a variety of styles and for a variety of audiences. There are very few written about Forth, and how to use it. When I nosed around the Forth sites two weeks ago, there were articles available, but they were almost all written by pros on subjects I'm not interested in. (I'm still trying to find out how to read in that string...).
Another difficulty is interoperability. I can write a program with my favorite editor, and load it into / compile it with C, Pascal, or BASIC. With Forth, I have to struggle to learn someone else's idea (often counter-intuitive) of how an editor (seemingly based on EDLIN or VI) should work.
Oh, well, enough steam.
Rich Ries
Ada95 is positively silph-like and at least you can get compliant compilers for it!
I've also found it that the GNAT compiler at least produces more efficient code than either VS++ or Borland C++ - though these are obviously not the domain your concerned with.
Check out www.cw360.com for their quarterly job surveys and you'll find Ada is doing surprising well over the last year...
Cheers!
Martin Dowie
Lead Software Engineer
Avionic Systems, BAE SYSTEMS, Edinburgh
Jack Replies: Agreed. The very best thing about Ada, IMO, is that it *works*. Compilers must pass quite an exhaustive test to be legit. And, I think that C++ is a huge unwieldy beast. Despite some quite cool features, and the nice things that come with OOP, I think C++ is too complex, too deep. Java's strength is that it offers much of the OOPy stuff in a more useable context. Predictions are tough, but I expect that when Java matures it will seriously eat into C++'s market share..
Jack Maynard
Title: staff software architect
ENSCO
Jack Replies: I've always thought that all languages need the same sort of certification that Ada has. Everyone I know has fought compiler bugs with C and C++. That doesn't happen with Ada.
For example:
i made a code size comparision
between Eiffel and C++. Although
Eiffel is a real high level language
with garbage collector, the result was
only 20% code size compared to C++.
But instead the winner is Embedded C++,
a completely crippled language
(no multiple inheritance and no
interfaces, no templates, no exceptions)
that also results in 20% code size.
Another example: can you show me any C-Compiler that can generate code to check array boundaries at run time? 30 years old pascal compilers can do so. Do you think this is progress? New folks fresh from university use what they are told it is "standard", and they don't ask questions.
Every sane programmer avoids using C++ if possible. For me this is the only explanation, why nearly all free software is n o t written in C++. But C++ is widely used in commercial products. Why? Ask the management. At the moment everyone wants to have embedded Java. Exactly they want a cheap system with no power, no memory running a java byte code interpreter with java runtime environment and Internet. Do you think they know that they are talking about?
In a few years you will see a lot of embedded java machines, because management wants them. Then all students will learn Java and in ten years java is standard and no one will ask why. If you don't believe me, try to convince your management to use something different than C/C++ or Java. It's all so immature, i have a headache...
Ingo Knopp
I think you overlooked one big force in language choice: what students are taught in the universities. The languages you learn as an undergraduate are probably going to be the languages you use once you get out of university. Learning new languages is quite rare. And what languages are taught? Ada: very rarely. C and C++: all over the place. Java: all over the place.
So the java people have understood the importance of academic mindshare by giving away development tools... and that will pay off in a few years with more programmers familiar with Java being forced to do embedded projects. Good times are coming for vendors of "unnecessarily powerful" hardware.
Fepp
JACK REPLIES: Yeah, I do agree. Languages come into their own when new folks come into the market who have grown up with them. That means we old farts must die before a new language succeeds...