LISTSERV mailing list manager LISTSERV 16.0

Help for TEAM-ADA Archives


TEAM-ADA Archives

TEAM-ADA Archives


TEAM-ADA@LISTSERV.ACM.ORG


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

TEAM-ADA Home

TEAM-ADA Home

TEAM-ADA  February 1999

TEAM-ADA February 1999

Subject:

Ada vs. C++ FAQ

From:

Tucker Taft <[log in to unmask]>

Reply-To:

Tucker Taft <[log in to unmask]>

Date:

Sat, 6 Feb 1999 11:01:19 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (246 lines)

I took the Ada vs. C++ "trade study" sent out a few days ago,
and tried to turn it into an FAQ for such a comparison.  Here
are the results.  Totally unbiased, of course ;-).

Comments and (serious) contributions welcomed.
-Tuck
----------------
Q: Don't software costing model sensitivities show that language selection
   has little impact on cost?

A: It is true that in some models, varying the programming language has
   less effect than variying other parameters.  For example:

      domain experience (18% improvement)
      overall engineering competency (analysts: 29% improvement,
        programmers: 30% improvement)
      programming language (5% improvement).

   However, analyzing these numbers indicates several issues.  First,
   withing a given organization, domain experience and engineering
   competency are relatively fixed.  With a given staff in a given
   organization, a wise choice of programming language may be
   the biggest and most cost-effective lever available.

   Secondly, the amount of improvement due to programming language choice
   clearly depends on the specific languages considered.  If we compare
   Modula-2 and TurboPascal, very little effect may be noticed, since both
   languages have comparable safety and features.  However, if we compare
   Ada 95 and C++, the languages differ dramatically in safety and features.
   The most basic features of C++ (arrays, pointers, casting) are all
   unsafe.  C++ provides no support for multithreading or interrupt
   handling in the language, and there are no guarantees of thread
   safety in implementations of the C++ run-time support, particularly
   in the implementation of destructors and exceptions.  The basic
   features of Ada 95 are all safe, and the language includes built-in
   support for multi-threading and interrupt handling with a requirement
   for thread-safe runtimes in all validated compilers.

   Thirdly, a cost model for traditional waterfall development is
   substantially different from a cost model for a more modern,
   iterative development process, with interleaved development,
   integration, testing, enhancement, requirements analysis, etc.
   In the more modern development process, the robustness, capability, and
   flexibility of the programming language become more critical.
   The more safety and consistency checking built into the language,
   the more rapidly errors can be found and fixed, and the more
   rapidly enhancements can be made without undermining the consistency
   and safety of the overall system.  Furthermore, as systems age, even if
   they were developed using a waterfall process, maintenance and enhancement
   ends up more iterative, and again, the support in the programming language
   for safety and consistency checking has a dramatic effect on the
   productivity and quality of the maintenance and enhancement process.


Q: Isn't the C/C++ tools market much larger than the Ada tools market?
   Doesn't this mean that C++ is a more viable language than Ada
   for building real-time systems?

A: The C/C++ tools market is certainly much larger if you include
   all PC-targeted tools.  However, if you focus just on C++ compilers
   that provide thread-safe runtimes, and that have been validated
   to some level of conformance with the ISO C++ standard, and
   that are designed for use in the real-time systems market,
   the size shrinks dramatically.  On the other hand, the bulk of the Ada
   compiler market is made up of sales of products that provide a thread-safe
   runtime, a validation certificate, and support for mission critical,
   real-time system development.

   The Ada compiler vendor market is strong.  Several vendors, such
   as ACT and Green Hills, have rapidly growing Ada businesses.
   The largest Ada vendor, Rational, is an extremely strong software
   company, with Ada as one of their most important product lines.
   All the major Ada vendors are focused on the real-time systems
   marketplace, and bring extensive expertise to this arena.  Most C++ vendors
   are focused on the desktop market, and generally have little or
   no expertise in the real-time systems arena.


Q: Are there any comparisons which show the relative strengths
   of Ada and C/C++?

A: Unfortunately, there are very few "scientific" comparisons of
   any sort that compare programming language benefits, in use in
   real projects.

   One company that publishes records of language productivity and
   error rates is Software Productivity Research.  Their most recent
   records indicate that Smalltalk has the lowest error rates in
   the desktop arena, and Ada 95 has the lowest error rates
   in the real-time systems arena.  An excellent, if somewhat dated,
   paper comparing Ada 83 and C was written by Steve Ziegler, formerly
   of Rational.  This paper was based on bug reports and bug-fix times
   recorded over several years on tools written in C and Ada 83.
   The evidence showed a striking difference in bug rates and bug-fix times,
   with the tools written in Ada having much lower bug rates, and
   much shorter bug-fix times.


Q: Aren't Ada 95 and C++ similar in capability?

A: It is true that both languages support both object-oriented programming
   as well as more low-level programming capabilities.  However, Ada 95
   provides many more features to support the development of real-time
   critical systems.  For example, the following Ada 95 real-time control
   features are not provided as part of C++:

     1) Portable multithreaded language features, with at least
         30 real-time priority levels
     2) Thread-safe runtimes, including exception handling and
        destructors/finalization
     3) Uniform model for interrupt handling support and control
     4) Portable bit-level control of representation
     5) Packed arrays, with 1, 2, 4, or 8 bits per element.
     6) Delays based on both time-of-day and a real-time clock
     7) Compiler-provided routines for serializing data types as part
        of remote procedure calls or I/O, as well as ability for
        user to substitute their own.

   Furthermore, these capabilities are available in a portable way,
   both on top of off-the-shelf RTOS's (such as VxWorks) as well as
   on "bare" machines.

   In the area of safety critical systems, Ada 95 provides significantly
   more support for building certifiable systems more cost-effectively:

     1) Several Ada vendors provide certifiable run-times, including
        all documentation required by organizations like the FAA
        or the NRC.
     2) Because the Ada user can define their own distinct numeric types and
        subranges, array types, and pointer types, the compiler can
        perform many more compile-time consistency checks.  This
        can dramatically reduce the static analysis time for a large
        safety-critical system.
     3) All of the basic features of Ada are safe.  The unsafe features
        are available only through highly visible unchecked programming
        features, which can be localized or restricted as desired to
        reduce the certification effort.  In C/C++, the basic features
        (arrays, pointers, casts) are all unsafe, making it much more
        expensive to identify and certify all uses of potentially unsafe
        constructs.
     4) Commercial tools are available for further automating the
        certification process (e.g. the SPARK toolset from Praxis, Ltd.)
     5) Ada 95 compilers can automatically enforce project-specific
        restrictions specified using the pragma "Restrictions."


Q: What about the future availability of Ada compilers, especially
   on "new" chips that are designed in the future?

A: The availability of Ada compilers used to lag behind
   behind that of C.  However, because of changes in the
   technology underlying Ada compilers, that is no longer a significant
   problem.  In particular, a number of Ada 95 compilers are now based
   on optimization, code-generation, and run-time technology that is
   shared with C and C++ compilers.  For example, the GNAT Ada 95 compiler
   makes use of the GCC C-compiler optimizer, back end, and gdb debugger.
   In fact, the primary maintainer of the GCC technology is now an employee of
   ACT, the company that developed and maintains GNAT.  As another
   example, the Green Hills Ada 95 technology shares optimizer,
   code generator, and debugger with their C/C++/Fortran product line.
   Finally, AverStar has just announced a prevalidated Ada 95 compiler
   that uses optimized ANSI/ISO C as its intermediate representation,
   an Ada run-time built on top of a standard ANSI/ISO C run-time, and
   generates debugging information that allows C debuggers to debug
   at the Ada level.

   With these various options, an Ada 95 compiler for any new chip
   will be available in the same time frame as any C compiler for the chip.
   Augmenting this sharing of technology with C compilers are
   Ada 95 compilers that generate Java byte code files as their
   output (e.g. AppletMagic and jGNAT), and include a run-time built on
   the standard Java run-time classes.  This means that Ada 95 can also
   be used in environments where Java virtual machines, or Java
   "just-in-time" compilers are available.


Q: Aren't Ada compilers big and slow, and what about the quality of
   the generated code?

A: These days, modern Ada 95 compilers run as fast or faster than
   compilers for other languages.  This is particularly apparent when
   compared with C or C++ compilers attempting to compile very large systems.
   Separate compilation in C/C++ is based on the lexical-level "#include"
   model.  This poses a real challenge for avoiding having to repeatedly
   read include files in a single execution of the compiler.  Kludgey
   and non-portable "pre-compiled header" facilities are provided by
   some C/C++ compilers to address this performance problem.  This
   is not a problem for Ada compilers because separate compilation
   is based on a semantic-level module importation.  There is never
   a need to read the same spec more than once in the execution of
   an Ada 95 compiler.

   Many Ada 95 compilers also have a simplified program library
   model that is strictly source-based, eliminating the need for
   any large disk-based program library.

   Because of changes in the underlying technology, Ada 95 compilers
   now generate code as good or better than C or C++ for the same
   construct.  Because of reduced aliasing concerns, optimizers
   can be more aggressive with Ada programs than C programs.  Redundant
   run-time checks are eliminated by the optimizers built into many
   Ada compilers, and of course all run-time checks can be suppressed
   program-wide, or in specific modules, with the use of a pragma.


Q: What happens if I don't have enough Ada programmers for my team?
   Can my programmers learn on the job?  Is Ada being taught in
   colleges?  Where can I find Ada mentoring?

A: Many companies find that experienced programmers can learn
   Ada on the job given a modest amount of mentoring.  It turns
   out that the Ada compiler itself is an excellent teaching tool,
   because the language was carefully human-engineered to allow the
   compiler to catch most "silly" errors, while the extensive compile-time
   and run-time consistency checks provide guidance on semantic-level
   correctness.

   Ada is one of the most widely taught languages in colleges.  Because
   of its Pascal heritage, its excellent human-engineering, and its
   support for software engineering principles, it has emerged as a
   natural step up for colleges that have taught Pascal in the past.
   In a recent survey of colleges using various languages for teaching
   programming, those using Ada and Scheme were clearly the most
   satisfied with their languages as teaching tools.

   Ada mentoring is available from a number of sources.  Ada has
   an active newsgroup (comp.lang.ada), several extensive web-sites
   (www.adaic.org, www.adahome.com), an active user group
   (www.acm.org/SIGAda), and a vendor consortium (www.adaresource.org).
   Any one of these can supply information on tools and services
   available for the Ada community.


Q: Hasn't C++ already incorporated all the good features that Ada has?

A: C++ has some of the same features as Ada, however the features
   in C++ are generally less safe, suffer from poor human-engineering,
   emphasize writability over readability, or involve more hidden
   overhead.  It is interesting to see C++-like languages like Java and
   Embedded C++ appearing to try to overcome some of the unsafety
   and inefficiency of C++.  Nevertheless, none of these C++ spinoffs
   fully address the fundamentally poor human engineering of C-based
   languages, with "=" vs. "==" confusion, missing "break"s, misplaced
   "const"s, missing "&"s, arrays indexable by any arbitrary integer or
   enum type, no overflow detection, etc.

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

December 2017
November 2017
October 2017
September 2017
June 2017
May 2017
April 2017
January 2017
December 2016
November 2016
October 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
December 2010
November 2010
October 2010
September 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
June 2007
May 2007
March 2007
February 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
January 2001
December 2000
November 2000
October 2000
September 2000
August 2000
July 2000
June 2000
May 2000
April 2000
March 2000
February 2000
January 2000
December 1999
November 1999
October 1999
September 1999
August 1999
July 1999
June 1999
May 1999
April 1999
March 1999
February 1999
January 1999
December 1998
November 1998
October 1998
September 1998
August 1998
July 1998
June 1998
May 1998
April 1998
March 1998
February 1998
January 1998
December 1997
November 1997
October 1997
September 1997
August 1997
July 1997
June 1997
May 1997
April 1997
March 1997
February 1997
January 1997
December 1996
November 1996
October 1996

ATOM RSS1 RSS2



LISTSERV.ACM.ORG

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager