Is it worth to learn Ada instead of another languages [c++, c#]?

user1012032 picture user1012032 · Sep 17, 2012 · Viewed 22k times · Source

If Im going to make robots, which language do you recommend me? In our university we can choose between several languages. Most of the students are choosing Ada just because our teacher uses it.

After some research I found out that ada is old. What are your thoughts? Is is worth to learn it?

Answer

Shark8 picture Shark8 · Sep 18, 2012

Yes. Very much so, in my opinion.

Ada is very good in two points that are often overlooked in other programming languages:

  • The generic system: packages, functions, and procedures can all be generic. This works together particularly well for ingraining the DRY [Don't Repeat Yourself] principle. Yes, you can go overboard on generics, but the thing I've seen in (other language) projects was that cut-and-paste programming seems to be more common. [and that just introduces multiple points-of-failure if a bug needs fixed on that spot of code.]
  • Native multitasking. One of the great things about a language-level tasking feature is that multithreading doesn't feel 'tacked on' and isn't an unwieldy extension but integrated into the language.

That said, there's other good reasons to learn/use Ada. One is the picky compiler, by being so picky it forces you to start to think in ways that naturally reduce programming errors. (Like the prohibition on and and or in the same conditional.)

Another is the concept of subtypes; subtypes are the opposite from objects in OOP, instead of branching out the further derevitions you go, you narrow the type (it's acceptable values) the more you get away from the base type. {Think of it in terms of proper sets; Integer is your base type, Natural are your non-negative Integers, and Positive are your positive-integers... and with Ada 2012, you can have interesting exclusions on your subtypes, say Primes which are subtypes of Positives (sorry for being a bit vague on that last point; I'm still learning the 2012 stuff).}

With Ada 2012, you can also have pre- and post-conditions on your subprograms; this alone can make your libraries more stable. (As can null-excluding pointers.)