Slashdot Mirror


Why Not Ada?

David M. Press asks: "Why is it that Ada 95 is not in greater use in Open Source projects? It can compile to machine code or java bytecode, it has built-in tasking (threading), it supports both the procedural and object-oriented paradigms, and it is very human-readable (based off of pascal syntax). And best of all, the GNAT project (based off of GCC) provides a fully conformant Ada 95 compiler for multiple platforms. What more can you ask for?" Good point. Is Ada just a victim of obscurity or are there real reasons not to use it?

17 of 81 comments (clear)

  1. Re:Several reasons. by jd · · Score: 2

    A disk full is equal to being unable to write to the disk. The -program- shouldn't care why you can't write, it merely needs to know that you didn't. The "Why" is only relevent to the user. Same with reads. Why should the program have to care why it couldn't open the file? If it can't, it can't. It's behaviour (eg: not trying to read) should be exactly the same. Again, that's user stuff. And that does not need complex exception handling.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  2. Re:Several reasons. by jd · · Score: 2
    Ok, name one commercial ADA compiler that implements the FULL specification. And by full, I don't mean "just the essentials". I -mean- the full specification. Every type, every run-time binding, every instruction, every form of inheritance, -everything-.

    Cobol is a dead language. NOBODY wants to handle BCD numerics. They're slow, inefficient and (worst of all) unsafe. Too easy to corrupt.

    Exception handling is Bad Programming. One way in, One way out. Nothing more, nothing less. If it ain't drawable as a JSD, BNF or a flow-chart, it's not a real program.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  3. Re:Several reasons. by jd · · Score: 2
    Let's take that last one. IMHO, no operation should ever "fail". If it fails, it means that you coded for a narrower range of conditions than the program encounters. If, on the other hand, you had looked at what inputs the program -could- receive, in the extreme, and coded for -that- range, the functions would always succeed.

    (The only exceptions are functions which allocate memory, as that involves circumstances outside of your control as a programmer.)

    Let's take that example of concatenating a string, as an example. Easy! Just get the length of each string, malloc a buffer equal to the sum of the lengths, plus one, and put the strings in that. You are -guaranteed- that the buffer will never overflow, because you've coded the solution in such a way as to make that impossible.

    (Fixed-length buffers are the ones that kill. Fixing anything before the fact is a good way to suffer bugs, fatal and - worse - non-fatal.)

    Another classic one is the square root function. Two possibilities. First, take as a parameter an unsigned value. If it's unsigned, it can never be negative, so your function will -always- be valid. Alternatively, take a signed value and return a signed float. If the value >= 0, then it's a real solution. If it's The trick is to always define the pre-conditions and the post-conditions. If you typecast in such a way as to guarantee the pre-conditions, then you guarantee the post-conditions will also be met. Alternatively, expand both pre-conditions and post-conditions until, again, the limits of the types guarantee all conditions are met.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  4. Re:Several reasons. by jd · · Score: 2
    Neither. You have a null record. As you return the record as a pointer, the valid response is to return a null pointer.

    Raising an exception means you have TWO paths out of a routine, which is Bad Ju-Ju in programming. Making up data is the same as not initialising your variables - another form of Bad Ju-Ju.

    Write Clean Code, because Clean Code is guaranteed to work. Spaghetti Code, with exceptions jumping around like a pogo stick on speed, is GUARANTEED to fail. Why? Because you can't possibly think of every possible exception. But, if your code is inherently designed to handle every possible case BY DESIGN, you don't need to care what those cases are.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  5. Money by Detritus · · Score: 2
    There was a short-lived mandate at NASA to use Ada for new software. I thought it was a good idea. It died a quick death when people asked for funding for training and compilers. This was before GNAT, when compilers were very expensive.

    I still think there is a need for a language with strong type checking, range checks, platform independence and good bindings to the OS and GUI.

    One feature that I would like to see in new compilers is better run-time diagnostics. I used to use a DEC FORTRAN compiler that produced programs that would print out useful error messages, such as "divide by zero error at line 330 in module FOO", instead of just crashing.

    --
    Mea navis aericumbens anguillis abundat
  6. A site with some information about Ada by Roy+Ward · · Score: 2

    OK, this is a site with a great deal of Ada advocacy:

    http://www.adahome.com/

    I've not used Ada (it's on my list of things to try), but it looks like it's got a lot going for it.

    I personally like protecting developers from themselves to some extent, because it results in more robust software (depending on the choice of language, no mysterious overflows or pointer problems). This is why at my job we use Java rather than C++ ... it produces much slower code, but is much faster to develop.

    Roy Ward.

  7. I was taught ADA by trexl · · Score: 2
    ... And the first few years of my CS schooling were nearly unbearable. It was very similar to being forced to speak in very proper English all the time, calling every person you meet by their complete names, and annunciating each and every syllable.
    Looking back, I believe that ADA is a good language to learn for a first language. Just like being forced to take grammar and phonics in grade school. The teachers force you to speak properly during class, but you find more concise and effective communication possible when you talk with your friends using slang, vernacular, etc. You speak formally when you are trying to prove something, or be academic, but to get work done, you don't wish to be bothered with the formallities. I think that's ADAs biggest problem.
    Either that or the fact that the ADA standard wasn't changed until 1995, well after other languages gained momentum and wide spread acceptance in the academic community.

  8. Re:The real reason by coyote-san · · Score: 2

    Ada blocks are delmited(sic) by indentation

    Just in case someone missed the significance of the Python reference (which does use indentation to indicate blocking), Ada uses a variant of begin/end delimiting that should be familiar to most C/C++ programmers.

    Really, what's the difference between

    void foo (void)
    {
    if (a < b) {
    c();
    }
    else {
    d();
    } /* end if */
    } /* end 'foo' */

    and

    Function foo is
    begin
    if (a < b) then
    c;
    else
    d;
    end if;
    end foo;

    I've worked in C for 15 years, vs. 3 years in Ada, so I find the uncommented C cleaner for simple procedures. For complex procedures, or if the shop requires /* end loop */ type comments on all closing braces I find Ada cleaner. In any case, Ada definitely requires explicit delimiters.

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  9. Cumbersome by AdrianG · · Score: 2

    My understanding is that Ada was designed, in part, to help keep the programmer from making some kinds of mistakes. My feeling is that this philosophical influence on a language tends to lead to a more cumbersome language. Indeed, Ada is a complex enough language that it took years to create a certified version of the compiler.

    I worked as a civilian consultant at an Air Force base for several years. I remember that there was a fierce resistance to using Ada for many years after the US Department of Defence issued its mandate that Ada was to be used for everything unless there was a clear justification. Even though there was a clear recognition of the fact that the multitude of languages used on individual systems and weapons platforms, NOBODY wanted to use Ada.

    Adrian

  10. Why not ADA by underclocked · · Score: 2

    Ada is taught at my school for both Comp Sci I and II. The reason given for teaching ADA is that it's a "stongly typed" language and it's pretty fair with error recovery. According to my prof. ADA is used in military tasks involving 100% reliablity (submarine radar traking systems, air traffic control systems, stuff like that).

    There are almost no professional opportunities for ADA programmers, unless you would like to work for Rockwell (no offence to those Rockwell folks, but you are the only people I know hiring ADA programmers.) Ada is almost SO strongly typed, it's almost code prohibitive; I get bogged down in the structures and not the implementation of the solution.

    However, here are some links for ya'll
    ADA Reference Manual
    a prof's home page

  11. Why Ada is unpopular by Animats · · Score: 2
    Ada is a good language with several cosmetic problems.
    • For compatibility with old 1970s hardware, Ada was designed to work with a 48-character set. So it doesn't use many special characters, or even lower case letters. This leads to ALL UPPER CASE PROGRAMMING, which is today considered ugly. It also leads to verbose code.
    • Objects came late to Ada, as they did to C, but C++ got there first.
    • Ada was considered a big, complex language for its time. ISO C++ is bigger and more complicated, but programmers were sucked in by C, so they didn't have to face the mess. But go over to USENET comp.lang.c++.moderated and look at the terrible problems people are having with C++'s hokey "template" mechanism for generics.
  12. Several reasons. by jd · · Score: 3
    First, ADA is =so= complex, that until recently there WERE no "complete" ADA compilers. This meant that you had lots of ADA dialects, each a subset of the "real" ADA language, and that a program that worked on one dialect might not even compile on another.

    Secondly, ADA compilation is slooow. This is inevitable, when you have a language that supports typing after the fact, amongst other obscure but powerful features.

    Thirdly, nobody has ever really promoted ADA, other than the DOD. And what geek in their right mind would trust a super-paranoid organisation, when it's telling you that something is for your own good?

    Fourthly, nobody but nobody has written a decent optimising ADA compiler. Nobody knows how! There has been almost zero research into 3.5th generation languages and how to tightly optimise the generated code.

    Fifthly, until GNATS came along, many ADA compilers cost as much as the machine they were to run on. Microsoftian in the extreme! Anyone with any sense would have said no to the ADA tax. (The COBOL tax is even worse! And COBOL is an all but dead language!)

    Sixthly, nothing interesting has been written in ADA, so geeks, nerds and coders have no incentive to grok it. (If someone were to port the Linux kernel to ADA, I'm sure interest in it would sky-rocket.)

    Lastly, too many bad memories of lecturers who keep their brain cells in their tuna-fish sandwich, telling people that the best way to debug a program is to throw in more exceptions. Sorry, but if the program was written sensibly in the first place, there would BE no exceptions. Exception-handling is a way to write sloppily, with no understanding of what you're actually doing.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  13. The real reason by FigWig · · Score: 3

    The reason people don't use Ada is because its blocks are delmited by indentation. Every knows that's just ugly. Real hackers would use a language like Python instead.

    That and it's named after a girl.

    --
    Scuttlemonkey is a troll
  14. Things are getting better... by zmower · · Score: 3
    We now have Ada95 output from GLADE targeting the GtkAda binding.

    I have both Ada and C experience. Ada thrashes C for non-trivial programs. Maybe the problem is that most open source software starts out as trivial programs that scratch a programmers itch.

    C++ and Ada95 are roughly equivalent. To my mind C++ suffers from its class-centric view of everything. Look at the hassles C++ has with singletons while Ada neatly solves this with the package structure.

    adapower is a good place to start for those interested.

    --

    Sig pending!
  15. You Choose... by Skweetis · · Score: 3

    Ada.Text_IO.Put_Line(Item => "Hello, World!");

    -- OR --

    printf("Hello, World!\n");

    Ada95 source code takes up twice as much disk space as C source! All joking aside, I don't use Ada because there aren't very many library bindings for it. GNAT is a pretty good compiler, though, and Ada fixes a lot of problems inherent in C, but Ada probably just isn't used because C/C++ are the established languages of choice for programming on Unix/Linux systems (most of the OS being coded in C).

  16. Culture by remande · · Score: 4
    A lot of people have given a lot of technical reasons for not choosing Ada. However, I think that there is one, larger reason for this. Ada has been considered beneath contempt by most geeks since before most geeks were coding. It's one of those things that we are supposed to hate as a matter of culture. I've read a bunch of stuff about how it is built by committee with all the problems thereof, but I've never actually seen it, and I can count on one hand the number of people I know who have used it.

    If you don't hate Ada and COBOL, you get shunned by hackerdom. You are allowed to code in either, but must swear loudly while doing so. People who actually choose to generally get discounted as idiots.

    I'm not saying that the above is right, but only that the above is so.

    --

    --The basis of all love is respect

  17. GNAT by CFN · · Score: 4

    Having done my undergraduate CS at NYU, the 'N' in the Gnu Nyu Ada Translator (GNAT - how many people knew that), and having studied under two of the developers of that system (their company's site) I was fortunate enough to be exposed to virtues of this language.

    The Ada syntax is very similar to Pascal's, but the language is very similar to Java (especially thread support). Once you get accustomed to using the language, you notice that you can be very, very productive using it, much more than in C++. I would also say that the learning curve (minus the time to familiarize yourself with the syntax if you are coming from the C/C++ world) is pretty easy to climb, and you can be proficient at it soon.

    For my compiler class, we needed to write a compiler for a (the non OO) subset of Ada95. I chose to write mine in Ada95, because we were allowed to use the GNAT lexer/parser (which was written in A95 as well). I would strongly recommend that anyone wanting to learn large scale programming or who is developing something that will be open source, should take a look at the source code. It is clearly written, well documented, easily understood, and even beautiful. It is a wonderful example of how someone should write code if the expect others to read it. It also shows just how beautiful and understandable the language is.