comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Other Ada Standards (was Re: SIGada Conference)
Date: Mon, 29 Dec 2003 12:29:02 +0100
Date: 2003-12-29T12:29:02+01:00	[thread overview]
Message-ID: <bsp2pt$epgut$3@ID-77047.news.uni-berlin.de> (raw)
In-Reply-To: ouadnZ85QvMhEXKiRVn-sw@comcast.com

Robert I. Eachus wrote:

> Dmitry A. Kazakov wrote:
> 
>> Right. But if they are related? Deeply nested generic child units? Does
>> not the language encorage designers to use larger compilation units
>> because otherwise users will be "punished" by larger with/use blocks?
> 
> This was an occasional problem in Ada 83, in Ada 95 I think the only
> major case left to fix is mutually interdependent types.  And it will be
> fixed.
> 
> But as a writer you have to ask yourself, every time you go to with
> something that wasn't in your original design, whether the design was
> wrong, or your implementation is wrong.  I guess I find three about
> equal sized groups of cases:  The original design WAS wrong, the
> implementation chosen is not wrong, but does need more visibility
> (almost always in the body) than was anticipated by the design, and the
> third case, this implementation is wrong, fix it.
> 
> If you take that attitude, the number of with clauses is just not a
> burden.

It is not. As I said, it is a cosmetic issue, in most cases.

But it is definitely a burden for newcomers and for occasional users of
library packages. Imagine, one Ada becomes popular, this means that it will
have thousands of libraries. And alas, it will be used for poorly designed
write-once-run-once applications.

>> I think that we have reached the level of complexity where it becomes a
>> heavy burden for a reader to analyze all with's and use's. Tools might
>> help, but there is still a problem.
> 
> No real argument with that statement, just a warning.  When a project
> does get to that point, you had better be almost finished, or go back
> now and do a redesign.  At MITRE we found that this was one of the
> nicest things about Ada.  When the contractor started complaining about
> slow compiles or needing better tools, it was time to examine the source
> and compare it to the design documents.  Almost always there was a
> particular design problem that needed to be fixed.  Sometimes it was
> "just" a programming problem, but often it reflected too ambitious (and
> unrealistic) requirements or serious hardware problems.

Excellent point. Up to some level of complexity numerous with's definitely
indicate a problem, because we a-priory know that there should a way to do
it right, at *this* level.

> One of my favorite examples involved a lot of kludgeware to merge two
> message streams.  Why merge the message streams?  Well the requirements
> specified a throughput of more messages per minute than one 9600 baud
> connection could handle.  But the actual requirement anticipated that
> many messages over a single channel.  We allowed the contractor to test
> with a 19200 connection, and went back to the government customer to
> figure out if the requirement was real, and we should upgrade the
> communications hardware. (It turned out to be cheaper to upgrade the
> modems than redo the requirements analysis. ;-)

So, change the requirements, if you cannot fulfil them! (:-))

>> True, this the same problem, but it is one level beneath. You are talking
>> about type interfaces, with/use issue is sort of "package interfaces".
>> With type interfaces and abstract types we can hide uninteresting
>> details. Probably it is time to go this way for packages.
> 
> No, it is the same issue.  Interface inheritance will allow a package to
> import several ADTs and combine them in one new type.  But the package
> that contains the interface instantiation will EXPORT all of the
> operations that are collected by the interface.  So users of the type
> created by the interface instance will only need to with (and possibly
> use) one package, not several.

Yes, it would definitely help, but

1. It is still manual. I'd wish to have a method to automate this. I.e. to
create proxy types more easily.

2. Not everything is a type. One might wish to "stream" objects and packages
through another "interface" package.

> You can do, and I do, the same thing today with a succession of type
> derivations, each using a generic mix-in.  Interfaces will make this
> easier. The private part of a package containing a series of mix-ins can
> get pretty long, and you often need to do some renames in the package
> body.  If you want to call this multiple inheritance, fine.  But I think
> of it as constructing a type from component ADTs.  Whether there is an
> isa relationship to several types, or just a record type with several
> component ADTs, the program structure is the same:  The unit that
> creates the ADT has withs for the compontents, users of the created ADT
> need only with one unit.
> 
> If the average number of withs per package is say two per spec and three
> or four per body, you are doing good.  Four per spec and ten per body is
> acceptable in a final product.  But when it looks like you are getting
> beyond that watch out.  Doing the necessary refactoring will take time,
> but it will reduce the number of bugs to be found once coding is
> complete drastically.

This metric is good, but sometimes it can be misleading. If using an
external library it might indicate rather a problem in the library design.
Win32 or UNIX thin bindings are inevitably bad. Then the rule that with-ing
a child implies with-ing the parent causes aberrations in the metric:

with A.B.C.D; -- One with

with A;
with A_B;
with A_B_C;
with A_B_C_D; -- Four

Though semantically the second might be same. For example A_B could be an
instantiation of a generic child of A.

Then "use A.B;" does not imply "use A;", so the number of use's might
explode even if the design is not so afwully bad. The "use all A.B.C;"
proposal might help. But I'd like to have a finer control over what will be
with/use-d, i.e. "interface" packages. It could be a great help for big
libraries. One could make a set of "interface" packages providing different
views on the library, not necessarily reflecting the design of the library.

-- 
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-12-29 11:29 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <468D78E4EE5C6A4093A4C00F29DF513D04B82B08@VS2.hdi.tvcabo>
2003-12-17  1:01 ` SIGada Conference Stephen Leake
2003-12-17  3:19   ` Robert I. Eachus
2003-12-18  6:55     ` Robert C. Leif
2003-12-18 15:23       ` Other Ada Standards (was Re: SIGada Conference) Robert I. Eachus
2003-12-18 18:27         ` Robert A Duff
2003-12-19  7:38           ` Robert I. Eachus
2003-12-19 23:10             ` Robert A Duff
2003-12-19  8:51           ` Russ
2003-12-19 17:03             ` tmoran
2003-12-20  0:43               ` Russ
2003-12-19 23:18             ` Robert A Duff
2003-12-20  7:05               ` Russ
2003-12-20  9:06                 ` Nick Roberts
2003-12-20 17:43                   ` Robert I. Eachus
2003-12-22  0:07                     ` Russ
     [not found]                       ` <bfcib1-r43.ln1@beastie.ix.netcom.com>
2003-12-22 17:10                         ` Robert I. Eachus
2003-12-22 18:25                           ` Larry Hazel
2003-12-23 16:55                             ` Chad R. Meiners
2003-12-24 13:17                               ` Marin David Condic
2003-12-24 14:57                                 ` Robert A Duff
2003-12-25  3:26                                   ` Marin David Condic
2004-01-03 19:03                                   ` Pascal Obry
2003-12-24 20:16                                 ` Russ
2003-12-24 21:41                                   ` Robert A Duff
2003-12-25  2:51                                     ` Robert I. Eachus
2003-12-25  3:42                                     ` Marin David Condic
2003-12-25  6:35                                       ` Russ
2003-12-25 12:34                                         ` Georg Bauhaus
2003-12-25 15:38                                           ` Marin David Condic
2003-12-26 20:09                                             ` Russ
2003-12-27  3:39                                               ` Georg Bauhaus
2003-12-27  7:40                                                 ` Russ
2003-12-27 11:18                                                   ` Georg Bauhaus
2003-12-28  5:56                                                     ` Russ
2003-12-27 11:24                                                 ` Dmitry A. Kazakov
2003-12-27 12:21                                                   ` Georg Bauhaus
2003-12-28 11:44                                                     ` Dmitry A. Kazakov
2003-12-28 13:59                                                       ` Georg Bauhaus
2003-12-28 19:43                                                         ` Robert A Duff
2003-12-28 20:47                                                           ` Dmitry A. Kazakov
2003-12-28 19:54                                                         ` Dmitry A. Kazakov
2003-12-29  6:07                                                           ` Georg Bauhaus
2003-12-29 11:28                                                             ` Dmitry A. Kazakov
2003-12-29 13:36                                                               ` Chad R. Meiners
2003-12-29  6:25                                                           ` Georg Bauhaus
2003-12-27 18:43                                                   ` Robert A Duff
2003-12-28 11:45                                                     ` Dmitry A. Kazakov
2003-12-28 19:59                                                       ` Robert A Duff
2003-12-30 18:03                                                     ` Peter Richtmyer
2003-12-30 23:02                                                       ` Alexandre E. Kopilovitch
2003-12-27 21:56                                                   ` Russ
2003-12-27 22:52                                                     ` Robert I. Eachus
2003-12-28 11:44                                                     ` Dmitry A. Kazakov
2003-12-28 18:14                                                       ` Robert I. Eachus
2003-12-28 19:55                                                         ` Dmitry A. Kazakov
2003-12-29  2:08                                                           ` Robert I. Eachus
2003-12-29 11:29                                                             ` Dmitry A. Kazakov [this message]
2003-12-29 13:44                                                               ` Chad R. Meiners
2003-12-29 17:07                                                                 ` Robert I. Eachus
2003-12-28 23:17                                                       ` Russ
2003-12-28 23:45                                                         ` Wes Groleau
2003-12-27 14:09                                                 ` Marin David Condic
2003-12-27 19:25                                                   ` Robert I. Eachus
2003-12-28  1:47                                                   ` Russ
2003-12-23 10:49                           ` come from joke (was " Peter Hermann
2003-12-23 12:19                             ` come from joke Samuel Tardieu
2003-12-23 17:00                               ` Arthur Evans Jr
2003-12-23 22:03                               ` Wes Groleau
2003-12-25  0:37                                 ` Stephane Richard
2003-12-27  1:00                                   ` John Woodruff
2003-12-24 18:48                               ` Simon Wright
2003-12-23 12:39                             ` come from joke (was Re: Other Ada Standards (was Re: SIGada Conference) Vinzent 'Gadget' Hoefler
2003-12-23 15:50                             ` Georg Bauhaus
2003-12-23 16:03                               ` Vinzent 'Gadget' Hoefler
2003-12-23 16:12                               ` Peter Hermann
2003-12-22 18:29                       ` Warren W. Gay VE3WWG
2003-12-20 19:44                   ` tmoran
2003-12-22 18:22                   ` Warren W. Gay VE3WWG
2003-12-20  0:39             ` Russ
2003-12-20  1:44               ` unknown
replies disabled

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