comp.lang.ada
 help / color / mirror / Atom feed
From: Jeff Carter <jrcarter@acm.org>
Subject: Re: Ada OOP question
Date: Tue, 12 Dec 2000 05:14:16 GMT
Date: 2000-12-12T05:14:16+00:00	[thread overview]
Message-ID: <3A35B45D.5F05F171@acm.org> (raw)
In-Reply-To: 91382k$nq1$1@nnrp1.deja.com

mark_lundquist@my-deja.com wrote:
> Baloney!  How is mixing public and private any more EVIL than having
> all components public, which Ada makes no more difficult than any other
> language?  Arguably, if one feels that some component of an abstraction
> must be public, it's still better to have the rest private than to make
> all public, wouldn't you say?  I think one could make a case that
> public components in general are about the same level of evilness as
> goto, i.e. easy to abuse, but also easy enough not to abuse, and the
> abuse is of a kind that is more a consequence of bad design than a
> cause.

You have presented no evidence to support your claim of baloney. Salami,
perhaps.

Seriously, I was employing hyperbole in describing it as EVIL. However,
I think that this practice should be discouraged. The problem is that
such a type creates an interface that is difficult to understand. What
is the difference between

Op (Object, Param1, Param2);

and

Object.Public_Component := Some_Value;
Op (Object, Param1, Param2);

? They could be the same; Op could perform differently in the 2nd case,
but this be considered valid; or Op could be invalid as a result of the
assignment.

This doesn't bother C++ people, who expect the client to read the
implementation to learn how to use a type. Frequently such components
are used both to shorten parameter lists and store state between calls.
In general, visible components in an abstraction are a bad idea,
including when they are all visible: you cannot change the
implementation without changing the interface.

-- 
Jeff Carter
"I blow my nose on you."
Monty Python & the Holy Grail



  parent reply	other threads:[~2000-12-12  5:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20001209101904.07653.00004016@ng-fy1.aol.com>
     [not found] ` <wvtY5.11680$Ei1.812152@bgtnsc05-news.ops.worldnet.att.net>
2000-12-11 21:52   ` Ada OOP question Randy Brukardt
     [not found] ` <kduY5.4872$M5.273278@news1.frmt1.sfba.home.com>
     [not found]   ` <3A32A182.54E3D857@acm.org>
     [not found]     ` <91382k$nq1$1@nnrp1.deja.com>
2000-12-12  5:14       ` Jeff Carter [this message]
2000-12-14 19:00         ` mark_lundquist
2000-12-14 23:05           ` Jeff Carter
2000-12-12 21:57 ` Stephen Leake
replies disabled

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