21

We are currently developing a noncritical moving map type navcomm solution for our Atom based avionics device. The prototype has been done in Python/Qt, now I need to decide on a language to use for the "real" app. Ada or C/C++. I've been a C++ developer for 12 years and loathe the language. Ada seems promising, but I'm a little worried about it's supporting infrastructure, available libraries, developer availability and so on. Has anybody here been through this before? What are your conclusions?

user478389
  • 219
  • 2
  • 4
  • 7
    not sure if you'll ever see this comment, but which language did you decide to go with in the end and how'd it turn out? – Erik Kaplun Nov 13 '13 at 14:05
  • 5
    We ported some core parts of the application to C++ and kept the rest in Python. The company went bankrupt before going any further, unfortunately, despite a having great working cockpit device. We never got certified but managed to get it into a couple of cockpits by means of a minor change. That said, the language used was our smallest problem. Our biggest was the onslaught of Ipad and Android devices. – zeroc8 Jun 25 '14 at 06:20

7 Answers7

40

(A response from an actual Ada developer)

Contrary to prediction of its imminent demise, Ada is still going along just fine. The current version of the language is Ada 2005, and the updates for Ada 2012 are in the process of being finalized.

Ada continues to undergo modernization and incorporate new software engineering features and practices as they're developed by industry. (And the reverse is true as well--built-in concurrency has been a core Ada feature since 1983, and which is only now making its way into "modern" programming languages. :-)

Not every new feature and practice is going to be adopted by Ada, Ada's not going to morph into a functional language, for instance. But those features that enhance software productivity, reliability, and safety are incorporated in a way that is consistent with Ada's underlying architecture and intent.

It's certainly true that Ada is not a widely used programming language, but it does have a committed developer community, who are almost always more than willing to help out with questions, concerns, and advice for those developing projects and learning the language. Resources include here at StackOverflow (check the Ada tag), comp.lang.ada, even Reddit.

As for Ada developer availability, it's sort of a "Catch-22" situation. Because it's not widely used, there are fewer developers. Because there are fewer developers, companies shy away from using it in projects, and because it doesn't get used for projects, developers don't go looking for jobs in it.

I can attest, though, that there are many knowledgeable current and former Ada programmers who love working with the language, and would be particularly interested in doing so for an application of the type you're describing--if they knew about it. If you made the commitment to go with Ada, and then unapologetically advertised for Ada developers--on Monster, wherever else you advertise, tastefully on comp.lang.ada or Reddit--I think the availability of Ada developers would surprise you and many other skeptics.

Good luck with your project.

Community
  • 1
  • 1
Marc C
  • 8,664
  • 1
  • 24
  • 29
  • 2
    Thank you, I've just ordered "High Integrity Software using Spark" and I'm looking forward to working through it. – user478389 Oct 17 '10 at 15:46
  • 4
    You said in your question that this project isn't critical. That being so, you might find SPARK a bit over the top -- ordinary Ada, restricted perhaps by using a style guide or more automated tools such as AdaControl (http://adalog.pagesperso-orange.fr/adacontrol2.htm), should be at about the standard of MISRA C. http://www.adaworld.com/pdfs/misracandada.pdf has a rather inconclusive comparison. – Simon Wright Oct 17 '10 at 21:12
  • Thanks for the links, appreciated. – user478389 Oct 18 '10 at 05:45
  • 8
    One nit: While Ada is indeed not a functional language, I generally like to code it in an at least semi-functional style. Ada's way of dealing with strings and arrays strongly encourages that approach. – T.E.D. Oct 18 '10 at 12:43
  • @Marc C. -- Care to say anything about Ada 2012? Because you are a professional Ada developer, I would like your take. – MicroservicesOnDDD Mar 09 '20 at 22:34
14

I'll throw in my thoughts. For quick context: I'm currently working in Ada at one of those big companies (not Lockheed, but close enough). I am a C programmer at the core. (used C++,C#,and Java as well)

Ada is fine as a language. It has some nice things in it that you can't get in C/C++. For real-time critical systems, it is really nice. It takes a little getting used to, but it is easy enough to learn.

The downside is the language perception really. Most of the engineers I know that like and choose Ada are older (45+). Of those there are 2 types of programmers: the people who are actually really good at Ada and can do it right, and those that "know" Ada, but program it in a way/style representative of the 70s with older languages. Those good Ada programmers are highly valued here. For a small company to snatch them, I would think you would need to drop some major cash on them. They have 4-5 weeks vacation, 6 figure salaries (even in cheaper places to live) and all sorts of benefits. I hope this doesn't seem ageist, but it is just the way it is and something to think about as a small company. If you are in a major tech area like Dallas/Fort Worth, it might be ok. As you mentioned in your comments, most of the younger programmers aren't excited to learn Ada. It may pay well and be fine as a language, but it isn't nearly as marketable or exciting.

If I were starting a real-time embedded system project, I would just stick to C ( or C++ if you need the OO). For embedded I prefer C actually over C++ because in my experience, engineers try to force the embedded system into OO and use features because they are there, but your mileage may vary. With C or C++: 1. HUGE pool of programmers to choose from. 2. Every tool known to man has been made to work with it (many are free). 3. The resources online are endless.

It will allow you to just get to work. If you have access to some of the great debuggers using JTAG like Green Hills and VxWorks have, it really pushes the development speed along.

Awaken
  • 1,243
  • 2
  • 14
  • 26
13

Generally, there are some situations where I'd prefer C++. If your program has no concurrency in it whatsoever, and there are some C++ (not C but C++) libraries out there that would be really helpful to use, then C++ is probably the way to go.

However, if you will have concurrency as part of your system design, Ada is a huge win, as it supports it natively. One job I was on actually wrote an entirely portable real-time scheduler. We ported the entire simulation (> 100KSLOC) from vxWorks to a completely different vendor's Windows compiler in about 2 hours (all spent dealing with their different source code library systems).

Any library that has C linkage is perfectly available in Ada, although sometimes you might find yourself having to write bindings. That is a wee bit more work, but you will often find that others with the same libraries to deal with have done the work for you already. For instance I believe there are bindings to all of Win32 available. Still, making new ones is easy enough that I often find myself doing it just to provide an interface I like better.

Ada also has a couple of features that IMHO make it the premier language available for low-level system's programming. For example, the language allows you to specify exactly where and how big each field in a record is placed. This is vital in dealing with hardware or data communicated with other platforms. C++ currently only allows you to specify how big each field is. I'm dealing with that right now, and find it very frustrating.

The other killer feature for system's programming is that by default all arrays are bounds checked. You can turn it off for efficiency if you want, but the default is safety. IMHO this is what the default should be. In C++ if you want the safety, you have to go out of your way to code it up yourself, or use a safer class like std::vector (and only use the .at() method. How many times have you ever seen anyone do that? Never? Me either.)

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
  • Are there any tools for automating those boilerplate imports from C libs? – user478389 Oct 18 '10 at 17:53
  • 1
    It looks like Gnat comes with a biding generator http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Running-the-binding-generator.html . If you are using that compiler (purchased from ACT), that's probably your solution. If not, I'd avoid it for non-GPL work as their free versions probably make the bidings GPL. You could check out the other generators at http://www.adapower.com/index.php?Command=Class&ClassID=Utilities&Title=Ada+Utilities . As I said, I generally prefer to make my own though. If you do it mechanically, you end up with a routine with a C interface (yuck!) – T.E.D. Oct 18 '10 at 19:57
7

well part of the reason Ada isn't a blockbuster language (although from what I read, I'm actually interested in learning more) is because most programmers want quick and dirty. Just look at Microsoft Windows. They wrote the first versions in C (and a bit of x86 assembler). It took them 2 years to finish the whole monstrosity, and even now it's fragile. The ease in which viruses and worms can infiltrate the system is so bad that they're trying to steer away from the Win32 API in Windows 8. I'm sure that if the OS was written in Ada instead, it would be a lot more robust and a bunch more secure than it is now

5

There are pragma restrictions you can use to restrict certain features of the language too. Might be alternative to using spark.

Luke A. Guest
  • 556
  • 5
  • 8
4

If you write avionics Software, you usually cannot use many libs. Usually, you have a lot of coding rules that must be followed. E.g., recrusive functions or dynamic Memory allocation are forbidden. Therefore, libraries cause a lot of trouble when it comes to certification (e.g., DO-178C).

I prefer Ada over C++ as it stops you from doing many stupid coding errors. In principle you can do the same things with Ada and C++. However, you must define many coding rules to comply with certification requirements. And you have to demonstrate compliance with those rules.

You have the same with Ada but it is less work than with C++.

SHA2048
  • 73
  • 3
0

This is a good question.

I have written Ada professionally for many years, as well as C and C++. I enjoy both equally.

With any language, Ada or C/C++ it can be spaghettified.

You're more likely to find a cheap compiler and support with C/C++. Just apply discipline in your coding practices.

  • This does not provide an answer to the question. You can [search for similar questions](https://stackoverflow.com/search), or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, [ask a new question](//$SITEURL$/questions/ask), and include a link to this one to help provide context. See: [Ask questions, get answers, no distractions](https://stackoverflow.com/tour) – Alessio Jul 18 '19 at 17:16
  • No, this is an off-topic question that needs to be closed. – LittleBobbyTables - Au Revoir Jul 18 '19 at 19:22