Karen-
I am an extremely biased source: I have written a lot of Fortran over the years,
I like Fortran very much, I am in charge of marketing a Fortran development
environment, I work for a major computer vendor, and I have never been able to
learn C++ despite trying twice (which may cause you to question my intelligence
as well as my objectivity, which is fair...). I am also quite opinionated on
this topic.
For God's sake, use Fortran!
First off, your criticism of Fortran 90 is fair, and, in all fairness, our
(Sun's) Fortran 90 has been one of the compilers that has given Fortran 90
something of a "black eye." Up until the release we made two weeks ago (see
http://www.sun.com/workshop/fortran for details) Sun's Fortran 90 compiler would
be likely to produce code that was half as fast as the equivalent FORTRAN 77
code. In the latest release, however, our Fortran 90 produces code that is
within a few percent of the speed of the equivalent FORTRAN 77 code, and I
believe that all the major vendors are now exhibiting similar results. Just as
moving from FORTRAN 66 to the more-structured FORTRAN 77 entailed the loss of a
little performance and a small amount of code bloat (am I giving my age away
here?), the move to Fortran 90 will cause a similar effects. However, the move
from FORTRAN 66 to FORTRAN 77 brought with it an order of magnitude improvement
in ease of writing and maintaining code, and I think the move from FORTRAN 77 to
Fortran 90 can bring similar levels of productivity improvements.
Fortran has always had the advantage of being simple enough for scientists and
mathematicians to use; one doesn't need a degree in computer science and ten
years of classes in programming to write Fortran. To program well in C++, on the
other hand, is much more difficult, because it is an extraordinarily complex
(and rapidly-changing) language. While there are amazing things one can do with
C++, I think it takes a very long time to get to know the nuances of the
language well enough to be able to debug someone else's complicated C++
programs. The reason there are so many millions of lines of "legacy" Fortran
still running is that folks have, over the years, been able to take old code and
be able to understand it well enough to keep it running. I don't think that C++
will have the same legacy.
Your concern about the ease of finding college graduates who know Fortran versus
graduates who know C++ is, of course, well-taken: almost all computer science
graduates today know C++, and almost none know Fortran when they graduate.
However, they probably don't know your coding rules and methodologies, so you
are probably still going to have a steep learning curve for new graduates.
Furthermore, graduates in physics, math, chemistry, and geology are still more
likely to be trained (if they have programming skills at all) in Fortran than
C++, and it is going to be far easier to get those who don't have programming
skills "up and running" in Fortran than in C++. Let me say it again: C++ is a
difficult language to learn and use well.
Another issue you raise is moving from FORTRAN 77 to your new environment. I
believe that all the currently-available C++ compilers can link in FORTRAN 77
code with certain constraints, but FORTRAN 77 is a subset of Fortran 90, so
going with Fortran 90 should make it much easier. In the case of Sun's
compilers, we offer a standard-compliant Fortran 90 compiler and a FORTRAN 77
compiler that implements the standard and a slew of popular extensions not
available in the Fortran 90 compiler. We also offer the ability to freely
intermingle the code generated by the two compilers, so you can continue to
compile your old code with FORTRAN 77 (and make use of the extensions you need)
and compile your new code with Fortran 90. I believe many of the other vendors
have moved many of the popular FORTRAN 77 extensions into their Fortran 90
compilers; so, either way, you should be able to move gradually from FORTRAN 77
to Fortran 90 with relative ease. Requiring that you be able to link in FORTRAN
77 routines, however, is going to limit what you can do with C++, particularly
with regards to how you use data structures that can't be easily passed between
the two languages.
Finally, however, is the issue of performance. I firmly believe that simpler
languages are easier to compile to fast code than more complex languages. If one
writes Fortran code in C++ (i.e. using simple data and control structures and
using none of the advanced object-oriented constructs available in the language)
one can achieve similar performance in either language. But what has been
gained? The only reason to use C++ is to use overloading (which Fortran 90 also
implements, and is usually a bad idea from a maintainability perspective),
inheritance, exception throw/catch, and other code constructs that potentially
(and usually) destroy performance. If you really think the programmer
productivity you gain from using C++ overcomes the loss of performance (which
can be quite dramatic), then the choice is clear. However, I doubt that the
tradeoffs are that obvious: programmer productivity is a difficult thing to
measure. I have heard of folks having "bake-offs" in which two groups of
developers are tasked with developing a small application, each using different
methodologies, but even when these comparisons are fair (i.e. it is equally
difficult to perform the task at hand using either methodology) they don't
consider the entire lifetime cost (updates, bug fixes, ports, etc.) of the
project.
Those are my thoughts, and I shall be interested to hear what you decide, either
way (we sell a very good C++ development environment, as well, he says with
clear self-interest). It'll be fun to hear what a similarly-biased C++ bigot
will say.
I hope my comments, however biased, are useful to you.
-Bill Moffitt
Karen Goodger wrote:
>
> Our company is currently involved in a modernization project of our
> seismic processing system. Most of our code is written in fortran77.
> We are currently in a debate as to whether to go with fortran90 or C++.
> One of the reasons for considering C++ is the perceived difficulty in
> finding programmers who know fortran. Another reason is the maturity of
> fortran90 compilers. We have found fortran90 to run our code less
> efficiently than fortran77. In either case, we do not intend to rewrite
> all of our current fortran77 code in a new language, but would write the
> backbone of our processing system in the new language as well as any new
> code. Our code is currently Cray dependent, and part of this effort
> will be to make the code portable.
>
> I would appreciate any comments on the above two fears concerning
> fortran90.
>
> Karen
--
======================================================
Bill Moffitt Product Manager, Performance WorkShop
[log in to unmask] (650) 786-8886
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|