From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: basic basic ada question
Date: Mon, 23 Oct 2006 17:08:54 +0200
Date: 2006-10-23T17:08:54+02:00 [thread overview]
Message-ID: <1anu82k75pz5r.1ca9f66hmzfqg$.dlg@40tude.net> (raw)
In-Reply-To: ehijlv$eg3$1@cernne03.cern.ch
On Mon, 23 Oct 2006 16:30:23 +0200, Maciej Sobczak wrote:
> Dmitry A. Kazakov wrote:
>
>>>> 1. T's components
>>>> 2. S's components
>>>> 3. T (Initialize)
>>>> 4. S (Initialize)
>>>> 5. T'Class
>>>> -- here a class-wide constructor defined for T can safely dispatch to a
>>>> -- some primitive operation overridden by S
>>>> 6. S'Class
>>>>
>>>> [I am not sure about ordering 5 and 6]
>>> And I am not sure why do you need 5 and 6 at all - you've already done
>>> the whole job in 3 and 4.
>>
>> You cannot dispatch to the procedures of S from Initialize of T, i.e. from
>> 3 before 4 is done. S might be unusable. The step 5 is for this purpose.
>
> But why would you need to dispatch to S after step 4?
type T is abstract ...;
function Greeting_Message return String is abstract;
procedure Initialize (X : in out T) is
begin
Put_Line ("Hi," & Greeting_Message (T'Class (X))); -- Illegal!
end Initialize;
type S is new T with ...;
function Greeting_Message return String is
begin
return "I am T!";
end Greeting_Message;
>>> For me 4 should
>>> be the last step and 5,6 should not exist at all.
>>
>> Which is indeed a maintenance disaster. Consider GUI interfaces built in
>> C++. Note that practically all of them have procedures like OnInit, because
>> it is eventually impossible to construct widgets fully functional. Ada
>> suffers this as well. For example, it is impossible to embed task
>> components. You need special Start/Stop entries in the tasks.
>
> But then, the construction process will involve the interaction with
> other objects and that's why automating all 6 steps above for a single
> object will not necessarily solve the problem. In the case of GUI, you
> might want to construct widgets somewhere between 4 and 5. The
> OnInit-like procedures provide explicit hooks for this.
> I any case, if there is a way to get rid of OnInit, I think it should be
> possible without 5 and 6 anyway - possibly with additional objects
> involved instead, but I'd prefer more elaborate collaboration pattern
> (which is explicit in the design) in place of more elaborate
> construction mechanism (which is implicit).
OO spaghetti, in short...
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2006-10-23 15:08 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-19 14:30 basic basic ada question markww
2006-10-19 14:47 ` Georg Bauhaus
2006-10-19 15:10 ` markww
2006-10-21 10:29 ` Stephen Leake
2006-10-19 15:11 ` Dmitry A. Kazakov
2006-10-19 15:45 ` markww
2006-10-19 16:29 ` Gautier
2006-10-19 17:16 ` Dmitry A. Kazakov
2006-10-19 20:07 ` Jeffrey R. Carter
2006-10-19 22:20 ` Robert A Duff
2006-10-20 5:10 ` Jeffrey R. Carter
2006-10-20 7:13 ` Maciej Sobczak
2006-10-20 20:39 ` Jeffrey R. Carter
2006-10-20 7:25 ` Maciej Sobczak
2006-10-20 20:54 ` Jeffrey R. Carter
2006-10-19 21:30 ` James Alan Farrell
2006-10-19 23:03 ` Robert A Duff
2006-10-20 4:54 ` Jeffrey R. Carter
2006-10-20 7:53 ` Dmitry A. Kazakov
2006-10-20 8:17 ` Maciej Sobczak
2006-10-20 9:08 ` Dmitry A. Kazakov
2006-10-20 11:15 ` Maciej Sobczak
2006-10-20 12:19 ` Dmitry A. Kazakov
2006-10-20 12:38 ` Maciej Sobczak
2006-10-20 13:26 ` Dmitry A. Kazakov
2006-10-20 15:29 ` Robert A Duff
2006-10-20 17:37 ` Dmitry A. Kazakov
2006-10-20 20:59 ` Robert A Duff
2006-10-21 13:39 ` Dmitry A. Kazakov
2006-10-21 17:53 ` Robert A Duff
2006-10-22 8:45 ` Dmitry A. Kazakov
2006-10-23 7:45 ` Maciej Sobczak
2006-10-23 9:21 ` Dmitry A. Kazakov
2006-10-23 14:30 ` Maciej Sobczak
2006-10-23 15:08 ` Dmitry A. Kazakov [this message]
2006-10-23 15:49 ` Robert A Duff
2006-10-24 7:34 ` Dmitry A. Kazakov
2006-10-20 19:04 ` Simon Wright
2006-10-20 15:27 ` Robert A Duff
2006-10-20 17:37 ` Dmitry A. Kazakov
2006-10-20 21:00 ` Jeffrey R. Carter
2006-10-21 8:19 ` Dmitry A. Kazakov
2006-10-21 17:32 ` Robert A Duff
2006-10-22 8:45 ` Dmitry A. Kazakov
2006-10-30 11:46 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox