Nicolaas Vroom <
nicolaa...@pandora.be> wrote:
[[about
]]
> I do not agree with pragraph 8 :
> "Optimize software only after it works correctly"
> Specific the line:
> " Since faster, lower level, languages require more lines of code to
> accomplish the same task, scientists should write code in the highest-
> level language possible, and shift to low-level languages like C and
> Fortran only when they are sure the performance boost is needed "
> IMO you should write you scientific program directly in
> Fortran, Visual Basic or Pascal because these languages
> are required to give enough detail.
> Speed in most cases is not the issue.
Some research projects benefit from using multiple languages. For
example, my current main research project involves a mixture of
(a) complicated symbolic-algebra computations, which generate series
expansions for...
(b) large numerical computations (typically taking a week to a month of
of CPU time on a dozen or so dual-core processors), which generate
data files for ...
(c) some smaller numerical computations (typically taking less than
a minute on a laptop) to produce our final results
We (my colleague and I) use a mixture of Mathematica and Maple for (a),
a mixture of C++, C, and Fortran 77 for (b), and a mixture of Perl and
C for (c).
There are of course many possible ways to organize this set of
computations, but I think no one language is well-suited for all of
(a), (b), and (c).
For various historical reasons, essentially all researchers working
in this field use Mathematica for (a).
(b) is a "traditional number-crunching" code. Some of my colleagues
use C for this sort of code, some use Fortran 90/95/2003/2008, and I
use C++. Since these codes are already "painfully slow" (running times
of up to a month), I don't see rewriting in higher-level scripting
languages as reasonable for this part of the computation.
The tradeoffs between different languages for this sort of
number-crunching are interesting, but probably outside this
newsgroup's scope.
(c) is an interesting case: This program needs to read 20 or so data
files (written by the (b) computations), match up and sum corresponding
entries in the different data files, do a few hundred least-squares fits
to estimate some additional terms in those sums, incorporate some
coefficients from a small symbolic-algebra computation, and finally
output results.
I wrote a predecessor code in C++, calling Fortran or C libraries for
the least-squares fitting. For this project I write this code in Perl
(calling a C library for least-squares fitting). Given this experience,
, I'm quite confident that the Perl version is preferable to either of
the C++ versions: it's "fast enough" (it typically runs in ~ 30 seconds
on my laptop) while being considerably easier to maintain/modify/enhance
than the C++ versions. I think this is an excellent illustration of
Wilson et al's suggestion
# Since faster, lower level, languages require more lines of code to
# accomplish the same task, scientists should write code in the highest-
# level language possible, and shift to low-level languages like C and
# Fortran only when they are sure the performance boost is needed.
> IMO you should write you scientific program directly in
> Fortran, Visual Basic or Pascal because these languages
> are required to give enough detail.
I'd like to call everyone's attention to a classic Bell Labs tech
report arguing against the use of Pascal for "serious programming":
Brian W Kernighan
"Why Pascal is Not My Favorite Programming Language"
April 2, 1981
currently at
http://www.lysator.liu.se/c/bwk-on-pascal.html
(and many other places too)
--
-- "Jonathan Thornburg [remove -animal to reply]" <
jth...@astro.indiana-zebra.edu>
Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
on sabbatical in Canada through late August 2013
"There was of course no way of knowing whether you were being watched
at any given moment. How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork. It was even conceivable
that they watched everybody all the time." -- George Orwell, "1984"