comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Another good URL for all you C++ haters
Date: Wed, 05 Sep 2001 21:49:24 GMT
Date: 2001-09-05T21:49:24+00:00	[thread overview]
Message-ID: <3B969DFA.414FAB0@worldnet.att.net> (raw)
In-Reply-To: 87u1yhmitg.fsf@deneb.enyo.de

Florian Weimer wrote:
> 
> chris.m.moore@amsjv.com (Chris M. Moore) writes:
> 
> >   Even Floyd, who loves the language, admits that, "Its greatest
> >   weaknesses is a flaw in the interface/implementation separation. A
> >   class exposes its private data/methods to the world and a programmer
> >   must use some tricks (that should be supported directly in the
> >   language) to overcome this."
> 
> Doesn't have Ada a similar problem?

Similar but not quite as severe.

Ada private data and subprograms are what C++ calls "protected" 
data/methods. Ada's eqivalent to C++ private data/methods is data and 
methods defined in a package body but not in the specification.
C++ public, private, and protected data and functions are normally
declared in a header file. Functions are then defined in the
.CPP (source) file. 

There is no automatic enforcement of separation of implementation and
interface in C++. The entire implementation can be placed in the C++
header file. As with so many other C++ features, only good practice
can produce good separation of interface and implementation.

Compare both C++ and Ada to Java. Most Java classes are defined
without benefit of an interface. In fact, Java interfaces are
most typically used to define a call-back interface rather than to
define common classes. Java does not even provide you the choice 
of using a header file. Java fans proclaim a lack of separation of
interface and implementation to be an advantage because you have
less code duplication.

Jim Rogers
Colorado Springs, Colorado USA



  reply	other threads:[~2001-09-05 21:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-05 11:08 Another good URL for all you C++ haters Chris M. Moore
2001-09-05 12:22 ` Gerhard Häring
2001-09-05 13:43   ` Ted Dennison
2001-09-06 12:04     ` Chris M. Moore
2001-09-06 19:12       ` Robert Dewar
2001-09-07 10:30         ` Chris M. Moore
2001-09-07 11:12           ` Larry Kilgallen
2001-09-08  9:37           ` Florian Weimer
2001-09-05 14:43 ` James Rogers
2001-09-05 21:25 ` Florian Weimer
2001-09-05 21:49   ` James Rogers [this message]
2001-09-06 15:33     ` John McCabe
2001-09-06 16:57       ` James Rogers
2001-09-07 17:54   ` Tucker Taft
2001-09-08 10:11     ` Florian Weimer
replies disabled

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