From: brosgol@ajpo.sei.cmu.edu (Benjamin Brosgol)
Subject: Ada / C++ Panel at ASEET
Organization: Software Engineering Institute
Date: Thu, 28 Jan 1993 10:06:16 EST

Recent messages have asked for a summary of the Ada / C++ panel that was
held at the ASEET Symposium (Ada Software Engineering Education and
Training) earlier this month, at Naval Postgraduate School in Monterey.  I
was there; here's my of course impartial summary of what happened.

The scheduled panelists were Ed Schonberg and Robert Dewar from NYU, Jerry
Schwartz from Lucid, Inc. (a company that sells C++ products), and Greg
Aharonian from comp.lang.ada.  (OK, he's officially from Source Translation
& Optimization, but most of you probably know him from his postings to
this newsgroup.)  Unfortunately, Greg was not able to attend; that was
really too bad, for several reasons.  First, it made poor Jerry rather
outnumbered.  He was already feeling like an outsider at an Ada conference,
and having to stand alone against some of the Ada community's most
articulate and knowledgeable representatives is not for the faint of heart.
Second, the more blood-pressure-raising issues in the Ada / C++ debate are
socio/political/economic rather than technical.  Greg has certainly
stressed these points on comp.lang.ada, and it would have been interesting
hearing him in a forum where there were DoD representatives present.  He
even could have walked around without an escort.

The conference organizers had cleverly scheduled the panel for the last
session, figuring that the topic and the reputation of the speakers would
convince attendees to stay around.  They were right; not even the
competition from the week's first rays of sunshine could keep people away,
and the panel did not disappoint.

Ed Schonberg gave a summary of the relative technical merits of C++ and Ada
9X.  Looking at the development of C++, he observed that V1 was a better C
with classes; V2 added multiple inheritance; and V3.5 is introducing
templates and exceptions.  Ada 9X may be viewed as Ada 83 plus classes
(single inheritance), hierarchical libraries, protected types, and flexible
scheduling.  He cited the following as advantages of Ada:
   *   Type safety
   *   Integrated library (versus .h files and make)
   *   Integrated tasking (versus, say, Posix)
   *   Existence as ISO standard [this applies at present to Ada 83,
       not yet for Ada 9X]
   *   Readability / maintainability
   *   Benefits over the life cycle
[Note: I am not trying to instigate a flame war on these points.  I know
that some would argue violently that Ada's inclusion of tasking is a
disadvantage rather than an advantage, that C++ is at least as maintainable
as Ada, etc.  I'm just trying to report what the speaker said.]

Ed cited the following reasons for C++'s popularity:
   *   It's a better C, and it satisfies the needs of an eager culture
   *   Large amount of software capital
   *   Less expensive compilers than for Ada
   *   Object-Oriented features
   *   Simpler system interfaces

He then looked in particular at the issue of Multiple Inheritance ("MI"),
which some may feel is an area where C++ has more expressive power than 
Ada 9X.  But he observed that the "mixin" model may be achieved in Ada 9X 
via generics, formal packages, and access discriminants, and that the other
applications of MI can also be realized directly.  Thus there is no loss of
expressive power, and omitting MI language features avoids semantic and
implementation complexity.

Jerry Schwartz then presented the C++ side.  He identified a number of
issues where language designers have a range of alternatives, and
contrasted the approaches taken in Ada and in C++:

   Static versus dynamic type system: C++ is more dynamic than Ada.

   Procedural (imperative) versus function model: C++ is more functional

   Permissiveness versus safety: C++ is more permissive, but Ada has a
   major loophole in its access type mechanism since it requires
   Unchecked_Deallocation if the programmer needs to assure storage
   reclamation.

   High versus low level: C++ is lower level

He noted that Ada 9X and C++ are roughly equivalent with respect to the
features they provide.  The major exceptions to this equivalence are
Ada's omission of MI, and C++'s omission of tasking.  Regarding MI, he
acknowledged the implementation difficulties and conceded that the
complexity might not be worth it.  He also pointed out that namespace
issues are currently an active item of discussion in the C++ community (for
example, dealing with duplication of names in multiple libraries).

In the area of culture and environment, Jerry noted that C++ has several
advantages over Ada: programmer familiarity, tool availability, and the
existence of libraries.  He related that his company started as a LISP
supplier but moved to C++ based on market issues.  He compared the
development of C++ to that of Ada.  C++ was basically designed by
B. Stroustrup on his own, as an increment from C.  The development was
carried out somewhat in a "spiral" approach: design a little, implement,
try it, design a little more, implement, etc., with standardization
deferred until after there is user and implementor experience.
A disadvantage of this approach is that "nothing comes out".  Once a 
user has produced code exploiting a particular feature, "upward 
compatibility" becomes a strong influence.  Ada, on the other hand,
proceeded with formal requirements, then a design/review phase, then
standardization, and finally implementation and user experience.  Jerry
observed that Ada's path was very much like the traditional (and now much-
maligned) "waterfall" model.  He concluded by remarking that "C++ is
nobody's first choice but everybody's second choice."

The final presenter was Robert Dewar.  His basic point was the observation
of a major philosophical difference between Ada and C++: C++ is more
regular, at the price of language "pitfalls", whereas Ada does not mind
having special case rules in order to avoid unpleasant run-time surprises.
He cited several examples from Horstman's book, "Mastering C++", to
illustrate such pitfalls.  He also noted that programmers from the C and
C++ culture are accustomed to using a debugger to find "off by 1" errors,
whereas in Ada the language syntax make such errors less likely.

Discussion of the role of syntax and language rules in program reliability
led to some debate on the blame for the phone system crash in early 1990.  
The bug was traced to a piece of C code that had the following structure:

   switch (expr) {
      ...
      case ... : { ...
                   if (...) {
                      ...
                      break;
                   }
                   ...
                  }

The programmer had intended that the "break" transfer control out of the
"if" statement.  But that's not C semantics; instead, control broke out of
the enclosing "switch".  One could argue that this bug is evidence of
(1) defective language design, (2) programmer ignorance, (3) lack of adequate
testing, or some combination of these.  Ada apologists tend to focus on (1);
C champions say it's the programmer's and not the language's fault.  
[This point has in fact been argued before on this newsgroup, so please let's
not resurrect the debate.  I am just trying to report what happened at the
panel.  My own opinion on this example is that the responsibility/blame
goes much more to the programmer than to the language design.  "Read The
Friendly Manual" is the expression that comes to mind.]

The panelists did not have formal papers or position statements in the
published proceedings of the conference.  For further information, you may
find the following references helpful:

E. Schonberg, "Contrasts: Ada 9X and C++", in CrossTalk, The Journal of
Defense Software Engineering, Number 36, September 1992.

L. S. Tang, "A Comparison of Ada and C++", in Proc. TRI-Ada '92, ACM
SIGAda, November 1992.

S. T. Taft, "Multiple Inheritance in Ada 9X", in CrossTalk, Number 38,
November 1992.

-------------------
Ben Brosgol
brosgol@ajpo.sei.cmu.edu