comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Limited use for limited with?
Date: Sat, 9 Oct 2010 01:13:33 -0500
Date: 2010-10-09T01:13:33-05:00	[thread overview]
Message-ID: <i8p16f$sce$1@munin.nbi.dk> (raw)
In-Reply-To: 09c36bd6-edfa-42bf-8f33-e91b0a9b0737@26g2000yqv.googlegroups.com

"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
news:09c36bd6-edfa-42bf-8f33-e91b0a9b0737@26g2000yqv.googlegroups.com...
On 5 Paz, 09:25, "Randy Brukardt" <ra...@rrsoftware.com> wrote:

>> >No way. There are *many* Registers, meaning that a single object can
>> >be registered in several registries, not just one. Will you suggest
>> >passing an array of registries to the constructor? I hope not.
>>
>> This sounds like chaos, not a design.
>
>Let me guess: comp.lang.ada is the only group you are registered to, right?

Yes.

>And of course, you are subscribed to only one mailing list, right?

More than one of those.

>The possibility to register somewhere should be orthogonal to the
>number of registries. If I was able to subscribe to comp.lang.ada, I
>want to be able to subscribe to several other groups, too. It's not a
>chaos, it's an obvious result of decoupling.

But those things are registered by name (an simple text string), not 
registering an object. When you want to put something in lots of places, you 
have have an abstract way to refer to it.

Yes, you can use an access type to do that, but it is a lousy solution, 
because of dangling pointers, because it can't be stored, because there is 
no structure.

An example: in the Claw Builder, I tried to use access types to tie the 
various objects together. But it didn't work, because the structure is a 
graph of elements that are combined in various ways. There wasn't any way to 
restore the structure once it was saved to disk, saving the structure often 
saved elements multiple times, and similar problems. Moreover, the 
declarations all have to be placed in one giant package (a problem that Ada 
2005 tries to solve, but not very successfully). Eventually, I changed most 
of "links" to use names, which are then looked up in an appropriate index.

...
>> When you start with a poor design, it's not surprising you can only find
>> poor solutions...

>Translation: "I don't understand the purpose of the system, but the
>fact that my proposed solutions are not adequate is a sure proof that
>the original design must be broken." Is that right?

When I'm writing an Ada program, I want a design that can be expressed well 
in Ada. I don't much care whether it can be expressed well in some other 
language. And "well" includes safety against accidental misuse. Use of 
access types in object interfaces almost always compromises safety.

A design that can't be expressed well in Ada is a poor design (presuming you 
are planning to write the program in Ada). It would be the same for Java, 
C++, or any other programming language.

I personally think that callbacks are a poor fit for Ada (possibly because I 
started with Ada 83, where callbacks were impossible). It's not always 
possible to avoid them (i.e. GUI programming), but I don't think they should 
ever be introduced when there is an alternative. And if you do that, you 
don't need the "registration" in the first place. So I think a design using 
callbacks and registration is a "poor design". YMMV.

                                      Randy.





  reply	other threads:[~2010-10-09  6:13 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  7:37 Limited use for limited with? Maciej Sobczak
2010-09-28  9:04 ` Alex R. Mosteo
2010-09-30  7:24   ` Stephen Leake
2010-09-30  9:21     ` Alex R. Mosteo
2010-09-28  9:18 ` Ludovic Brenta
2010-09-28 12:59   ` Maciej Sobczak
2010-09-28 13:45     ` Dmitry A. Kazakov
2010-09-28 21:57       ` Maciej Sobczak
2010-09-29  6:03         ` Ludovic Brenta
2010-09-29  8:25           ` Maciej Sobczak
2010-09-29  7:51         ` Dmitry A. Kazakov
2010-09-29  8:38           ` Maciej Sobczak
2010-09-29  9:16             ` Dmitry A. Kazakov
2010-09-29 12:22               ` Maciej Sobczak
2010-09-29 13:41                 ` Dmitry A. Kazakov
2010-09-29 15:07                   ` Georg Bauhaus
2010-09-29 19:22                     ` Dmitry A. Kazakov
2010-09-29 20:51                   ` Maciej Sobczak
2010-09-29 21:18                     ` Dmitry A. Kazakov
2010-10-05  7:35                     ` Randy Brukardt
2010-10-08  8:05                       ` Maciej Sobczak
2010-10-09  6:29                         ` Randy Brukardt
2010-10-05  7:25             ` Randy Brukardt
2010-10-08  8:23               ` Maciej Sobczak
2010-10-09  6:13                 ` Randy Brukardt [this message]
2010-10-10 14:13                   ` Maciej Sobczak
2010-10-11  6:23                     ` Randy Brukardt
2010-10-12 19:29                       ` Maciej Sobczak
2010-10-12 20:19                         ` Dmitry A. Kazakov
2010-10-13  2:09                         ` Randy Brukardt
2010-10-13  8:44                           ` Georg Bauhaus
2010-10-15  0:59                             ` Randy Brukardt
2010-10-13  9:43                           ` Maciej Sobczak
2010-09-28 15:15     ` Ludovic Brenta
2010-09-28 22:04       ` Maciej Sobczak
2010-09-28 15:54   ` Robert A Duff
2010-09-30  7:27   ` Stephen Leake
2010-09-30  7:33     ` Ludovic Brenta
2010-09-30 16:03     ` Adam Beneschan
2010-10-07 11:55       ` Stephen Leake
2010-10-07 18:27         ` Martin Krischik
2010-10-07 21:30           ` Adam Beneschan
2010-10-09  6:29             ` Martin Krischik
2010-10-09 18:35               ` Robert A Duff
2010-10-08  0:07           ` Randy Brukardt
2010-10-09  6:21             ` Martin Krischik
2010-09-28  9:32 ` Vadim Godunko
2010-09-28 11:34 ` stefan-lucks
2010-09-28 13:15   ` stefan-lucks
2010-09-28 16:55 ` Adam Beneschan
2010-09-28 17:31   ` Robert A Duff
2010-09-28 19:24     ` Adam Beneschan
2010-09-28 20:32       ` Vadim Godunko
2010-09-28 21:32         ` Adam Beneschan
replies disabled

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