17
$\begingroup$

I'm a Mechanical Engineering student interested in the field of aerospace engineering where, I'm told, Fortran is still commonly used.

Which version of Fortran should I invest my time to learn?

$\endgroup$
27
$\begingroup$

It's a bit of a popular misnomer that there is a "version" of Fortran to know. With rare exception, the latest Fortran standards (and compilers) retain excellent backwards compatibility with older standards. This is with good reason: not many people would use Fortran today if it weren't for the large amounts of legacy code still in use. That is to say, a standards-compliant Fortran77 code will almost invariably still work with the latest compilers.

You should learn to use the most modern version of the language available. F2008 might not have added anything terrible useful to a beginner, but F2003's introduction of object-oriented concepts is definitely a big deal. "Modern Fortran Explained" is a decent place to start, and "Scientific Software Design: The Object Oriented Way" is also pretty good for actually learning to put it into practice.

Pragmatically, if you're going to be working on legacy code (say F77 or earlier), at some point you'll have to learn some of the things they did because of a lack of F90+ features. For example, if you're writing Fortran code for something, you should never use what's called a "COMMON block", but you will invariably see them come up in F77 code you might have to use.

I would never recommend someone start working in Fortran without at the very least the F90/95 feature sets.

That said, if you're not well versed in programming in some other language, you would probably find a consensus that Fortran isn't the best language to learn as your first, even if you're going after aerospace. (And I say that as someone in aerospace that uses Fortran regularly and had it as my first language).

$\endgroup$
  • 2
    $\begingroup$ +1 "I would never recommend someone start working in Fortran without at the very least the F90/95 feature sets.". I second that. Start with F90, learn all the basic features, practice a few programs, then move onwards to more recent releases $\endgroup$ – Tymric Nov 11 '14 at 23:59
  • $\begingroup$ IF not Fortran what language is worth learning and will be practical to use in engineering? How's Matlab? I need it for a course I'm taking next semester. $\endgroup$ – user26358 Nov 12 '14 at 3:31
  • $\begingroup$ @user26358 Python for general purpose programming, it has a lot of traction in the science community. R for statistical analysis. MATLAB, Mathematica or Maple (whatever your class is using) for numerical computing. SQL for relational databases. Javascript for web stuff and because it is becoming the lingua franca. I wouldn't bother with Fortran until one of those can't get the job done, it's not a pleasant language to learn as your first. $\endgroup$ – Schwern Nov 12 '14 at 4:36
  • $\begingroup$ @Aurelius, I agree with your last paragraph. I believe that the right way to learn scientific programming is exactly the opposite I experienced: python->C++ and in case you need it Fortran. $\endgroup$ – Nicola Cavallini Nov 12 '14 at 15:11
  • $\begingroup$ @user26358 Matlab is good and you'll probably use it a hell of a lot in school. Python is a good place to start with general-purpose programming, and it's numpy/scipy modules can do most of the things you'll probably be doing in Matlab, and it's a good place to learn fundamentals of writing software. You should definitely have at least one compiled language under your belt too; C++ would be the most popular choice. $\endgroup$ – Aurelius Nov 13 '14 at 13:42
1
$\begingroup$

I disagree with both of you. C++ and Python are still not as optimized as FORTRAN. I would definitely agree that FORTRAN 90/95 is the minimum. However, it is always useful to use other more modern versions. The challenge with FORTRAN is that if you learn it before you learn object oriented languages, it is easy to understand. It is much harder to learn if you are used to thinking with objects. I teach the supercomputing class here and I force my students to use FORTRAN. It forces them to use a different sort of logic in programming. They don't like it because it doesn't "think" like Python or C++. It all really comes down to what you intend to do and how much parallization and performance matter.

$\endgroup$
  • $\begingroup$ Welcome to SciComp.SE. This looks more as an opinion than a question for the site. If you consider that Fortran "[...] forces them to use a different sort of logic in programming" you should elaborate the argument, and tell us why is this. And also, what is this "sort of logic" that you mention. $\endgroup$ – nicoguaro Jul 29 '15 at 23:47
  • 2
    $\begingroup$ @tmwitten: Is this answer supposed to be a comment? It's probably too long to be a comment, and out of context, looks like a non sequitur (e.g., C++ and Python aren't mentioned in the question, "both of you" seems to refer to Nicola and Aurelius). $\endgroup$ – Geoff Oxberry Jul 30 '15 at 0:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.