comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Ada95 tutorials with sample code.
Date: Tue, 06 Mar 2001 15:48:17 GMT
Date: 2001-03-06T15:48:17+00:00	[thread overview]
Message-ID: <5F7p6.123$54.82@www.newsranger.com> (raw)
In-Reply-To: 3AA48DE9.A0650F21@emw.ericsson.se

In article <3AA48DE9.A0650F21@emw.ericsson.se>, Sven Nilsson says...
>
>(which I'm sure has been discussed countless times before) BUT
ohhhhh yeah.....

>This use-thingy. Is it really ant good? I've only ever used Ada in HUGE
>projects with loads of people writing the code and I've found that the
>use-clause can be a real pain as it dosn't give you a clue as to where
>things are declared. Right now I'm teaching new arrivals about Ada 95
>and I invariably tell them NOT to use the use-clause. 
>Now, there're a lot of very clever and skilled people reading this
>news-group and I'd be interested in your feelings on "use". Is it a Do
>or Don't? Generally speaking?

That's a subject of much (often vitrolic) debate. Personally, I'm with you. Most
of my Ada projects are in the >100KSLOC range and I *lothe* use clauses. This is
probably partly because I often get called in to try to figure out what's going
on in the worst-written code in the system, thus I don't get a chance to see
them used well (assuming there really is such a thing. :-) ).

I should also mention that none of this goes for the "use type" feature of
Ada95, which IMHO is the best thing since sliced bread. :-)

I see that most of the other responses so far are along this same line. Its a
shame Dr. Dewar (of NYU and Gnat fame) never came back after Deja went under,
because he could probably give you the best pro-use argument. If I remember
right, one of the main pro-use compaints is that with the new child package
feature, names just get rediculous if you are pedantic about "no uses". 

The common example used is Ada.Strings.Unbounded.To_Unbounded_String. Even I
have to admit this looks stupid. However, I'd claim that the stupidity is
entirely a result of stupid naming on the designers part. They quite easily
could have named the routine Ada.Strings.Unbounded.To, rather than repeating the
names of two parent packages in the subprogram's identifier.

Another point I remember Dr. Dewar making is that some modern compilers (eg:
Gnat) have features that allow you to find the declaration of any object in the
editor. My argument is that this only works if you are always reading the
sources in the editor (eg: no printouts), and only when the code is in a
compilable state. Also, it doesn't help with those situations where a reader
might incorrectly think that they know where an object is comming from and
therefore not check.

Rather than teach folks that "use is evil" (as I do :-)  ), I'd suggest that you
take the following approach:

o  Point out that many (most?) large projects either forbid or severly restrict
the use of this feature due to supposed maintainability issues. 

o  Try to mention all sides of the debate. Feel free to give your personal
stance as well. :-)

o  You may want to consider making a class style-guide for assigned work, if one
style particularly bothers you.

o  Emphasise that anyone writing software that might be used by someone else
operating under different use-clause rules (eg: reusable components or
libraries) should be very sensitive to the names they give things. In
particular, restating the name of the package (or a parent package) in an
identifier should be avioded. If the names of the parent packages is considered
important, the user can use the full notation. 

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  parent reply	other threads:[~2001-03-06 15:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-05 20:40 Ada95 tutorials with sample code mcdoobie
2001-03-05 20:58 ` Erik Sigra
2001-03-06  2:45 ` Jeffrey Carter
2001-03-06  7:12   ` Sven Nilsson
2001-03-06  8:09     ` tmoran
2001-03-06 10:38     ` David C. Hoos, Sr.
2001-03-06 10:38     ` David C. Hoos, Sr.
2001-03-06 15:06       ` Ted Dennison
2001-03-06 15:29     ` Robert A Duff
2001-03-06 16:54       ` Ted Dennison
2001-03-06 15:48     ` Ted Dennison [this message]
2001-03-06 18:19       ` Robert A Duff
2001-03-06 21:19         ` Ted Dennison
2001-03-08  6:13         ` Simon Wright
2001-03-10 16:30           ` Brian Rogoff
2001-03-06 18:20     ` Jean-Pierre Rosen
2001-03-06 20:10       ` Erik Sigra
2001-03-07 14:31         ` Simon Pilgrim
2001-03-06 21:47       ` Ted Dennison
2001-03-07  0:11     ` Robert C. Leif, Ph.D.
2001-03-07  6:44     ` Jeffrey Carter
2001-03-07  6:46     ` use-clause Anders Wirzenius
2001-03-07 18:13       ` use-clause Jean-Pierre Rosen
2001-03-07  7:54     ` Ada95 tutorials with sample code Sven Nilsson
2001-03-07 15:10       ` Marin David Condic
2001-03-08  0:05       ` Mark Lundquist
2001-03-06 15:03   ` Marin David Condic
2001-03-06 14:31 ` BSCrawford
2001-03-06 22:38   ` mcdoobie
  -- strict thread matches above, loose matches on Subject: below --
2001-03-06 23:51 Beard, Frank
2001-03-06 23:58 Beard, Frank
     [not found] <01030621102401.00302@a77>
2001-03-07 12:09 ` Mario Amado Alves
     [not found] <Pine.LNX.4.10.10103071153320.971-100000@lexis.di.fct.unl.pt>
2001-03-07 13:12 ` Erik Sigra
2001-03-07 18:07   ` Jean-Pierre Rosen
replies disabled

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