comp.lang.ada
 help / color / mirror / Atom feed
From: gisle@krake.ii.uib.no (Gisle S{lensminde)
Subject: Re: Fortran or Ada?
Date: 1998/09/22
Date: 1998-09-22T00:00:00+00:00	[thread overview]
Message-ID: <slrn70dv6k.2qp.gisle@krake.ii.uib.no> (raw)
In-Reply-To: 36068E73.F0398C54@meca.polymtl.ca


> Dear Fortran experts:
> 
> A friend of mine (a computer engineer who uses C++) insists that Ada95
> is the best programming language for scientists and non-computer
> engineers . His reasons:
>
> (from: http://www.adahome.com/Tutorials/Lovelace/s1s1.htm)

I have tried to make answers to some of the question. My experiences
is from Ada95, C, C++, Fortran77 and Java, and not so much f90.
the answer is also sent comp.lang.ada.

> 1. Packages (modules) of related types, objects, and operations can be
> defined.

Modules exists in Fortran 90 also, and is even inspired from Ada.

> 2. Packages and types can be made generic (parameterized through a
> template) to help create reusable components.

That is also in Fortran 90/95 AFAIK.

> 3. Errors can be signaled as exceptions and handled explicitly. Many
> serious errors (such as computational overflow and invalid array
> indexes) are automatically caught and handled through this exception
> mechanism, improving program reliability.

Yes, and this detects many errors, but I think some Fortran 90 compilers
also checks indexes, if you ask them to do so. Maybe not as good 
as Ada. 

> 4. Tasks (multiple parallel threads of control) can be created and
> communicate. This is a major capability not supported in a standard way
> by many other languages.

Yes

> 5. Data representation can be precisely controlled to support systems
> programming.

Yes.

> 6.A predefined library is included; it provides input/output (I/O),
> string manipulation, numeric functions, a command line interface, and a
> random number generator (the last two were available in Ada 83, but are
> standardized in Ada 95).
> 7. Object-oriented programming is supported (this is a new feature of
> Ada 95). In fact, Ada 95 is the first internationally standardized
> object oriented programming language.

Yes, but the model for OO is a litle bit unusual, compared to other 
languages.

> 8. Interfaces to other languages (such as C, Fortran, and COBOL) are
> included in the language (these have been significantly enhanced in Ada
> 95). At least one Ada compiler (from Intermetrics) can generate Java
> Virtual Machine (J-code) from Ada, so people can use Ada to develop Java
> applets and applications.

Interfaces to other languages is often important, and yes Ada 95 does 
this in a portable way, and I often miss that in C++, but I have no
experience with the Appletmagic compiler.

> After reading these reasons, following questions came to my mind: (mind
> on an engineer who has to use F77/90, sometimes C)
>
> 1) I know some of these capabilities is already supported by the Fortran
> standard and some of them will be added to the next release...is Fortran
> late? How can I convince the new generation of engineers to wait for the
> next Fortran standard to have all of these capabilities?

Some of the most important features it in f90/95 already, like modules,
dynamic memory allocation, generics, data structure constructions  
and other modern features, but you will probably wait long for some 
features in Ada, like strong static typing all trough the language.
To sit down waiting for the next standard is not the best way of 
using your time. 

> 2) Is there any comparison between performance of Fortran90/95 and Ada95
> compilers?

It is difficult to compare two different languages in a fair way. For
example
Ada has index checking and exception handling wich Fortran doesn't. 
You can of cause turn off these, but it's often valuable to use them, 
becase they trap bugs on an early stage, and makes the code more 
reliable Such features has a performance penalty. 

But if we write comparable code in both languages, I would think that 
Fortran would win in a raw speed test, because some of the Fortran 
compilers optimize extremly well.

> 3) It seems that Ada is  the most popular language for safety-critical
> systems. Why Ada? Why not Fortran or C++? What makes Ada suitable for
> this kind of programming?

Strong and static typing, extremly well defined syntax and semantics
and very reliable compilers made for the purpose, well defined and
reliable interface to lowlevel features, multitreading built in
to the language, and a language designed for the task.

C++ disqualifies from critical code for several reasons. Things like
pointers and pointer aritmetrics and the possibility to cast everything to 
everything, makes the language unsafe. Many such systems must 
have total control of memory usage, and no dynamic memory usage is
allowed in many cases, and makes C and C++ is impossible to use in the 
highest safity levels. (But C is used in some safity critical stuff 
anyway, and C is widely used for embedded targets.)

Fortran do not have all the weakneses of C this respect, but is still
not design for such tasks. The weak typing, is the bigest problem here.
Historically, implicit variables have caused problems in safety critical
code, but with IMPLICIT NONE that should not be an issue.

> 4) What can Fortran offer to the engineers that Ada can't? (except
> backward and legacy code compatibility)

Engineers are familar with Fortran, and knows what it stands for. In an
organization, it is often difficult to change. Its easier to go for
Fortran90/95 (Often even that is very difficult). Anyway, many of the
most important features that helps increasing the software design and 
quality, can be found in modern Fortran. The danger is that everything
still looks like Fortran66 :-(, and not like the, say the F subset 
of Fortran 90, and the spaghetti remains. A conversion to f90 from f77
must be followed by training in the new principles.

Ada still have a better static and dynamic type checking, and have 
syntax and sematics designed for good software engineering,
early detection of errors, exception handling and OO, so Ada
is my choice, if no compromises should be taken.

> I know the answers to these questions could be long and/or they are
> already discussed. I appreciate if you point me to the related
> references.

I have not seen any direct comparision between f95 and Ada95, so
general info about both languages is probably the best source of
information. I have used Ada more than Fortran, so it's most Ada 
in my references.

http://www.adahome.com - Ada information, this site contains pointers to

http://www.gnat.com - A free professional quality Ada 95 compiler

http://www.adahome.com/Ammo/cpp2ada.html 
Ada for C and C++ programmers.

http://www.fortranlib.com - Fortran info

http://www.hpctec.mcc.ac.uk/hpctec/courses/Fortran90/F90course.html
f77 to f90 conversion course.

http://www.ifs.hr/ifs/razno/calc/HTMLF90Course/HTMLNotes.html
f90 notes






       reply	other threads:[~1998-09-22  0:00 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <36068E73.F0398C54@meca.polymtl.ca>
1998-09-22  0:00 ` Gisle S{lensminde [this message]
1998-09-22  0:00   ` Fortran or Ada? Jeff Templon
1998-09-22  0:00     ` dewarr
1998-09-23  0:00       ` Jeff Templon
1998-09-23  0:00         ` Corey Minyard
1998-09-24  0:00           ` Joel Seidman
1998-09-24  0:00           ` Craig Burley
1998-09-25  0:00             ` dewarr
1998-09-25  0:00               ` Jonathan Guthrie
1998-09-26  0:00               ` Craig Burley
1998-09-26  0:00                 ` dewarr
1998-09-26  0:00                   ` Craig Burley
1998-09-26  0:00                   ` Robert B. Love 
1998-09-24  0:00         ` Marc A. Criley
1998-09-24  0:00           ` Jeff Templon
1998-09-25  0:00             ` dewarr
1998-09-25  0:00             ` Dale Stanbrough
1998-09-30  0:00               ` Daniel Barker
1998-09-30  0:00                 ` Lawrence Kirby
1998-10-01  0:00                   ` Aaron Crane
1998-10-02  0:00                 ` Fortran or Ada or gobbledygook? Wes Groleau
1998-10-05  0:00                 ` Fortran or Ada? Terry Devine
1998-09-24  0:00           ` dewarr
1998-09-24  0:00             ` Robert I. Eachus
1998-09-24  0:00               ` William Clodius
1998-09-25  0:00                 ` dewarr
1998-09-25  0:00               ` dewarr
1998-09-25  0:00                 ` Robert I. Eachus
1998-09-25  0:00                   ` dewarr
1998-09-25  0:00             ` jbs
1998-09-26  0:00               ` dewarr
1998-09-28  0:00                 ` jbs
1998-09-29  0:00                   ` Gautier.DeMontmollin
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` William B. Clodius
1998-09-30  0:00                     ` jbs
1998-09-30  0:00                       ` dewarr
1998-09-30  0:00                         ` jbs
1998-09-30  0:00                           ` William Clodius
1998-09-30  0:00                       ` William Clodius
1998-10-03  0:00                       ` Niklas Holsti
1998-10-03  0:00                         ` Toon Moene
1998-10-03  0:00                           ` Niklas Holsti
1998-10-03  0:00                             ` Toon Moene
1998-10-04  0:00                               ` Niklas Holsti
1998-10-05  0:00                                 ` Michel OLAGNON
1998-10-05  0:00                                   ` Ian St. John
1998-10-05  0:00                                     ` Richard D Riehle
1998-10-05  0:00                                       ` dewarr
1998-10-05  0:00                                     ` dewarr
1998-10-05  0:00                                       ` Ian St. John
1998-10-06  0:00                                         ` dewarr
1998-10-06  0:00                                           ` Ian St. John
1998-10-08  0:00                                             ` Gary L. Scott
1998-10-08  0:00                                             ` Offtopic Airport Diversion (Was: Fortran or Ada?) Harold Stevens ** PLEASE SEE SIG **
1998-10-08  0:00                                               ` Ian St. John
1998-10-06  0:00                                           ` Fortran or Ada? Toon Moene
1998-10-06  0:00                                             ` Jonathan Guthrie
1998-10-06  0:00                                           ` James Giles
1998-10-06  0:00                                             ` Mark A Biggar
1998-10-06  0:00                                               ` James Giles
1998-10-07  0:00                                                 ` dewarr
1998-10-07  0:00                                             ` dewarr
1998-10-06  0:00                                     ` Michel OLAGNON
1998-10-07  0:00                                       ` Ian St. John
1998-10-02  0:00                   ` Robert I. Eachus
1998-10-02  0:00                     ` jbs
1998-10-02  0:00                       ` William Clodius
1998-10-03  0:00                         ` jbs
1998-10-03  0:00                           ` Larry Elmore
1998-10-06  0:00                           ` Robert I. Eachus
1998-10-06  0:00                             ` Pat Rogers
1998-10-02  0:00                   ` Geoff Bull
     [not found]           ` <6udre0$ha1$1@nnrp1.dejane <6utg60$h6l$1@nnrp1.dejanews.com>
1998-10-01  0:00             ` robin_v
1998-09-22  0:00     ` Corey Minyard
1998-09-22  0:00     ` Larry Kilgallen
1998-09-22  0:00     ` Rakesh Malhotra
1998-09-23  0:00     ` Frank Ecke
1998-09-23  0:00   ` bglbv
1998-09-23  0:00     ` Robert I. Eachus
1998-09-24  0:00       ` Richard D Riehle
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
  -- strict thread matches above, loose matches on Subject: below --
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-09-23  0:00 ` Gisle S{lensminde
1998-09-24  0:00   ` John McCabe
1998-09-24  0:00     ` Dean F. Sutherland
1998-09-24  0:00     ` Gisle S{lensminde
1998-09-24  0:00 ` Samuel T. Harris
1998-09-24  0:00 Walt Brainerd
1998-09-25  0:00 ` dewarr
1998-09-25  0:00 ` Robert I. Eachus
1998-10-05  0:00 robin
1998-10-05  0:00 Condic, Marin D.
1998-10-05  0:00 Robert I. Eachus
replies disabled

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