comp.lang.ada
 help / color / mirror / Atom feed
From: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves)
Subject: Re: Some questions about Ada.
Date: 1996/05/03
Date: 1996-05-03T00:00:00+00:00	[thread overview]
Message-ID: <Dqt9nA.o5n@undergrad.math.uwaterloo.ca> (raw)
In-Reply-To: 3188F63D.3325@io.com


In article <3188F63D.3325@io.com>, Dave Jones  <davedave@io.com> 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/




  parent reply	other threads:[~1996-05-03  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-02  0:00 Some questions about Ada Carl Laurence Gonsalves
1996-05-02  0:00 ` Robert A Duff
1996-05-02  0:00 ` Dave Jones
1996-05-03  0:00   ` Spencer Allain
1996-05-03  0:00   ` Darren C Davenport
1996-05-03  0:00   ` Carl Laurence Gonsalves [this message]
1996-05-03  0:00     ` Dave Jones
1996-05-03  0:00     ` Adam Beneschan
1996-05-04  0:00       ` Robert Dewar
1996-05-04  0:00         ` Richard Kenner
1996-05-04  0:00           ` Robert Dewar
1996-05-05  0:00             ` Richard Kenner
1996-05-05  0:00               ` Robert Dewar
1996-05-04  0:00         ` Kevin D. Heatwole
1996-05-04  0:00         ` Robert A Duff
1996-05-04  0:00           ` Robert Dewar
1996-05-05  0:00             ` Robert A Duff
1996-05-05  0:00               ` Arthur Evans Jr
1996-05-05  0:00                 ` Robert Dewar
1996-05-05  0:00                 ` Robert Dewar
1996-05-06  0:00                   ` Norman H. Cohen
1996-05-06  0:00                     ` David Weller
1996-05-07  0:00                       ` Robert Dewar
1996-05-12  0:00                         ` Geert Bosch
1996-05-06  0:00                 ` Christopher J. Henrich
1996-05-06  0:00         ` Norman H. Cohen
1996-05-06  0:00           ` Robert Dewar
1996-05-04  0:00       ` Carl Laurence Gonsalves
1996-05-03  0:00     ` Michael Feldman
1996-05-03  0:00     ` Robert A Duff
1996-05-06  0:00     ` Laurent Guerby
1996-05-06  0:00   ` Matthew M. Lih
1996-05-09  0:00     ` Dave Jones
1996-05-03  0:00 ` Laurent Guerby
1996-05-03  0:00   ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox