The Myths of Fortran

I find it funny when people say things like “It is an old language written for older mainframes”, or even better “It is a very specialized language that require speed of calculations so mostly used in scientific computation or on legacy systems.”. The people that make these comments are clueless. Clueless and naive. They probably think OO is great, and C++ is a perfectly good language.

Yes, Fortran is old, but then so too is C, and few people seem to complain about C, or its derivatives, which are marginal modifications at best. Fortran is 65 years old this year, C is 50. The age of a language doesn’t matter at all. It is it’s ability to do things – and Fortran can do a *lot*. Speed-wise it’s up there with C, and it allows processing things like arrays very easily. There’s also less to worry about from the perspective of memory than say C. People just don’t like Fortran because they have had little or no exposure to it. They like C, or Java, or C++ because that’s all they know. Sure Fortran was once an old language, and there is still plenty of legacy code out there, but modern Fortran is nothing like Fortran I.

Let’s dispel some of the myths:

  • Myth: Fortran is old.
    • Reality: Define old? Modern versions of Fortran are just as useful as any other modern language, without some of the baggage, and still allowing for backwards compatibility. Don’t be ageist.
  • Myth: Fortran has no pointers.
    • Reality: Pointers were actually introduced in Fortran 90, and are many times easier to understand than those in C.
  • Myth: Fortran doesn’t allow recursion.
    • Reality: Recursion was introduced in Fortran 90… if you really need to use it. People tend to think recursion is some sort of panacea, but its not.
  • Myth: Fortran only does implicit typing.
    • Reality: Fortran does have implicit typing rules, but since F77 allows them to be overridden by declaring the variable. Also using “implicit none” invokes explicit declaration for all variables.
  • Myth: Fortran is fixed format.
    • Reality: Fortran allows free-formatting since F90.
  • Myth: Fortran uses lots of goto statements.
    • Reality: Fortran did once use a lot of goto statements in many differing guises, e.g. the ubiquitous arithmetic if. Modern Fortran does not, in fact the Arithmetic if is an obsolescent feature now. Besides which, goto statements don’t write themselves.
  • Myth: Fortran doesn’t use modern programming constructs.
    • Reality: All control structures in Fortran are modern.
  • Myth: Fortran promotes spaghetti code.
    • Reality: No, no, and no again. Yes, there was once a time when Fortran’s structures promoted the use of spaghetti code, but the programmer mentality at the time didn’t help much. You can write unstructured spaghetti code in any language.
  • Myth: Fortran isn’t portable.
    • Reality: Sure, once upon a time there were different Fortran compilers on different systems. People also used 8″ floppy disk drives. But Fortran 66 was the first “standard”. Now, Fortran is no less portable than C. There are standard Fortran compilers for every major platform that exists today.
  • Myth: Fortran is dead.
    • Reality: No, people write Fortran programs every day. The biggest problem is that institutions of higher learning don’t teach Fortran, so many programmers are exposed only to languages of the C family.
  • Myth: Fortran is hard to learn.
    • Reality: Fortran is easier to learn than many languages. The syntax of the language is very easy for anyone who can understand English. It does not overuse symbols to made code more succinct (like C does), does not push pointers on the user (like C does), and does not do stupid things (like C does, e.g. dangling-else).

Fortran is not outdated, nor is it complex, nor a state of mind. Fortran is just as relevant today as any other language, and probably just a tad less complex.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.