comp.lang.ada
 help / color / mirror / Atom feed
From: jerry@jvdsys.stuyts.nl
Subject: Re: Elimination of "use" clauses
Date: 1999/07/20
Date: 1999-07-20T00:00:00+00:00	[thread overview]
Message-ID: <FF61Lr.6A@stuyts.nl> (raw)
In-Reply-To: 7n0hr7$180@dfw-ixnews21.ix.netcom.com

Richard D Riehle <laoXhai@ix.netcom.com> wrote:

:>I am unfamiliar with the term 'opaque type', perhaps because I never looked
:>at Modula-3. Can you explain what it means ?

: An "opaque type" is a type in which all the details of the type are
: encapsulated in an implementation part of a module.  This is required
: in Modula-3.  Ada allows us to promote some of the definition to the
: private part of the specification.   Ada also allows us to defer the
: details to the pacakge body. 

: In this example, the private part contains all the information about 
: the structure of the stack.  The second Ada example is designed as an 
: "opaque type".  

Aha, yes I can see where the term comes from. Although I didn't know it,
I have been a heavy user of opaque types in cases where I wanted to hide
as much as possible of the actual implementation of the type from the user.

Actually, I thought of this of two styles of programming:

a) use the package body for only the implementation (i.e. functions and
   procedures), keep every else as much as possible in the spec. This
   keeps the body concentrated on the implementation, without being
   'distracted' by a lot of deferred definition. Advantages are, IHMO,
   easier testing. easier finding definitions. It also seems to be in
   the Ada spirit.
   
However, I sometimes feel unconfortable with this approach, switching to
the other style (where Ada allows it):

b) use the spec for exporting only information that the client program
   needs, moving as much as possible to the package body. The advantage
   is a better encapsulation (hmmm, ok, information hiding). Also usually
   less inpact when changing some small details.

As an old dutch proverb says: 'being consistent is develish', I tend to
use both styles. Style b) for things like a File_IO package that has to
run on both NT and Linux: single spec, multiple bodies. Style a) for database
implementations as these are not directly used by the client of the
database package itself.

-- 
-- Jerry van Dijk | Leiden, Holland
-- Team Ada       | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk




  reply	other threads:[~1999-07-20  0:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-01  0:00 Elimination of "use" clauses Dr. Neil C. Audsley
1999-07-01  0:00 ` Joe Wisniewski
1999-07-01  0:00 ` czgrr
1999-07-01  0:00   ` Ted Dennison
1999-07-02  0:00     ` czgrr
1999-07-02  0:00       ` Ted Dennison
1999-07-01  0:00 ` Samuel T. Harris
1999-07-02  0:00 ` Robert Dewar
1999-07-02  0:00   ` Ed Falis
1999-07-03  0:00     ` Joe Wisniewski
1999-07-03  0:00       ` Keith Thompson
1999-07-03  0:00       ` Ed Falis
1999-07-13  0:00     ` Peter Amey
1999-07-02  0:00   ` Ted Dennison
1999-07-02  0:00     ` Ed Falis
1999-07-02  0:00     ` Stephen Leake
1999-07-02  0:00     ` Robert Dewar
     [not found]       ` <7ltus1$ah1@dfw-ixnews19.ix.netcom.com>
1999-07-13  0:00         ` Robert A Duff
1999-07-18  0:00           ` Richard D Riehle
1999-07-18  0:00             ` jerry
1999-07-19  0:00               ` Vladimir Olensky
1999-07-20  0:00               ` Richard D Riehle
1999-07-20  0:00                 ` jerry [this message]
1999-07-20  0:00                 ` Opaque Types (was Elimination of "use" clauses) David C. Hoos, Sr.
1999-07-18  0:00             ` Elimination of "use" clauses Dale Stanbrough
1999-07-20  0:00               ` David Kristola
1999-07-20  0:00               ` Richard D Riehle
1999-07-19  0:00                 ` Brian Rogoff
1999-07-20  0:00                   ` Robert Dewar
1999-07-20  0:00                     ` Brian Rogoff
1999-07-21  0:00                       ` Ted Dennison
1999-07-21  0:00                         ` Robert A Duff
1999-07-21  0:00                         ` Robert Dewar
1999-07-21  0:00                       ` Robert Dewar
1999-07-21  0:00                         ` Brian Rogoff
1999-07-22  0:00                           ` Robert Dewar
1999-07-22  0:00                             ` Brian Rogoff
1999-07-22  0:00                           ` Robert Dewar
1999-07-22  0:00                             ` Brian Rogoff
1999-07-21  0:00                     ` Robert A Duff
1999-07-21  0:00                       ` Michael F. Yoder
1999-07-21  0:00                         ` Robert A Duff
1999-07-23  0:00                 ` Tucker Taft
1999-08-03  0:00                   ` Richard D Riehle
1999-07-19  0:00             ` Ted Dennison
1999-07-19  0:00               ` Tucker Taft
1999-07-19  0:00                 ` Ted Dennison
1999-07-02  0:00   ` Samuel T. Harris
1999-07-02  0:00     ` Robert Dewar
     [not found]       ` <7ltl2q$mog$1@nnrp1.deja.com>
1999-07-08  0:00         ` Michael F. Yoder
1999-07-09  0:00           ` Robert Dewar
1999-07-09  0:00             ` Michael F. Yoder
1999-07-14  0:00               ` Tucker Taft
1999-07-09  0:00             ` Dale Stanbrough
1999-07-12  0:00               ` Robert Dewar
1999-07-12  0:00                 ` Ted Dennison
1999-07-10  0:00             ` Simon Wright
1999-07-12  0:00               ` Robert Dewar
1999-07-09  0:00           ` Richard D Riehle
1999-07-09  0:00             ` Marin David Condic
1999-07-09  0:00             ` Michael F. Yoder
1999-07-08  0:00       ` R. Tim Coslet
1999-07-09  0:00         ` Robert Dewar
1999-07-09  0:00           ` tmoran
replies disabled

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