Learning a New Programming Language: Ada

By | July 23, 2012

Posts in this series so far:

  1. Installing GNAT
  2. Basics of Ada — functions, procedures, packages
  3. Child Packages
  4. Enumerated Types
  5. Records — also a short bit on naming and case statements
  6. Type Conversions
  7. Using SDL — GNAT 2013
  8. OpenGL Bindings — comparing different libraries & bindings
  9. “make install” Procedure
  10. Debian packages
  11. OpenGL GUI Toolkit Design — polymorphism
  12. GUI Library: Top-level package — basic linked list implementation
  13. …and more to come!

Ada is a high-level programming language built for the US Department of Defense intended for mission-critical systems. Whenever you need a piece of code that can’t fail (ie. for controlling a plane), it’s the language you should look to.

Over the past few years, I have been primarily a C programmer. The reason is simple — C is a simple language. It’s easy to learn, fast and does what you tell it to do. If humans were perfect and don’t screw up, then that would be a perfect programming language. Unfortunately, that’s not the case. It’s estimated that every program above the really basic ones (ie. the “hello world” programs) contain bugs with exponentially more bugs for larger and more complex programs. Despite the availability of debuggers and other tools to track down mistakes, C is simply not designed to be easy to track down bugs. Its syntax, though easy to write, is not nearly as easy to read. After wasting many hours finding and resolving simple errors like parameter switching, it was time to take a look at a new language. After a quick look around, Ada seemed to fit the bill. No, this does not mean that I’m giving up C — there are certain programs that C is much better suited for. But it’s not well-suited for all programs, and that’s where the need for learning a new language comes in.

I will be working off the Ada Programming Wikibook which appears to be the most comprehensive Ada resource on the web and will be creating an Ada version of my library of astronomical calculations. Along each step of the way, I will update my progress with common mistakes I hope others will avoid after reading.

Well, it’s time for me to get started. Hopefully, I’ll have something to report shortly.

This post will be updated with links to all future posts in this series.

17 thoughts on “Learning a New Programming Language: Ada

  1. Troy

    Just arrived here from reddit, and thought I’d leave a comment. Reading about some of the peculiarities of Ada is pretty interesting, especially since I’ve written VHDL code in the past. VHDL is a language used for specifying digital circuit designs, and the syntax is based on Ada. The syntax can be a bit unusual, given that there’s a combination of programming (used for macro type functionality) and wiring up signals, but it gets the job done.

    1. North Post author

      It is certainly different from what I’m used to — coming from a background of C-like languages, learning it is an experience not unlike learning programming for the first time with all the new topics and methods of doings things.

  2. mark

    pls add links to the blog entries from this main blog

    so that people can “read it like an online book”

    thank you for reading and considering

    1. North Post author

      I have links at the top of the page. They were at the bottom but I figured that it might be easier to navigate from section to section if the links were placed at the top so that it isn’t necessary to scroll down. I’ll add a note to the bottom saying that the links are at the top. Or would it be better if I added a copy back to the bottom?

      1. North Post author

        I ended up just copying the links to the bottom so that scrolling up after reading isn’t necessary.

  3. Ben

    Hey, ADA, cool!

    My Uni in France actually used ADA as the main language to teach programming.

    It’s definitely a very verbose language when it comes to compilation, type checking, etc..

    ADA will tell you when you’re doing silly thing.

    Still isn’t a remedy for stupid programming logic though 🙂

    Anyway, good luck, hope you enjoy it.

    1. North Post author

      It’s definitely quite verbose although I’m thinking that might actually be a good thing because it forces me to think about what I’m writing as I’m writing it because of the amount of time it takes to write it. Compare that to C or Python where I would code away (and more than likely screw up quickly)…

      It’s definitely not foolproof — those failed Ariane rockets with their multimillion dollar cargo should show that. 😉 Hopefully, I won’t be the one responsible for it the next time it happens…not that I’ll even get the chance to but… 🙂

    1. North Post author

      It’s 29 years old, not 30. 😉 Furthermore, just like every other language, it’s been updated dramatically more recently. The version most people use is Ada95 created in 1995 but newer versions exist from 2005 and even 2012. If it was the original creation date that mattered, C (created in 1972) would be even more obsolete and yet it’s still regarded by most as being the most popular programming language in the world. You could claim that it was obsoleted by C++ but C++ appeared in 1983, the same year as Ada. Objective-C which a few (mainly iPhone/iPad/… developers) claim obsolete C++ was also originally created in 1983.

      Ada is also being used extensively in the aerospace industry and powers most of the airliners in operation today as well as many of the space missions in operation today simply because a single failure in the code could cost millions of dollars or even (in the former case) hundreds of lives. Ada is designed to check for those errors and while not perfect, does a better job than most languages — mainly because it was designed for that purpose.

    2. darkestkhan

      Why do you say it is obsolete? Do you even know Ada? At the time it was created it was most advanced programming language – to the point were people were saying it is impossible to implement.

  4. gorlok

    Ada is “Pascal on steroids” 😉

    It’s a interesting language to learn, but it’s not fun.

    1. North Post author

      Believe it or not, I’m actually enjoying it quite a bit more than when I first learned C with all the issues I had then — although that was also when I first learned programming so that might explain it. 😉

  5. Gour

    I like dead-tree book to learn Ada. What would you recommend between Cohen’s Ada as Second Language and Barnes’ Programming in Ada 2005?

    I want to write open-source multi-platform app using GtkAda…

    1. North Post author

      I haven’t used either of those books (or any, for that matter, besides the reference manual and the Wikibooks) so I can’t comment on which is better. What I can say is that I find it very helpful to be actually writing the code. It’s a lot like learning a foreign language — it’s much easier after you’ve doing it just like how it’s easier to learn French in France because you’re “forced” to use it to find your way around. If you’ve used GTK+ for C, GtkAda should be quite similar since it’s the same library, just in a different language.

  6. pezhead9000

    Bookmarking your site. I’m interested in Ada from a curiosity standpoint. I find the scripting languages great for prototyping but get caught up in various runtime issues .
    Curious to experiment with Ada for the type checking and to determine how it balances with productivity.

    Also, do you have problems finding libraries, etc…

    1. North Post author

      Since it’s able to interface with C, all the C libraries are available for use, and I’ve never found a shortage of C libraries.

      Hopefully, I’ll be able to get started back on this Ada series shortly — probably by the end of this month.


Leave a Reply

Your email address will not be published. Required fields are marked *