22

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?

  • 13
    Regarding 'old' - The latest revision of Ada is Ada 2012. – NWS Sep 18 '12 at 08:13
  • 1
    Why "instead"? Why not "alongside"? –  Jul 07 '16 at 11:35
  • 1
    C++ isn't old? Okay, okay, it's younger than ADA. By three years. :D – Jürgen A. Erhard Nov 06 '17 at 21:19
  • 2
    The "++" of C++ is as old as the oldest version of Ada (1983). The "C" part is more than a decade older! – Zerte Feb 11 '20 at 12:17
  • your teacher using Ada is the most important reason to pick Ada. The language (s)he prefers is the language (s)he is best able to teach you. – TamaMcGlinn Nov 02 '20 at 13:21
  • C++ for embedded system, and C# for Windows OS application, for Ada...here is an opinion (https://www.reddit.com/r/ProgrammingLanguages/comments/eyeonv/whatever_happened_to_the_language_ada/fggvgc1/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) – Cloud Cho Aug 24 '23 at 23:17

8 Answers8

34

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.)

Shark8
  • 4,095
  • 1
  • 17
  • 31
21

Peter Norvig's advice is probably relevant here:

When asked "what operating system should I use, Windows, Unix, or Mac?", my answer is usually: "use whatever your friends use." The advantage you get from learning from your friends will offset any intrinsic difference between OS, or between programming languages.

Teach Yourself Programming in Ten Years

The whole essay is a good read.

Incidentally, Ada was the first language that I learned. Learning Ada first had one major advantage: no one uses Ada, so I was forced to learn another language before doing anything else, and thereby gain perspective. One of the worst problems that beginning programmers can have is the belief that the way things are done in their first language is just The Way Things Are Done. Learning a new language is easy and immensely valuable.

Paul Stansifer
  • 1,239
  • 9
  • 10
12

If your teacher and most of your fellow students use Ada, it is probably best to go with Ada. It is a very good language, both for small and large scale programs. It is very readable and it protects you (to some degree) against a lot of common mistakes.

Ada is for software engineering. As darkestkhan said, it is not a "hack and hope for the best" language.

The advice of Paul Stansifer is very good: Learn several languages. Make sure you have a plenty of tools at your disposal - don't limit yourself to just one language. The perspective you gain from learning different languages is very valuable. There's definitely more than one way to skin a cat - take a look at Haskell for example. You'll gain a whole new perspective on how to solve problems.

Language syntax is the least of learning how to program. The hard part is learning how to model complex real world problems into something that makes sense in the very limited scope of a programming language. With its strong type system, tasking model, generics and solid tools for real-time and concurrent programming Ada is ideally suited to this job.

Since you're asking specifically about robotics, a good book to get might be "Building Parallel, Embedded, and Real-Time Applications with Ada" by John W. McCormick, Frank Singhoff and Jerome Hugues. It's a very good read.

http://www.cambridge.org/gb/knowledge/isbn/item5659578/?site_locale=en_GB

Thomas Løcke
  • 605
  • 4
  • 8
8

Ada is definitively worth it. In addition to 2 things written by Shark8 one has to add that almost all languages are focusing on the easiness of writing instead of reading (and most often you are going to write once and read many times). Also culture surrounding Ada is quite different from mainstream - focusing on correct working of programs and readability of source instead on "hack and make it work while counting on luck that no bugs will introduced".

As for age - oh, come on - C is even older. What is so important about the age of language itself? you should take look at what was put into Ada 83 first before you can even speak about age being issue (hint: mainstream languages started reaching feature set of Ada 83 in second half of 90s, and many features [notably subtypes] still aren't in mainstream). Beside newest Ada standard is from 2012 - if you can call that old then I don't know what is "new".

darkestkhan
  • 561
  • 4
  • 12
  • 1
    I have this idea that the upcoming C++20 standard may come close to Ada83 in terms of compile-time checking ability. However, the ability to generate or not generate a warning/error based on analysis of control flow is still missing and seems unlikely to ever be added. Further, the real problem with C++ is that you need to somehow disallow a plethora of unsafe 'legacy' constructs that were necessary prior to the newest standard. – TamaMcGlinn Nov 02 '20 at 13:27
4

C++ isn't exactly a spring chicken you know. I think it is all of one decade younger than Ada.

To make matters worse, both C++ and C# derive the core of their language from C, which is actually a decade older than Ada.

C was designed to make construction of compilers easier (not the programmer's job) back in the days when 16KB was a lot of RAM and hard drives were as big as industrial air conditioners. C++ basically started as good old late-60's C with OO features bolted on, and C# is essentially Microsoft's tweaks to C++ to make it more Java-like. At their core, C# and C++ are actually older than Ada.

There are a lot of hip new languages out there to learn (and at some point you should learn them). However, C++ and C# aren't them.

Community
  • 1
  • 1
T.E.D.
  • 44,016
  • 10
  • 73
  • 134
4

While Shark8 has some very good points about Ada as a language in general, the question was specifically about robotics. In this respect, I would say "don't bother". After more than 10 years of experience doing all sorts of robotics that range from Lego to state of the art robot arms and hands, I have never seen a robotic system that used Ada.

At the end of the day, robotics is hard. So hard that you are not going to tackle it all on your own. And that means leveraging lots of existing libraries and frameworks. And this means that you will be using their languages, interfaces, etc. Your robotic system will likely include a mountain of code, only a tiny fraction of which will be custom for your specific application. While it is possible to write your tiny part in Ada and do some wrapper or interface so it can play nice with the rest of the code. But I think you will find that is a lot of work with very little benefit.

When embarking on a new robotics project, i take a pragmatic approach. I look at the existing tools, libraries, and utilities and pick the one that best suits my needs. Then i use whatever language it does. And 95% of the time that is C++ or Python.

Ben
  • 1,038
  • 1
  • 19
  • 22
  • 8
    In this case, your own "pragmatic" logic would argue *for* Ada, as that is what the teacher and most of the other students are using. – T.E.D. Oct 10 '12 at 17:40
  • Yes, robotics is hard. That is actually a **good** reason to choose Ada, which has the preconditions and postconditions to implement Design-by-Contract (DBC, which [Bertrand Meyer pioneered](https://smile.amazon.com/s?i=stripbooks&rh=n%3A5%2Cp_66%3A0596515170&s=relevanceexprank&Adv-Srch-Books-Submit.x=16&Adv-Srch-Books-Submit.y=7)) and other tools to create correct code instead of quickly make a copy-and-paste coding mess. One of the people I follow, [Jack Ganssle, likes Ada](http://www.ganssle.com/video/episode9-ada-on-a-microcontroller.html) very much for embedded programming. – MicroservicesOnDDD Mar 09 '20 at 22:02
3

Ada is more engineering oriented than most other languages. Unlike ordinary programming languages, Ada provides a powerful capability for data engineering. That is, before an Ada developer even begins to develop algorithms, s/he designs (engineers) the data.

The Ada type model allows for the design of precise data. A trivial example is: type Channel is range 1..135;

where every instance of this integer data type belongs to that pre-constrained range of values. This greatly simplifies the algorithms that use such instances.

The underlying principle is that when the data is engineered with precision, the related algorithms will be less complicated. This feature is rarely found in other languages. In Ada it is common practice.

By supporting this notion of data engineering as a subset of the overall software engineering process, we can significantly reduce the Cyclomatic complexity of our overall software design.

My example is only a small taste of the full range of data engineering capabilities in Ada. However, it is that data engineering capability that makes it the ideal choice for safety-critical software, which is the niche where it is most commonly used now, in this 21st Century software environment.

2

It depends on what you want to do with this language. Lisp is even older than Ada and is widely used within artificial intelligence. Learn the language you want to, learn the language which is easy for you to learn and easy for you to understand it's concepts. Then you can go further and learn more languages.

akluth
  • 8,393
  • 5
  • 38
  • 42
  • Well, we are going to make some advanced robots which uses sensors, motors and other electronically components. Isnt it better to start with c# for example and learn it completely instead of learning a bit of ada and a bit from other languages? –  Sep 17 '12 at 15:54
  • 4
    @Alex90 - You aren't going to learn any language completely from one or two little school projects. – T.E.D. Oct 10 '12 at 17:41
  • "Learn learn the language which is easy for you to learn and easy for you to understand it's concepts." After you've done this, then for the rest of your career, learn one paradigm you don't know every year. Learning an easy language is good when starting out, but pushing through the harder languages will teach you the most, make you well rounded, and make you much more competitive -- you will be the more professional programmer, being dedicated to tackling the hard things and being well rounded and practicing continual investment in yourself. I recommend Factor and Lisp with its macros. – MicroservicesOnDDD Mar 09 '20 at 21:50