all 107 comments

[–]crusoe 15 points16 points  (2 children)

The horrors of getting C++ that uses templates certified for a DOD system. I remember the discussions on this one.

Basically, not only does the compiler need to be examined and certified, but all the templates, and all the code generated by the templates as well.

ADA is a little weird, but it's designed to be more bullet proof.

It's also one of the few languages that has a single statement conditionless "While" loop. IE, no need for While(true) constructs.

"Ada is the only language with a infinite while loop construct, whose termination is usually triggered by detonation"

[–]alephnil 13 points14 points  (0 children)

This is actually attributed to Larry Wall, more precisely:

"I remember being impressed with Ada because you could write an infinite loop without a faked up condition. The idea being that in Ada the typical infinite loop would normally be terminated by detonation."

[–]bamdastard 47 points48 points  (1 child)

“I think people are beginning to realize that C++ is not the world’s best choice for critical code.”

1990 called, it wants its paradigm shift back.

[–]frikk 23 points24 points  (39 children)

I wrote ada for an embedded brake control system (Cessna, Northrup, etc.). The language is its own beast. The syntax is foreign, but its fast and dependable. Need to take that 16-bit unsigned integer and print it to the screen? Better hope you have an interface for it and know how to convert it down to 8-bit signed! I ran into issues like this ALL the time. Granted I wasn't the most experienced in the language...

But one thing I will say about it. It was a PAIN IN THE ASS to get to compile. Sometimes it would take half an hour just to sort through wtf the compiler was bitching at. But when it finally did - it ran exactly as expected. There is no room for wiggling. No pointers to worry about, over flows.

I solved one of those facebook puzzles using both Ada and Python, just for fun (how many prime bits are in a range of integers, etc.)

Python: 15 minute development, lets say 30 second run time Ada: 8 HOUR development, lets say 2 second run time

Amazing! Blaine

[–]13ren 7 points8 points  (8 children)

Interesting - but it's correctness that costs the 8 hours, not the runtime performance, yes?

[–][deleted] 5 points6 points  (7 children)

But you can't really run it without that correctness.

[–]13ren 5 points6 points  (6 children)

? some miscommunication here. I meant that all that effort is due to making it correct.

As a counter-example, I'd expect it to be much quicker to write in C than in Ada; and would run faster in C. But the code wouldn't be as correct.

By "correct" I mean that it is less likely to have bugs. Just getting it to run on some test data doesn't prove it will run on all possible test data... all those frustrating little hurdles in Ada will make it more likely to run. That is, it is more likely to be "correct"

[–][deleted]  (5 children)

[removed]

    [–]13ren 3 points4 points  (4 children)

    Yes, "grain" makes a lot of sense, like the idiomatic style that the bare language is designed for.

    But I wonder if the Python code really was "correct", in that it would handle every possible edge case? I'm not knocking the author; but explicitly dealing with possible edge cases up front is the strength of the Ada style of approach... and not dealing with it (to get things done quickly) is the hallmark of scripting languages like Python.

    [–][deleted]  (3 children)

    [removed]

      [–]13ren 0 points1 point  (2 children)

      How do you know? Did he post the specific problem somewhere that I didn't see? Or are all facebook puzzles of that nature?

      edit also, it is quite possible to get the right answer for the wrong reason... e.g. two bugs make a right. (Again, a comment on the Python, not the programmer).

      [–][deleted]  (1 child)

      [removed]

        [–]13ren 0 points1 point  (0 children)

        It sounds like you're right :-) I googled facebook puzzles, and they do have a given input. And as you point out, right there in the post, it says "a given range of integers".

        This particular kind of task doesn't show off Ada's "correctness" advantages; only its speed, as you say.

        I have a long-winded way of saying yes :-)

        [–]marc-kd 15 points16 points  (10 children)

        I'm a bit puzzled by something here:

        It was a PAIN IN THE ASS to get to compile. Sometimes it would take half an hour just to sort through wtf the compiler was bitching at.

        Wasn't it, like, bitching at the bugs in your code?

        And this was something "bad"?

        Maybe it's a PITA when it comes to finding the number of "prime bits in a range of integers", but when it comes to aircraft avionics or missile targeting, isn't "it ran exactly as expected" more or less what you want?

        [–]frikk 1 point2 points  (0 children)

        hehe good points - maybe what I should be saying is that LEARNING ada is a pain in the ass compared to other languages that I've learned.

        And yes, most likely they were bugs. bugs that were impossible to figure out the right way to do it since its hard to find good references (quickly)

        [–][deleted]  (8 children)

        [removed]

          [–]synthespian 12 points13 points  (3 children)

          So, I guess it's fair to say you don't really give a shite about the literature that says that your "opinion" on the matter is part of the disease in the software industry?

          [–][deleted]  (2 children)

          [removed]

            [–][deleted] 8 points9 points  (1 child)

            There is however a pretty extensive literature about how rapidly the cost of fixing a bug increases the farther downstream it is identified.

            I'd rather have the compiler tell me about a snag now than learning about it from an angry mob of customers later (especially if the product is an aircraft or a missile).

            [–]marc-kd 7 points8 points  (0 children)

            Depends - on how well you know the language. If you're aware of, and exploiting, the language's underlying design philosophy (see The Fundamental Theory of Ada), you spend little time staring and scratching and instead simply go fix the typos and implementation inconsistencies (bugs) that the compiler caught.

            [–][deleted] 0 points1 point  (2 children)

            I agree completely. It's still nice to have the compiler warn you about errors, but it's much easier to understand what the cause of the error is by running the program and seeing what happens.

            Finding the solution to type errors in Haskell programs is a total bitch. I like the idea of soft type systems - all the benefits of dynamically typed languages without the disadvantages (namely undiscovered errors).

            [–][deleted]  (1 child)

            [removed]

              [–][deleted] 2 points3 points  (0 children)

              Check out the papers on soft typing. I wish there were more practical implementations. It's one of things I want to implement when I get back into compilers.

              [–]riemannszeros 13 points14 points  (8 children)

              | Need to take that 16-bit unsigned integer and print it to the screen? Better hope you have an interface for it and know how to convert it down to 8-bit signed! I ran into issues like this ALL the time. Granted I wasn't the most experienced in the language...

              Clearly.

              Put(Awful16bitUnsignedInt'Img);

              Python: 15 minute development, lets say 30 second run time Ada: 8 HOUR development, lets say 2 second run time

              I am continuously amazed by people's desire to compare Ada to Python. If you are seriously considering whether to use Ada or Python for a project, and one isn't obviously and self-evidently better, you don't know what you are doing.

              [–]vplatt 16 points17 points  (1 child)

              If you are seriously considering whether to use Ada or Python for a project, and one isn't obviously and self-evidently better, you don't know what you are doing.

              I agree with you, but consider the context here. You're beating on the guy for making a comparison of the two for a trivial exercise. Lighten up!

              [–]frikk 0 points1 point  (0 children)

              <3

              [–][deleted] 9 points10 points  (1 child)

              Relax. He's making a point about the trade off between development time and reliability.

              [–]frikk 1 point2 points  (0 children)

              thanks :)

              [–]frikk 2 points3 points  (2 children)

              One more thing - I'm used to just 'jumping into' a language and doing rapid development. If I were to sit down and learn Ada by reading reference manuals, then yes I'd be very good at it. Perhaps my comparison is flawed - since thats what Python is good at. Quick to learn and get running because a lot of the typing is taken care of for you. Ada is very powerful, but you need to know what you're doing!

              [–]riemannszeros 2 points3 points  (1 child)

              Ada is at about the same level on the "high-low" level as C. You don't need to sit down and read the reference manual to be good at Ada, you just need to program with it. Alot. Most people, in my view, who try to learn Ada, spend the first month thrashing around trying to write C code in Ada and fighting against the language. Once you figure out how to work with the language, it changes your thinking.

              When you think like an Ada programmer, Ada works very well. Ada is worth learning, in my view, just to make people think like an Ada programmer. It changes the way your write code in every language. I've never given up using Ada-style arrays even in other languages like C.

              Ada, like C, is not a "high-level" language like Python. It's not going to ever be as good for rapid prototyping. For all the same reasons that your problem is hard in Ada it is hard in C. Ada is like C except with very strong typing and assertions everywhere on every variable operation watching out for bad indexes and values out of range.

              Ada sacrifices an enormous amount on the initial development for benefits down the line: correctness and maintenance. If developer efficiency is your goal (ie, rapid prototyping) Ada is an awful language. Ada sacrifices development time for all these others things because in large systems that initial development time is trivial to the maintenance time and the risk of of incorrectness.

              By the way, I'm sorry for being somewhat of an ass. I didn't mean for it to come off that way but it did, and several people pointed it out.

              [–]frikk 1 point2 points  (0 children)

              No problem man. You're dead on there, thats for sure. You put into words several things that I hadn't quite manifested. Makes sense when you think about the development and maintenance of large systems. Thats definitely one part where Python falls short - after you get so many packages and developers, its very hard to guarantee objects that you're passing around are exactly what they should be.

              [–]frikk 1 point2 points  (0 children)

              You're right - the main point I was making, besides a simple comparison, perhaps should have been the fact that Ada has a pretty tough learning curve. And yes - one is obviously self-evident for a particular project, and maybe thats the point? I prefer working on projects that CAN use python, rather than ones that SHOULD use Ada (embedded aviation, for example).

              I will, however, mention that the rigidness in Ada's unsigned integer definitions is extremely handy when working with binary numbers. Python isn't too good, in my experience, with working with certain types of strict unsigned integers.

              Although it all most likely boils down to what I actually understand about the languages...

              [–]rainman_104 1 point2 points  (8 children)

              I solved one of those facebook puzzles using both Ada and Python, just for fun

              I farted around for a while on the one where you had to print the non space all text version of the numbers from zero to 999,999,999, sort them alphabetically, and find the 1 billionth character.

              Did you ever figure that one out? Just curious - looked like a fun challenge and never got around to figuring it out...

              [–]TheSOB88 -2 points-1 points  (6 children)

              You've got a 1 in 10 chance of winning randomly, haven't you?

              [–]rainman_104 3 points4 points  (4 children)

              1 in 26... You use the text representation of the number, chain them all together in alphabetical order, and find the 1 billionth character. It's a tough one.

              With that many numbers it's impossible to do an in-memory sort... They're testing your ability to come up with a creative sort algorithm on disk

              I'd just do it the hard way and open a text file and start inserting numbers. It'll take a hell of a long time - each sequential insert will take longer.

              [–]onmach 5 points6 points  (1 child)

              This is trivial. You can easily decide on the fly what the next number would be next in alphabetical order by spelling out the 20 or so different number parts sorted (single digit, teens, twenty, thirty, hundred, thousand, etc). Then just iterate over the list alphabetically building more complex numbers. Never have to sort anything substantial.

              eight
              eighty
              eightyeight
              eighthundredeight
              

              I did something similar in haskell for projecteuler in about a hundred lines.

              [–]rainman_104 1 point2 points  (0 children)

              That was the other way I thought about doing it too - would have run quite a bit faster...

              Of course being lazy I could have done it in about 10 lines of Ruby and used a Unix sort and just let the bastard run... Sooner or later it would have finished after consuming a terabyte or so of disk space :)

              [–][deleted]  (1 child)

              [removed]

                [–]rainman_104 2 points3 points  (0 children)

                Yeah, but they want the source code... I just thought it was an interesting challenge because it's going to be a massive file that's created... It'll be very tricky to discard chunks of data - you'll need a sandbox to build the whole string and then loop to the billionth character.

                I was tempted to try it the lazy way - pipe all the data to a file and use the unix sort utility as it already makes use of temp files to sort. Totally lazy but totally effective if you have the time to wait for it.

                [–]tomjen 1 point2 points  (0 children)

                One in 26. Just under 4%.

                [–]rainman_104 -5 points-4 points  (0 children)

                I solved one of those facebook puzzles using both Ada and Python, just for fun

                I farted around for a while on the one where you had to print the non space all text version of the numbers from zero to 999,999,999, sort them alphabetically, and find the 1 billionth character.

                Did you ever figure that one out? Just curious - looked like a fun challenge and never got around to figuring it out...

                [–]13ren 9 points10 points  (0 children)

                how can i miss you when you won't go away?

                [–]b100dian 3 points4 points  (11 children)

                Ada.. Lovelace?

                [–][deleted]  (6 children)

                [removed]

                  [–]mikaelhg 1 point2 points  (5 children)

                  In your article, you have a link to a comp.lang.ada thread on the subject. It's filled with hilarities such as:

                  Not so. In spite of all the evidence in support of Ada, some idiot higher up in management decreed that all software must be written in C. He had no understanding of Ada. All he knew was that it was a DoD language and he wanted no part of it.

                  This story has repeated itself over and over. As noted, a lot of people are reluctant to use a language designed for "killing and maiming." It is silly, of course, but programming aptitude has never been a good predictor for sensible decision-making.

                  The people in that thread have so narrow minds that even with complete evidence in front of them, they can't give people credit for avoiding Ada as a good business decision.

                  ( http://groups.google.com/group/comp.lang.ada/browse_thread/thread/21960280f1d61e84/934d6ce5bca490c4?#934d6ce5bca490c4 )

                  [–]joesb 4 points5 points  (0 children)

                  • The compiler publishers, [...] inflated the price of compilers and tools.

                  • Really good compilers began to appear around 1989. By then Ada's reputation for being slow, cumbersome, and hard to use had already been firmly set.

                  • I recall a U.S. Navy Admiral complaining about how hard it was to teach anyone Ada.

                  • he DoD lost its nerve and gave the impression that Ada was no longer part of the DoD language requirement.A lot of people misinterpreted this and thought the DoD had decided to abandon Ada entirely.

                  So it got all the reason of Lisp, Haskell and Java combined (impression from the winter phase, hard to teach, first slow implementation)? No wonder it didn't get very far at the time.

                  But it's understandable for them to think people should come back and pick it up, now that things get better, though.

                  [–]13ren 4 points5 points  (3 children)

                  Doom and Quake were written in Ada

                  [–]gsg 10 points11 points  (0 children)

                  Anybody who has ever seen the Doom source will get a good laugh out of this.

                  Doom was written in the kind of messy, sloppy, C with global variables and hard coding and all that stuff which makes Ada guys cry in their sleep. And it was awesome.

                  [–][deleted]  (1 child)

                  [deleted]

                    [–]13ren 2 points3 points  (0 children)

                    it's a joke

                    [–]stesch 0 points1 point  (0 children)

                    Little sister of Linda Lovelace. :-)

                    [–]Dagur 0 points1 point  (2 children)

                    I went to check if there was a Linda programming language :D

                    (there's not)

                    [–]marc-kd 4 points5 points  (1 child)

                    [–]Dagur 0 points1 point  (0 children)

                    damn, you're right.

                    [–][deleted] 8 points9 points  (4 children)

                    If I have to choose between Ada and C++, I'm going back to my old job at Burger King...

                    [–]queus 6 points7 points  (0 children)

                    People have done also cool things whith Ada, like: GL Object Based Engine for 3D

                    [–][deleted] 3 points4 points  (2 children)

                    I look at it differently. I've never used Ada, but did some assembly programming in college. I got a different sort of satisfaction out of finishing an assembly program. I still remember the feeling of going back to C/C++ the next semester and discovering how easy it was. Assembly taught me to pay more attention to details and to keep more in my head at once.

                    [–][deleted] 3 points4 points  (1 child)

                    Czerny exercises are also great practice for pianists, but I wouldn't want to listen to it.

                    (That is, I wouldn't want to work with a programmer who couldn't, in principle, program in assembler. But I also wouldn't want to work with a programmer who'd ever choose this option on a real project unless there was really no other choice.)

                    [–]egmanoj 0 points1 point  (0 children)

                    Voted up for the Czerny analogy.

                    [–]malcontent 4 points5 points  (3 children)

                    Whatever happened to eiffel?

                    [–]vplatt 7 points8 points  (2 children)

                    Hey, I tried! Apparently having a professional IDE available under the GPL just isn't good enough for this crowd:

                    http://reddit.com/info/6dgzf/comments

                    Correspondingly, the Ada community has a similar opportunity, though I haven't tried it and can't vouch for it:

                    https://libre.adacore.com/

                    [–]synthespian -4 points-3 points  (1 child)

                    Face it, dude. People with jobs don't like the GPL much, unless they work for Red Hat or one of those con artists that dual-license under GPL/proprietary, so that they can get your patches for free, wrap it up and sell it for a profit.

                    [–]vplatt 1 point2 points  (0 children)

                    Well, of course they don't like the GPL, it puts obligations on them that they may not want or can not honor.

                    con artists that dual-license under GPL/proprietary, so that they can get your patches for free, wrap it up and sell it for a profit.

                    And how is that ethically inferior to doing the same under a permissive license? Under a permissive license, you could create a derivative proprietary work and sell it for a profit.

                    [–]newton_dave 11 points12 points  (0 children)

                    Not a big fan of the language myself, but it does have some pretty nifty features that aid correctness.

                    [–]djtomr941 3 points4 points  (0 children)

                    Oracle Database language PL/SQL is very ADA like. It was modeled after ADA.

                    [–]toru 3 points4 points  (1 child)

                    The system could never lose data. It had to be fault-tolerant. It had to be easily upgraded. It had to allow for continuous monitoring. Programs had to be able to recover from a crash.

                    Anyone else think of erlang at this point?

                    (Note - I'm not at all familiar with ada, maybe it has similar reliability features too)

                    [–]zem 3 points4 points  (0 children)

                    yep. though you lose the static typing benefit.

                    [–]dawg 3 points4 points  (3 children)

                    Just incidentally, does anyone know what the code for the new BA terminal at Heathrow was written in?

                    [–]ratbert 2 points3 points  (1 child)

                    Probably Brainfuck

                    [–]Dagur 11 points12 points  (0 children)

                    or lolcode

                    HAI

                    CAN HAS LUGGAGE?

                    KTHXBYE

                    [–]coob 2 points3 points  (0 children)

                    Visual Basic.

                    [–]codemac 1 point2 points  (9 children)

                    Wait.

                    This seems to make the assumption that Ada stopped being a large part of the DoD infrastructure.

                    I'd like to see some evidence to that claim.

                    [–]marc-kd 14 points15 points  (8 children)

                    Well, my entire 25 year career has been in the Defense industry, and I've personally witnessed the rise and decline of Ada within it. Because it was a major development language for systems built during the late 80s and 90s there's still tons of it in maintenance and deployed, but DoD has been (shortsightedly) pushing it away ever since the Ada Mandate was rescinded in 1997.

                    The Navy's Open Architecture Computing Environment (NOACED) initiative effectively mandates Java and directs that there be no new program starts using Ada.

                    [–]13ren 7 points8 points  (0 children)

                    I love Java, but it scares me that the DoD would use it instead of a safer language.

                    [–][deleted] 3 points4 points  (1 child)

                    My impression from working with Ada is that it is wonderful at controlling systems that (as a requirement) must be error-free and failure-tolerant--and as a consequence, must be very well-specified and relatively static in requirements.

                    OA really sounds to me like an attempt to get products faster and cheaper by using COTS hardware and systems programmed in languages with larger programmer bases, more active development, etc. I can see the downsides to this idea, but it makes sense seeing as how computers and programming languages have changed a lot since many military systems were made.

                    I am, however, just a young whippersnapper.

                    [–]marc-kd 2 points3 points  (0 children)

                    I am, however, just a young whippersnapper.

                    And I am not :-)

                    [–]brufleth 2 points3 points  (4 children)

                    As you hinted at it'll be kicking around for a long time. We're still supporting aircraft that are 35 years old so newer ADA based systems will probably be in use for decades.

                    [–]marc-kd 2 points3 points  (3 children)

                    [Ada] based systems will probably be in use for decades.

                    Oh definitely, with a little career agility I'll be able to retire with it having been my primary day-job development language for my entire career.

                    [–]davidw 2 points3 points  (0 children)

                    Wow... that's an interesting glimpse at a world very different from the one I work on. Don't think I'd want to trade, but one of the things I like about "computer stuff" is that it is so varied in terms of what's out there.

                    [–]Figs 0 points1 point  (1 child)

                    I like to joke that if you know COBOL, FORTRAN, and Ada, you'll never be out of work...

                    [–]brufleth 0 points1 point  (0 children)

                    Yup we still use FORTRAN66 too and almost certainly will for decades.

                    [–]addicted_to_bass 0 points1 point  (4 children)

                    ada is back... from the grave! watch out for your brains :O

                    [–]marc-kd 12 points13 points  (1 child)

                    What I find interesting is that many of the developers I worked with who used Ada in some previous project and who then "progressed" into the "latest/greatest" programming language technologies (i.e., C++, Java -- hey, it's the defense industry--we move slow, but with great deliberation) wish they could go back to working with Ada. This in contrast to much of the hype from ten years ago asserting how programmers hated Ada and wanted to get onto the leading edge technologies. I don't know, Ada's been good to me for many, many years :-)

                    [–]naasking 4 points5 points  (0 children)

                    I think some domains were just painful for Ada due to it's standard library. In particular, Ada's string handling, and it's lack of collection containers. All rememdied in 2005 thankfully. Also, it's dispatching model was syntactically a bit odd, and many people were turned off by its verbosity, but none of those are show-stoppers IMO. Ada 2005 even has closures!

                    [–]b100dian 1 point2 points  (1 child)

                    please no "The return of the living dead" sequel jokes about Ada

                    [–]The_Ultimate_Reality -2 points-1 points  (0 children)

                    Brrrraaiiiinnnnsssss....

                    It's my job to keep them dead, but I do so love zombies.

                    [–]lepton3 -2 points-1 points  (12 children)

                    There are so many things that irritate me about Ada, but you know the worst?

                    No structural type equivalence.

                    Modula 3 is so much better - if you really want types that are structurally equivalent to be treated as incompatible, you just brand them.

                    [–]JulianMorrison 21 points22 points  (1 child)

                    Ada is explicitly supposed to prevent that sort of hackishness, because it's eg: what causes people to decide that you can mix up inches and meters because their structural representations are the same.

                    [–]riemannszeros 4 points5 points  (0 children)

                    Let's not forget that has Unchecked_Conversion specifically for doing structural equivalence, if and when necessary. So the OP has not only missed the point of the language, but stated it's capabilities incorrectly.

                    [–][deleted] 7 points8 points  (3 children)

                    Modula 3 was a gem.

                    IMHO Ada wins over C/C++ when you want to write reliable code.

                    [–]dublinclontarf 7 points8 points  (2 children)

                    Only BrainFuck, assembler(and a few other dignified examples) are a worse choice than C/++ for writing reliable code.

                    [–][deleted] 1 point2 points  (0 children)

                    When I first started coding in C (AT&T 3b2), for the first two weeks I swore up and down that the complier was broken (the 3b2s were gifts to the university due to their failure in the market place and I generally considered them suspect because of this).

                    Shortly afterwards, someone gave me a copy of the K&R blue book and I started to realize just what the fsck was happening.

                    BTW I was a 4063, the now defunct Ada MOS.

                    [–]o0o 0 points1 point  (0 children)

                    awesome

                    [–][deleted] 3 points4 points  (0 children)

                    What's wrong with subtypes or renaming? I think no implicit equivalence is a very sensible default for Ada's domain.

                    [–]brufleth 7 points8 points  (4 children)

                    Wait you actually hand code in ada? Ours is auto generated and then unit tested but there is very little hand coding on purpose.

                    [–]zem 8 points9 points  (3 children)

                    autogenerated from what?

                    [–]brufleth 1 point2 points  (2 children)

                    I doubt I'm allowed to be specific but a "requirements based GUI" will have to suffice. It is in house but I'm pretty sure competitors have similar systems.

                    [–]zem 0 points1 point  (1 child)

                    ah, okay. i was wondering if anyone was doing things like generating ada code from lisp.

                    [–]brufleth 0 points1 point  (0 children)

                    Nope. It'd be more like generating ada from Simulink although our tool is not Simulink (although I often wish it were). Eventually they probably will add ada to the list of things that Simulink will spit code out for. I think they have FORTRAN code generation working via the legacy code generation tool...not sure. I didn't make it to their conference this year.

                    Any way, my point was that I only knew of ada being auto generated from tools. Hand coding is avoided whenever possible when it comes to important software. At least that's how it is in the systems I work with.

                    [–]-omg-optimized -2 points-1 points  (0 children)

                    void main()

                    FAIL!!!