Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

理工科系(非資訊相關)學哪種語言好?

0 views
Skip to first unread message

小作家

unread,
Mar 8, 1997, 3:00:00 AM3/8/97
to

最近有越來越多理工學院的學生(甚至老師)開始認為 C (或 C++) 語言可以
取代傳統的 Fortran 語言, 在美國這個問題也討論了一陣子。Quetzal
Associates 的普林提斯博士 (Dr. John Prentice) 對這種情形發表了他的
看法, 寫了以下的一篇短文。自從這篇短文發表之後, 立刻在網路上以許多
種語言流傳著。全文亦刊載在 HP 的 3W 網址上
<http://www.hp.com/wsg/ssa/fortran/f90prent.html>

我把它下載之後稍作版面的整理, 再貼出來供大家參考, 希望普林提斯博士
的看法能分享各位, 如果哪位網友中英文文筆均佳, 不妨將全文譯成中文,
那將是國內讀者之福......

------------------------------------------------------------------

Fortran 90 as a Language of Choice for Science Students


Dr. John Prentice of Quetzal Associates posted this email message
(January 1995) explaining why science students should learn Fortran
90. Since he posted it, this message has been reposted around the
net and republished in several languages.

This document expresses the opinion of the writer and does not
necessarily represent the views of Hewlett-Packard Company. HP is
making this document available for information purposes only, and
is not repsonsible for statements or claims made by the author. For
more information on the contents of this document, please contact
the author directly.

Below is a note I just sent to the chairman of a physics department
which requires freshmen to take a programming class offered by the
engineering department. That course has traditionally taught
Fortran 77, but there is now a push on from the engineering school
to switch to teaching C++. As usual, the arguments being mustered
revolve around criticisms of Fortran 77 by people who are too out
of touch to know much of anything about Fortran 90. In either case,
I was asked by one of the senior physics faculty to contribute my
two cents worth about what language they should be teaching. The
appended note is the one I sent and it summarizes our corporate
experience with C++ and some of our feelings about Fortran 90.
Others may find this interesting since this question is arising
throughout the academic community.

John

Dr. John K. Prentice
Quetzal Computational Associates
3701 San Mateo N.E., Suite I
Albuquerque, NM 87110-1249 USA
Phone: 505-883-3706
Email: jo...@quetzalcoatl.com

------------------------------------------------------------------

My note to the Physics Department:

One of the physics faculty members mentioned to me that the
Engineering school is considering changing Eng 120 to teach C++
instead of Fortran and that you were soliciting comments about this
with regard to physics students. Even though I am not associated
with the university, I wanted to contribute my thoughts, which come
from a commercial as well as a research perspective. Perhaps they
will be of some value to you.

As you know, Quetzal Computational Associates specializes in
computational science. We currently have projects computational
physics, earth sciences, and agriculture for clients which include
DoE and DoD laboratories as well as commercial clients as diverse
as hazardous waste companies and grain companies. During the last
year, we have developed numerical methods and codes based on them
for modeling contaminant flow in porous media, modeling the
structural mechanics of resonant sonic drilling rigs, modeling
bistatic ground penetrator radar propagation in partially saturated
soils, modeling solid dynamics at high strain rates, modeling the
phenological development of corn and soy beans, modeling solar
insolation in the photosynthetically active spectrum based on first
principle atmospheric physics, and developed neural networks for
the detection of dust clouds from satellite imagery.

One of our largest computational physics projects is the
development of advanced methods for modeling solid dynamics based
on first principle physics. This is a multi-year, multi-million
dollar project. This code numerically solves the partial
differential equations for continuum solid dynamics using a hybrid
finite volume/finite element technique, coupled to advanced
equations of state and constitutive models for the solids and
fluids in the calculation. This code and others we work with are
huge number crunching codes, a modest 3d simulation will take 100
or more hours of Cray C-90 time to complete a single calculation.
By any standard, they are amongst the largest computational physics
simulations being done anywhere in the world. In addition, we are
on the forefront in the application of parallel computing to these
problems. We have projects to develop parallel versions of our
codes for a diverse collection of computers, including networks of
UNIX workstations, the IBM SP-2, the Cray T3D, and the Intel
Paragon.

For all of these projects, we employ Fortran 90 as our main
language. We do some development work in Fortran 77, C, and C++,
but we are moving away from those languages as quickly as possible.
There are many reasons for our choice of Fortran 90, but first let
me say a bit about why we are not enthusiastic about C++. The
biggest strength of C++ is probably the availability of relatively
inexpensive and high quality C++ compilers for PCs. But that is a
pretty minor consideration in our business and it is outweighed by
the enormous liabilities we have observed with C++. First, we
regard C++ as the weakest of the object oriented languages.
Objective C is a far more solid and well designed OOPS language,
C++ is really some OOPS capability slapped on top of C. C++ is
consequently extremely inefficient, inconsistent, overly large, and
enormously difficult to program in. The experience of our clients
mirrors our own, and in fact many DoE and DoD laboratories are
finding that their headlong rush to C++ has been a hideously
expensive mistake. I know of several C++ scientific coding projects
in the DoE that consumed millions of dollars and tens of man-years,
only to be abandoned because the resulting code was enormously
inefficient on both traditional serial computers and on their large
parallel supercomputers. Similar horror stories abound throughout
the programming community at this point. Bill Gates claimed that
his biggest mistake in designing their new NT operating system was
adopting C++ for the graphics coding, the resulting code took years
longer to write than it should have and ran terribly slow. While
OOPS is a solid development in the computer science community, I
think it is fair to say that C++ is destined to be a passing fad,
much like Pascal and Ada before it.

The main reason C++ has attracted the attention it has in the
scientific community is because Fortran 77 was a terribly outdated
language. The many weaknesses of Fortran 77 were solved with
Fortran 90 however. Fortran 90 has every feature in C that is
important to scientific programming and most of the features of an
object oriented language (it lacks only inheritance and that is
likely going to be added in Fortran 2000). However, unlike C and
C++, Fortran 90 is designed to generate executable codes that are
highly optimized and thus run extremely fast. An example is
pointers. Pointers are integral to C and C++ programming and
because the compiler cannot determine whether a pointer is aliased,
it is impossible for it to determine interprocedural dependencies.
The result is a significant degradation in optimization and
extremely slow execution speeds (for most scientific codes, C and
C++ generally produce code which is commonly an order of magnitude
slower than Fortran 90 codes, based on the benchmarks we and others
have done). Fortran 90 pointers are designed to give the
functionality of pointers, but with restrictions that eliminate
issues such as aliasing. From a programming perspective however, an
even more important point is that Fortran 90 has more natural ways
of expressing the functionality that C and C++ require pointers to
express. Because of this, Fortran 90 is a more natural language to
program in and the time required for debugging codes is a fraction
of that required by C and C++ (C++ is much worse than C, provided
you are really employing an OOPS paradigm, since you find yourself
spending alot of debug time going up and down inheritance trees).
Another important point is that the time required to learn Fortran
90 is much less than the time to learn either C or C++.

Fortran 90 has another major advantage over C or C++. Modern
scientific computing, and computing in general, is moving toward
the use of parallel computers. Even PCs and workstations now come
with multiple processors, so parallelism is something that everyone
from an accountant to a physicist is encountering now. A major
problem in programming parallel computers however is the linear
memory model that is inherent to all procedural programming
languages, with the singular exception of Fortran 90. A linear
memory model is one that assumes that consecutive elements of an
array are consecutive in memory. This was a reasonable assumption
on traditional computers, but it is completely incorrect on a
parallel computer. Only Fortran 90 has addressed this problem and
providing standardized language support for parallelism. This
support includes array syntax and many intrinsics for doing array
operations varying from reduction operations such as array sums to
matrix operations. With the use of Fortran 90 operator overloading
and polymorphism, one can significantly extend the number of
operations that avoid any reliance on the linear memory model. The
fact that Fortran 90 moved away from a linear memory model is the
main reason that it has become the base for so many data parallel
languages such as Vienna Fortran, Fortran D, CRAFT, and High
Performance Fortran. The availability of data parallel dialects of
Fortran 90 is an especially large factor in favor of Fortran 90.
Compilers for High Performance Fortran, for example, are now coming
on the market for virtually every machine out there (including
networks of workstations) and writing parallel codes in this
language is straightforward. Of particular importance is that
porting a Fortran 90 code to High Performance Fortran is extremely
straightforward and codes written in High Performance Fortran can
be run unaltered on a Fortran 90 compiler (with the exception of
one HPF construct, the forall, which is being put into Fortran 95).

My own opinion is that scientists today need to know more than one
language or one computing paradigm. And I think it is entirely
reasonable that students learn C++ before they graduate, though
even more important is that they learn how to program MATLAB and a
computer algebra system such as Maple or Macsyma. But the issue is
what freshmen should learn as their first language and for that I
would recommend Fortran 90 hands down. It is a better language for
scientific programming and is both easier to learn and use than the
alternatives. It is also much more likely to be the language
students will be employing in their jobs upon graduation and it is
the most promising route currently developing for the programming
of parallel computers.

Copyright 1996 Hewlett-Packard Company.

November 20, 1996

誠實男子

unread,
Mar 10, 1997, 3:00:00 AM3/10/97
to

真是驚訝! 看了才知道C++這麼差!!! Really?
我也用過FPS 4.0寫過程式... 至少M$的Fortran 90 compiler和他說的差多了!!!
可能Lahey的比較好吧... 改天我用HP 715試試看.

平行處理?? 這...這也太扯了. 以現有的compiler來說,應該還沒有吧?
可能是我太討厭Fortran了, 可是只要Fortran向下相容我就不想用 :P

--
[1;33;44m [1;37;47m╭════════╮ [1;33;44m [1;33;44m [0m
[1;33;44m [1;37;47m║ [1;31m誠實為上策 [1;30;47m║ [0m [1;33;44m [0m
[1;33;44m [1;37;47m╰ [1;30;47m════════╯ [0m [1;33;44m [0m
[1;33;44m [0m [1;33;44m [0m
[1;33;44m [0m

[m [1;37m※ 來源:‧蛋捲廣場 bbs.tku.edu.tw‧[FROM: 163.13.141.78] [m

r5

unread,
Mar 13, 1997, 3:00:00 AM3/13/97
to

誠實男子 (honest...@bbs.tku.edu.tw) 提到:
:
: 真是驚訝! 看了才知道C++這麼差!!! Really?
Objective-C 確實在oo方面比較好..
(除了不像c++可以多重繼承...
但是咧...java也沒有呀...還不是用到那邊去...
programming實作上..實在沒什麼在用這個特質耶...


: 我也用過FPS 4.0寫過程式... 至少M$的Fortran 90 compiler和他說的差多了!!!
: 可能的比較好吧... 改天我用HP 715試試看.
m$的產品...嗯...
聽說過有種老鼠叫碩鼠吧!!
ms給我的感覺就像這個...什麼都有..什麼也都不行

: 平行處理?? 這...這也太扯了. 以現有的compiler來說,應該還沒有吧?
有可能用到啦...十年後吧!!

: 可能是我太討厭Fortran了, 可是只要Fortran向下相容我就不想用 :P
可能是Fortran的老師太龜了...
教的時候一副要死不活的樣子.....
其實fortran是很強的...(如果有收一堆副程式..呵..強人一個)

0 new messages