From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,411186037d1bc912 X-Google-Attributes: gid103376,public From: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves) Subject: Re: Some questions about Ada. Date: 1996/05/03 Message-ID: X-Deja-AN: 152729080 sender: news@undergrad.math.uwaterloo.ca (news spool owner) references: <3188F63D.3325@io.com> organization: University of Waterloo newsgroups: comp.lang.ada Date: 1996-05-03T00:00:00+00:00 List-Id: In article <3188F63D.3325@io.com>, Dave Jones wrote: >Carl Laurence Gonsalves wrote: >> I've got a couple of questions about Ada. I have to confess that I've never >> written a single line of Ada code. I've got experience in C, C++, Modula-3, >> Java, and Scheme, and several other languages. I've recently become >> interested in finding out about Ada, partly because I've noticed that both >> Java and Modula-3 seem to have been influenced by Ada's design, and I think >> both languages are very good. > >My opinion: Ada95 is the best all-around language for software engineering. >C++ is awful. Nevertheless, if I were starting a project today, I would >probably choose to use C++. Why?: More (and better and cheaper) tools are >available for C++, more programmers are trained to program in C++, et cetera. I'm aware of the awfulness of C++. It's a lot more widespread though, which is one of the primary reasons I use it. It isn't the only language I use though, and I take every chance I get to gripe about the various nasties in C++. >> One thing I'm wondering about is packages. I've heard that packages are >> "better" than than the way C++ uses classes. I'm curious as to why this is. >> Modula-3 has modules (which are similar, AFAIK, to Ada's packages) and >> "object types" (classes) as two distinct entities. I'v always thought that >> C++'s way of allowing just about anything to be nested in a class much >> cleaner and simpler. (and for the record, I was programming in Modula-3 >> before I was programming in C++) So are packages better? Why? > >I would not say that packages are necessarily better. They are, however, easi >to read and maintain than C++ classes. (Of course, if you switched from a wel >designed language like Modula-3 to C++, maintainability and ease of reading ar >probably secondary concerns for you.) I didn't "switch" to C++. I still use Modula-3 when appropriate to the task. Of course, this limits it to UNIX only stuff, since that's pretty well the only kind of platform Modula-3 really works on. Modula-3's also got it's own share of problems that make my skin crawl. As for the "ease of reading thing", I don't find Ada or Modula-3 code especially easy to read. Yes, C++ can be heavily obfuscated, which is a problem with it. But well written C++ code is quite readable. It wouldn't be too hard to imagine a derivative of C++ which disallows many of the constructs in C++ that lead to classic unreadable code. In any case, I'm not here to argue about subjective issues like readability. Why would you say that packages are easier to maintain than C++ classes? From what I can tell they seem quite a lot like Modula-3's modules & interfaces. My main gripe about C++ (here) would be that the public and private parts are kept together. It would be nice if they could be placed, for example, in separate files. >By the way, Ada95 is fully object oriented >so you can create classes (But be careful: Ada uses different terms for its >object-oriented constructs than other languages do.). I've heard about Ada 95. I wasn't able to find any books on it though, so I picked up a copy of "Programming in Ada" 3rd Ed. by J.G.P.Barnes. It doesn't cover Ada 95 (it's copyright date is '89). I'll go and look on the web for stuff about Ada 95, probably tomorrow, actually. >> Second, I've been wondering why Ada is case-insensitive. I'm aware that Ada >> was very carefully designed, so I'm thinking there must be some reason it >> was made case-insensitive rather than case-sensitive, but I can't imagine >> what that reason could be. > >This was done on purpose. Although it gives the programmer less flexibility, >it does make for more reliable programs: If you have ever tried to maintain >a C program where This and tHIS do not mean the same thing, you know what I >mean. I'v also had to maintain Pascal programs where "end" was capitalized in three different ways, at random. Case insensitivity makes the code harder to read and harder to maintain, because one can be misled into thinking that two different capitalizations of the same thing are distinct. The varying capitalizations that result from different people going in and modifying the code results in a distracting mish-mash of capitalization styles. If it was intended to prevent variables that look similar except for case then that's what should've been done: make the language case-sensitive, but don't allow the creation of anything that has the same case-insensitive name. ie: if I create something called "foo" then I can't create something called "Foo", nor can I access something called "foo". But I think that isn't a very good restriction. A very common convention in C and in other case sensitive languages (like Modula-3) is to give a type an upper-case name, and a local general purpose instance of that type has a lower-case name. I imagine Ada programs are filled with variables called "myWindow" or "theTable". -- Carl Laurence Gonsalves - clgonsal@undergrad.math.uwaterloo.ca Computer Science, University of Waterloo http://www.undergrad.math.uwaterloo.ca/~clgonsal/ http://www.csclub.uwaterloo.ca/~clgonsal/