FORTRAN vs. C



OK,
   I normally steer away from these political issues, but I have had
 enough of these comments favoring FORTRAN.
   In all these messages about structured programming, people seem
 to be missing the point.
 Sure it is important that individual subroutines be written clearly,
 with indentation, meaningful variable names, straighforward control
 structures and suitable comments.
 But the crux of writting code that is extensible and easily
 maintable is modularity (i.e. using subroutines (or methods on
 objects or any other object oriented analog) that do a well defined
 thing and work on a known set of variables).
 FORTRAN does not have structures (although a few extensions have
 records). Since most reasonably complex (as scientific codes usually are)
 programs have dozens or hundreds of variables, the only way of passing
 the data into routines in FORTRAN is:
   1) Use common blocks to keep global data.
   2) Have subroutine calls with literally dozens or hundreds of arguments.
 The second approach is clearly infeasible and the former approach
 guarantees lack of modularity. For instance, let's say you want to
 modify a program to support two separate molecules instead of one. With
 FORTRAN global common block variables, you have no recourse but to
 rewrite the whole program; with C where you pass a pointer to a molecule
 structure into a routine, all you have to do is rewrite the calling
 routine.
 Yes FORTRAN is great for computational kernels. It has highly optimized
 compilers, and the form of the code strongly resembles the equations that
 it represents. But for data manipulation and extension of code based on
 pre-existing modules, and as I can attest the VAST majority of commercial
 computational code is just that, FORTRAN, without structures, is totally
 inadequate.
 	Jon