comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Need advice: Enumerate or not
Date: 16 May 2002 09:03:25 -0400
Date: 2002-05-16T13:10:27+00:00	[thread overview]
Message-ID: <ubsbgdz36.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: slrnae4rr8.58g.randhol+abuse@kiuk0152.chembio.ntnu.no

Preben Randhol <randhol+abuse@pvv.org> writes:

> On Wed, 15 May 2002 12:26:50 GMT, Jim Rogers wrote:
> > The Ada 95 approach is perhaps harder to read, because all the
> > decisions are performed by dispatching and not by explicit
> > branching in your code. On the other hand, the dispatching
> > approach reduces maintenance cost and explicit complexity.
> 
> The only thing I must do is:
> 
> with Some_New_pacakge; use Some_New_pacakge; 

No, the child package where the actual operation is defined does _not_
need to be visible for dispatching to happen. That is crucial to the
dispatching design; the top level Update procedure can be written with
_no_ knowledge of what procedures are actually dispatched to.

> and make sure that the pacakges supply an update fuction.

This is done by making the root operation abstract; then the compiler
ensures that each derived type supplies an update function.


I suggest you write a very simple application that does dispatching,
so you get a better feel for how it works. Model the hierarchy you are
thinking of here, but just do Text_IO, so it's easy to get it working.
Then you can decide how to proceed with the real application.

-- 
-- Stephe



  reply	other threads:[~2002-05-16 13:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15  9:42 Need advice: Enumerate or not Preben Randhol
2002-05-15 12:26 ` Jim Rogers
2002-05-15 14:24   ` Preben Randhol
2002-05-16 13:03     ` Stephen Leake [this message]
2002-05-16 19:05       ` Preben Randhol
2002-05-15 18:00   ` Jeffrey Carter
2002-05-16  0:31     ` Jim Rogers
2002-05-16  2:37     ` Robert Dewar
2002-05-16 10:22       ` Preben Randhol
2002-05-16 17:36       ` Jeffrey Carter
replies disabled

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