comp.lang.ada
 help / color / mirror / Atom feed
From: "David Crocker" <dcrocker@imsltd.com>
Subject: Re: 'withing' problem
Date: Tue, 6 Nov 2001 15:56:33 -0000
Date: 2001-11-06T15:56:33+00:00	[thread overview]
Message-ID: <3be80724$0$238$ed9e5944@reading.news.pipex.net> (raw)
In-Reply-To: ELCF7.13612$xS6.18271@www.newsranger.com

Ted, I think you are saying that when a Patient object calls VisitDoctor, it
should pass all relevant information (e.g. symptom and insurer) as
parameters.

In a simple case this may work well, but consider that, depending on the
symptom and the particular doctor, the VisitDoctor procedure may require
various additional items of information; how old the patient is, whether he
smokes, whether he has a family history of particular diseases etc. These
are all semi-static attributes of the patient. We would end up with a huge
parameter list for VisitDoctor and much of the time, most of these
parameters would not be needed. Surely it is much simpler to have
VisitDoctor request these extra bits of information from the patent as and
when they are required? This certainly doesn't constitute a complex control
flow. Most OO developers would probably not even think of a call to a
side-effect-free member function of an object as control flow at all.

I agree that it is possible to use circular dependencies to create very
complex and hard-to-understand programs, but *any* powerful programming
feature can be used badly.

Regarding the OO model where every object has its own threads, I don't think
the model normally restricts each object to a single blocking thread, at
least in respect of methods that don't change the object's state. Or, to put
it another way, when an object sends a message to another object and is
waiting for a reply, it can still receive and process a message from a third
object before that reply is received, unless synchronisation mechanisms are
used to prevent this.

Regards

David Crocker, Escher Technologies Ltd. www.eschertech.com

"Ted Dennison" <dennison@telepath.com> wrote in message
news:ELCF7.13612$xS6.18271@www.newsranger.com...
> In article <3be65f4c$0$237$ed9e5944@reading.news.pipex.net>, David Crocker
> says...
> >
> >OK, so if you think cross-dependency reflects bad design when the
> >implementation language is Ada, can you tell me how you would redesign
the
> >Doctor/Patent/Insurer example in
> >http://home.bluemarble.net/~jvolan/WithingProblem/FAQ.html ?
>
> Make a new class called "symptom", which the doctor treats, and the
patient has.
> Make another new class called "insurer", which the doctor bills and the
patient
> has (and periodicly pays into). When a patient calls Visit_Doctor, they
pass in
> their symptom(s) and their insurer.
>
> Circular dependancies are just as bad an idea in OO control flows as they
are in
> traditional logic control flows. Think about what used to result back when
> people made their own loops using all sorts of interrelated goto's. When
> designing you should be looking for hierarchy and structure, not just any
old
> path through your objects that seems to work.






  reply	other threads:[~2001-11-06 15:56 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-02 10:24 'withing' problem David Crocker
2001-11-02 10:58 ` David C. Hoos, Sr.
2001-11-02 21:32   ` Florian Weimer
2001-11-02 14:49 ` Robert Dewar
2001-11-05  9:49   ` David Crocker
2001-11-02 15:06 ` Wes Groleau
2001-11-02 15:21 ` Ted Dennison
2001-11-02 17:19   ` Ed Falis
2001-11-02 18:17     ` Preben Randhol
2001-11-02 19:15       ` Ed Falis
2001-11-03  2:52       ` DuckE
2001-11-03  9:50         ` Preben Randhol
2001-11-03  8:25   ` Simon Wright
2001-11-03 17:27     ` Richard Riehle
2001-11-04 10:23       ` Simon Wright
2001-11-08 10:58         ` Preben Randhol
2001-11-08 15:24           ` Peter Hend�n
2001-11-10 17:57           ` Simon Wright
2001-11-05  9:48       ` David Crocker
2001-11-05 20:36         ` Ted Dennison
2001-11-06 15:56           ` David Crocker [this message]
2001-11-07 15:06             ` Ted Dennison
2001-11-07 16:49               ` Darren New
2001-11-09 20:28         ` Matthew Heaney
2001-11-10 13:55           ` Preben Randhol
2001-11-12 15:10             ` Matthew Heaney
2001-11-10 18:12           ` Simon Wright
2001-11-12 15:13             ` Matthew Heaney
2001-11-13  7:01               ` Simon Wright
2001-11-14 16:10                 ` Matthew Heaney
2001-11-15 20:21                   ` Simon Wright
2001-11-15 21:07                     ` Matthew Heaney
2001-11-16 14:37                     ` Stephen Leake
2001-11-17 22:29                     ` Richard Riehle
2001-11-18 14:53                       ` Simon Wright
2001-11-19  5:51                         ` Simon Wright
2001-11-19 15:23                         ` Matthew Heaney
2001-11-19 17:19                           ` 'withing' problem [code generation] Mark Johnson
2001-11-19 20:58                             ` Stephen Leake
2001-11-19 21:20                               ` Matthew Heaney
2001-11-21  6:20                                 ` Simon Wright
2001-11-20  0:50                               ` Mark Biggar
2001-11-21  6:21                                 ` Simon Wright
2001-11-20 14:42                               ` Mark Johnson
2001-11-20 16:34                                 ` David Crocker
2001-11-20 18:34                                   ` Richard Pinkall-Pollei
2001-11-20 18:43                                   ` Matthew Heaney
2001-11-20 20:37                                     ` Mark Lundquist
2001-11-22 11:49                                     ` David Crocker
2001-11-20 20:35                                   ` Mark Lundquist
2001-11-22 11:42                                     ` David Crocker
2001-11-19 19:30                           ` 'withing' problem Preben Randhol
2001-11-03  8:26 ` Simon Wright
2001-11-03  8:38 ` Simon Wright
2001-11-05  9:54   ` David Crocker
2001-11-05 18:04     ` tmoran
2001-11-06 15:29       ` David Crocker
2001-11-07  0:38         ` tmoran
2001-11-07 10:11           ` David Crocker
2001-11-07 18:59             ` tmoran
2001-11-08 11:38               ` David Crocker
2001-11-10 18:03                 ` Simon Wright
replies disabled

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