Middle-Ground Learning Resources

Ok, I don’t know how to approach this topic, either, so I’ll try to make it as bearble as possible while also comprehensive. I’ll state what is really needed first, and the problems with what’s available, followed by the otherwise unnecessary context behind what I write which may shape responses. Frankly, I apologize for how brazen this claim is, but I feel the learning resources for Ada are unfit for purpose.

First, I tried chatGPT, but it couldn’t keep track of the “lesson plan.” Then I looked at the official learning material from adacore, whichis for 2012, and it reads like it’s not actually going to cover every topic. Then I went to the definitive resource, the reference manual, and it reads like “The missile always knows where it is, because it knows where it isn’t. By subtracting where it is by where it isn’t, or where it isn’t by where it is, whichever is greater, it obtains a ‘difference’ or ‘deviation’” when I’m just trying to figure out how to set the parking break before we unchock the tires. Then there’s the video tutorials which branch out of the language and into SDL in lesson 2 or 3?

If someone’s going to take the time to learn Ada, they both should and should want to know the entirety of the language constructs, which throws out the learn.adacore.com stuff (because the topic separation and overlap does not instill confidence that it’s comprehensive) and the video tutorials. Next, while the reference manual makes sense for experienced Ada coders wanting to write a compiler for Ada, i can’t tell you from reading what a “subtype” is for (which is where I’m at in the RM). Is there anything like the C or C++ tutorials which actually cover whole topics verbatim in a progressive form?s

For context: I’m learning Ada because of the drama surrounding my first language (C++) and the deprecation hell that has permiated pretty much every language. I need to be able to write programs and utilities that I can rely on for years to come (I work in a factory as a laborer and happen to know and like programming, but I don’t have time to rewrite every program from scratch because a language removes a construct or major library like PHP loves to). Ada looks incredibly stable by comparison. I’ve been doing this sort of thing since maybe 2005. I know C/C++, x86 assembly, Java, VB.net, PHP, and who knows what else I’ve dabbled in, so I get that things external to the language get deprecated, systems change, etc. My fear is that even C will change when C++ adoption drops in favor of plain C. Meanwhile, one of Ada’s express goals is to keep that code from the 80s compiling, even if they add a few new features here and there that breaks code that just happened to use an identifier that shares it’s name with a new keyword. Moreover, Ada actually has useful things like object orientation (unlike C). But like, it seems to be unnecessarily difficult to actually get into. I would try to solve this myself, but i lack the ada knowledge to do it.

So, i was curious if anyone actually was aware of something like the RM but in plain english. The learn.adacore.com materials are fairly good, but if they don’t cover everything, that just forces everyone into the RM if they want to learn the whole library or years reading the code of random people trying to find new nuggets of information.

1 Like

Barnes is considered the authoritative textbook, but it’s not easy reading imo.

Feldman’s Ada 95 books are approachable and were used to teach undergraduate CS courses for several years. You won’t miss much by learning the older version, mostly containers, which were added in 2005. You can learn that from the Rationale or Wikibooks.

If you’re more of a learn-by-example person, Rosetta Code has Ada solutions for a large number of tasks. search.ada-lang.io provides a quick search of a snapshot of Alire package sources. This usually suffices to find an example usage of a feature.

4 Likes

For those with experience in other languages, especially C-family languages, I recommend Ada Distilled. The free version is ISO/IEC 8652:2007 Ada; there’s also a Kindle version for Ada 12. You can easily learn Ada 12 if you’ve learned ISO/IEC 8652:2007 Ada. The formatting is sometimes not very good, but it does a good job of presenting the language and explaining things that cause problems for people with experience in other languages, such as visibility.

4 Likes

This one helps me more clearly specify what is actually needed, as it fails and it points out this itself in it’s own text. In the “What is Ada Distilled” it admits it’s not comprehensive, which is the problem with the current learn.adacore.com ones (or not, but I don’t think the writers there even know because it’s not organized to be comprehensive and is likely only comprehensive by chance rather than intent). It does seem a little more approachable, and I’ll probably put it in my list of things to go over, but I’m specifically looking for something comprehensive, but the challenge is that the only thing I’ve seen thus far that is comprehensive is the RM which seems to be more for compiler makers.

The reply system on this site is weird, I’m still looking at the first reply’s materials, but your reply was short enough I was able to address it here and now while on break.

I am afraid there is no comprehensive guide to Ada. I don’t see why do need it either.

Ada is designed in a way that you can use a subset of without knowing the rest. I, for example, do not use Ada containers because I keep my code base Ada 95 conform and I do not really like the design of. “Ada Distilled” is meant for engineers accustomed to procedural way of thinking that would never use Ada’s OO. Many people avoid exception handling. Most people use generics in a very rudimentary way never diving deep into the dark abyss. Not so many are using tasking and protected objects. Then there is SPARK, which is a whole universe of its own.

What you really need is to understand the method. Ada programs are written with a certain mindset. If that is compatible with yours then you are OK knowing just 1% of Ada. If you are stuck, just ask questions. Somebody will always answer.

4 Likes

To address yours. The Barmes book being paywalled means we cannot verify the extent of the content. Everything else other than the wikibook falls short of being comprehensive, which goes back to needing to read the RM as a learning resource for which it seems ill suited.

Now, the wikibook is a bit harder to evaluate. A quick skim shows the html version is a ton of links. The pdf version (however it’s generated) references an old compiler. GNAT being the only remaining compiler to continue being supported, this means one of the following.

A: it’s unwieldy to maintain die to complexity, but it’s complete but contains small errors in reference to old software replaced by gnat.

B: it’s incomplete, and haphazardly updated.

C: the pdf is not automatically updated, but is complete for an older version.

D: it’s complete and correct, but only for an older version of Ada.

Now, as long as it’s not B, it’s serviceable and can be augmented by the changes books meant to update existing ada coders (“what’s new” docs like the one you cited) and either fixed easily or minor issues ignord. Which case is it?

1 Like

See i know many languages and can code to many ways. The most effective and readable way to code is often to be able to adapt. Which is why we often switch languages to fit the project. If anything, that is my style.

So far i have a script already to not only work with alore to automatically remove the style checks, but also to create a gpr that uses the one alire creates as an import but uses a few extra build flags for efficiency greater than alire’s release build.

I do not use Alire at all. To me it is unusable with the number interdependent projects and targets I have, then the whole idea of crate system is bogus, not to mention Git.

Nor do I style checks. And I write gpr files myself, it is a three-liner in most cases.

But all that is irrelevant to Ada. Many enjoy Alire, many do not understand gpr projects, some even enjoy CMake, many use atrocious emacs instead of GNAT Studio.

Do as it fits you best.

I hear you I’m a heathen that uses vim. I’m trying to use alire because I figured that I’m not the only one that has the problem that created this post so I figured maybe I was probably going to have to solve it and that includes for people who might not have as much background as I do. And after the trouble I had trying to install gnat on endeavorOS, I realize that alire was simply the easiest method to explain to other people so I’m trying to work with it or I should say around it. I do agree the crate system is bogus but it’s nice if you need it but honestly it’s more for the simplicity of installing it without having to guess the correct package to install to install gnat because it seems to be source packages for some reason as opposed to binaries pre-built so it’s a bit of a pain to work with otherwise.

The Barnes book is comprehensive but it does introduce things like arrays and then go over them again in more detail later. Sometimes you don’t quite know where to look but it’s a good book. You can view the contents in a kindle trial atleast. Older books are good too. Ada as a second language by Cohen (Ada 95) is pretty comprehensive.

1 Like

I. AdaCore’s Learn section

It annoys me very much, in no small part because it is technically well done and is evidently a product of hard work. There clearly is a lot of information contained in these online books. but they are too compartmentalized to give a coherent view of the language. I think they would gain as a didactic material if they were edited into a single book that gives a comprehensive introduction to Ada and perhaps another one for specialized topics (for example, concurrency).

II. Ada Reference Manual

I don’t think a beginner should start or hope to learn Ada by reading the language specification section of the Ada Reference Manual so I discourage it. Thankfully, the standard library anexes are much more readable and should be used as much as possible (it works for me as the cppreference of Ada).
[The ARM as a whole is nonetheless a remarkably readable document and a stubborn reader will have no problem overcoming its legalese]

III. Books

There are free or cheap choices. Barnes (Ada 83 through 2022), the Feldman books (Ada 95), Ben-Ari’s Ada for Software Engineers (Ada 95/2012) or even Gehani’s Ada: An Advanced Introduction (Ada 83). There, of course, are many many more for Ada 83-95. Barnes is comprehensive and if someone were to go through it cover-to-cover, they’d end up in a great spot. I just checked: Barnes 2005 versions are cheap, while Barnes 2012 are not overly expensive either. Ben-Ari 95 is available online for private use, so are the Feldmans.

IV. Video tutorials

The obvious explanation for lack of Ada video materials is that there hasn’t been anyone with interest to produce them. For good reasons: tutorials, I worry, would just end up being too fragmented to be useful to anyone. The one type of taped material I think is universally interesting are those long-form streams where a person implements a project to learn a language. This benefits beginners and experienced developers. The first group learns along the way, and the second may drop by to give advice or learn where beginners stumble.

V. Toolchain

I agree with @dmitry-kazakov that learning a minimum of GPRbuild should be a priority for an aspiring Ada programmer. It is very easy to pick up for a beginner project, the manuals are serviceable. I think that if someone is learning Ada and is able to install the GNAT and GPRbuild on their own, then adding Alire to the mix is completely unnecessary.

1 Like

I really ended up liking the Rationale documents generated for each language revision. I don’t know if they will meet your needs. In particular the Ada95 Rationale document covers a lot and provides a pretty big intro. The 2005 and 2012 rationale cover changes to the languages introduced by each revision, so I would pair up all the rationale documents as a singular thing. All of them are on the AdaIC website (sorry I would link but the cloud provider used for the AdaIC and Ada-Auth is blocked in a lot of places, including here. Hopefully someone sees this and can link them all to you for me). They didn’t make a rationale document for 2022 but someone made an “overview” document instead.

Note that the Ada 2005 and 2012 rationales will look more anemic compared to the Ada95 one as Ada95 has the most impactful changes.

They were all intended to be more of a “layman’s approach” to language features introduced by each language revision. I don’t think they were designed to be a learning resource per-say but they work well enough for me (everyone is different though).

EDIT: There is also one for Ada83. I didn’t see it originally, but google search and the wayback machine both know it exists.

EDIT: While I cannot test direct links to the site, I can get them via the wayback machine. Here are the links. If interested, then just look for the Rationale section in each (except 2022 which has an “Overview” instead):

3 Likes

Honest question: would you say that you know the entirety of language constructs in those languages, especially C++? I’m not sure even the C++ standards committee knows the entirety of language constructs in that language, let alone the compiler writers. (Judging by the language’s error messages.) Strousroup’s comment that “C++ feels like an entirely new language” is worth mentioning.

I. Yeah, i can’t complain about the quality at all. Absolutely the easiest to read and follow, to the degree i can go through a chapter in about 30 seconds, because what is presented is presented well.

II. Yeah, i think the biggest problem with ARM is the ordering. Like i’m taking notes going through it and i don’t think any of them will be relevant until much later, and i’m not sure if my notes are even correct representation of the material.

III. I may have to go through one then.

IV. None-the-less they actually do exist, brought to you by the people at Adacore. One thing that kinda spooks me about it is the fact that they’re leaning towards marketing the language as a general purpose language rather than leaning into it’s unique strengths. Almost any language can be general purpose, but their stated goal is to make Ada competitive with the other languages, which means they may have the intent to try to make Ada into the other languages.

V. Install is one thing, but when distribution is as source that’s the challenge, especially when it’s self-hosted compiler. Which means you install a temporary binary build to build the actual binaries. TBH, this is less an Ada problem and more an AUR problem: there is a correct package but no one thinks to search “bootstrap” when typing in “yay -S gprbuild gnat”. Alire will install all that for you.

Aren’t these ARM with added text? I don’t think it’s a bad thing (mayhaps helpful in deciphering ARM) but that doesn’t solve the problem of ordering. Like, the ARM goes into subtypes and i’m sitting here asking chatGPT (since it’s easier than googling these days) why i would even want to use subtype over type, and the way everything’s phrased it sounds like subtype is how you do polymorphism, but it turns out that’s not even remotely the intent. Meanwhile, this is before constrol structures or even telling us how to print out a number. Which, to be fair, if you look at it as a dictionary rather than a tutorial (which is what reference manuals are for, really) it fits that purpose fairly well.

C and C++? Sure (as of C++14, after which the threats got too spooky and i backed down to C), well, that is if we’re using the same definition of “language constructs.” For me, it’s the language itself not including the standard library, because those are not meant to be guaranteed (i guess you could say the same for Ada). Most tutorials will take you from “hello world” to classes and tell you pointers, bitwise operations, etc. The languages have rather simple syntax and it’s pretty easy to understand all the language features, as there really aren’t all that many.

As for Bjorne’s comment, one has to understand a good portion of the “language update” has been the standard library, not the actual language itself (though they absolutely changed a bit of that with auto, rvalue, etc). The standard library of C++ has historically been pretty bad, and at least the changes with C++11 were very welcome, but then it started to look like C++ was trying to become every other language and going from radio silence to becoming updated every few years? And with drama surrounding it? But, i digress.

The other languages, not so much. Java, VB, etc were all courses i took (aside from php where i only learned enough to get by when i couldn’t be bothered to write my own CGI, which i regret).

1 Like

I’m not sure if that was a typo or something (a missing “not” before the first “comprehensive”?). So Barnes covers the language constructs, while doing so partially at one point, then fully covering them later once there’s enough fundamentals for it to be relevant? My big fear is going through a tutorial, thinking i actually know ada, only to find out half the key words available were missing or that available constructs (like predicates on subtypes) being left out because “we have better ways to do it now” without considering alternative uses for old methods or whatever. Or, my personal favorite, something i’ve seen in other languages is not covering things like bitwise operations “because that’s too hard for students and only useful for drivers” (an actual argument i heard about pointers and bitwise operations not being taught in C++).

Ada notion of subtype differs from numerous other definitions, the Liskov’s in particular.

Ada subtype is a type created by constraining the set of values and composing “inherited” operations with Constraint_Error upon constraint violation on way out Subtype is substituted as an equivalent type. So it is both a sub- and supertype in Liskov sense and a subset in others. Anyway transparent substitution gives you polymorphism.

It is a very powerful mechanism, in fact, so powerful that many Ada programmers never looked into Ada OO types.

Note that Ada purists refuse to call subtype a type at all.

ARM was never about intent. Intent is described in Ada Rationale and books on how to use Ada for particular tasks.

1 Like

I eventually got to that after spending over an hour arguing with chatGPT which then added “derived type” into the mix. I was trying to figure out why you would use subtype rather than simply type, which lead to the conclusion that subtype was for avoiding type checking, to which chatGPT correctly informed me that i was wrong, so i was trying to figure out how these 3 things genuinely differentiated from each other and given that object orientation hadn’t been covered yet i basically argued that “type” merely is a “derived type” of a sort of unnamed types declared only implicitly to which the built-in types are merely unmodified examples of. Effectively the only difference between “type” with a signed constraint between 16#80000000# and 16#7FFFFFFF# and a derived type of Integer is that a derived type means there’s a parent type while non-deriving means that it’s a parallel “primitive” that happens to otherwise be exactly the same. And subtypes without constraints is even wilder for me. To be honest, i’m still not sure i actually comprehend what the differences are, but this is the result of a very small section of text that i was clearly not ready for.

I wouldn’t use chatGPT for learning to be honest. Loading notebooklm up with all the sound material you can find would be less likely to hallucinate. How will you tell when chatGPT is insistently telling you nonsense?

2 Likes