• No Fun (unregistered)

    FORTRist!

  • Sam (unregistered)

    Lowercase?? That was introduced in Fortran 90, which is positively newfangled.

  • someone (unregistered)

    I wouldn't say that meteorologists get more things wrong than right. This is classic confirmation bias.

  • dpm (unregistered)

    Under no circumstances am I going to look closely at that code --- no entertainment value could be high enough. I have enough crap to look at in my job, and I get paid to do that.

  • P. Wolff (nodebb)

    I used to document the meaning of every. single. abbreviated. variable. name.

    You mean, in the source code? You must have had too much memory at your fingertips. Or be one of those digital native kids.

    Or did you start when we had to document everything on paper? Which is better than having it in the source code in an environment where there weren't only no multi-monitor systems but output was text based with two or three dozen lines only.

    Which makes me wonder whether some No-more-paper-everything-has-to-be-on-screen PHB ordered to throw away tons of documentation, including the folders about the code A. B. inherited. Or/and the guy that knew where in the world/university the cabinet with the documentation folders was located (or even knew about its existence) left years ago.

  • Peter (unregistered)

    Ob: "A Real Programmer can do anything in FORTRAN"

    https://en.wikipedia.org/wiki/Real_Programmers_Don%27t_Use_Pascal

  • Bill (unregistered) in reply to P. Wolff

    Comments don't take up more memory in classic FORTRAN, they take up space in the box of cards.

  • D-Coder (unregistered) in reply to No Fun

    I think you meant "FIRSTran!"

  • TheCPUWizard (nodebb) in reply to P. Wolff

    "You mean in the source code?" -- Pretty sure it was not done on the punched cards!

  • Steve_The_Cynic (nodebb)

    Fortran is one of those languages that attracts a lot of criticism not so much because there's anything wrong with Fortran as such but because it is / was / has been used by a lot of people whose main job is not programming, and therefore a great deal of very bad Fortran code has been written(1), and much of it is still in use. That's about the only similarity that it has with PHP.

    (1) Sometimes even by people who are notionally programmers. A company where I worked about a decade ago still had millions of lines of Fortran left over from its early days, and it was uniformly hard to maintain and of very low "aesthetic" quality. About the only thing that can be said in its defence is that it had been beaten on by daily use so much that it was mostly bug-free in the normal data paths.

    Fragile as fuck, but bug-free.

  • RichP (unregistered) in reply to someone

    Meteorologists get stuff wrong all the time! Those idiots tell us there's an 80% chance of rain, and it seems like 1 out of 5 days they say that, we don't get rain!

    TRWTF is the general public doesn't understand probability. The other weather related WTF I always see is how people react to predictions on the local TV or radio stations. You get a 15 second sound bite for today's weather: Chance of snow ranging from 6-8" in our viewing area. Most people don't think about the fact that the "viewing area" comprises hundreds of square miles and an upcoming storm is (usually) going to affect only part of the area. But, the weather guy was talking to ME therefore the forecast was somehow specific to where I am or where I will be during that event!

  • Bananafish (nodebb) in reply to D-Coder
    <quote> I think you meant "FIRSTran!" </quote>

    I think you meant to say "FRISTran!"

  • Object delete. (unregistered)

    FORTRAN: it is amazing to see how much a language can change without any improvement.

  • Ac (unregistered)

    That code looks exactly like the legacy Fortran code that I've dealt with over the years. It's actually better than some I've seen.

    A co-worker was tasked with modifying one program where all the data was held in one single array helpfully named 'A'. The location (index) within A determined the data's meaning, and locations were repurposed at different stages of running the program. This was an ad hoc method of minimizing memory use in a language with no direct support for virtual memory. I took him literally a year to decode the purpose of all the locations and how they changed as the program ran.

    My personal favorite WTF Fortran moment was when I came across the statement: two = 1.0 Rather than improving the logic of his program, the developer simply redefined the value of the number two.

    My personal best Fortran moment was when I helped a co-worker debug a legacy program. He had been pulling his hair out for days. I offered to help, so he opened a file in an editor. My eyes immediately fell on a variable that was being assigned within a statement (i.e. on the LHS of the '=') and I could see that it was misspelled. We scrolled back through the code and, sure enough, it was spelled correctly everywhere else. The compiler had happily created a new variable with the misspelled name since the first letter of its name matched Fortran's 'implicit' typing rules .

  • airdrummer (unregistered) in reply to Peter

    yesindeedy...switch/case statements r just prettyprinted computed goto's;-) and i inherited code that had been ported to ratfor from f4 from f2 from whatever it was originally in that has variables named for their drum-memory locations;-)

  • Screens? (unregistered) in reply to P. Wolff

    Punch cards and 72 columns maximum.

  • Sole Purpose of Visit (unregistered)

    Even for Fortran IV (or so), this is pretty bad. And I say this as somebody who still has Fortran on his resume, and who last used it (for reference purposes on an engineering job) a year ago.

    Maps are a red herring. I've seen plenty of hash-maps implemented in Fortran (tries are a different matter, what with pointers and all): the only difference is that the guts are (necessarily) hanging out. But you don't need to touch the guts.

    The give-away is that horrendous subroutine signature. What is it, fifteen or so parameters? That would be awful in any language but in Fortran ...

    ... Fortran used to insist (and it may have changed circa F90) that you declare all local variables up front. The results of which you can see in this example, because if you're going to manipulate fifteen subroutine parameters, you're going to need an awful lot of internal state that is probably far removed from actual usage. Fortran is a very easy language to compound your own errors in .... sort of like functional composition, although more like dysfunctional decomposition.

    And nobody mentioned Hollerith? Frist!!!!

  • Piotr Sulecki (google)

    The fact I "loved" most about FORTRAN was that "FOR A=1,5" was a loop executed 5 times, and "FOR A=1.5" (decimal point instead of a comma) was an assignment of value 1.5 to a variable named FORA.

  • LCrawford (unregistered)

    For a short(thankfully) period of time, I maintained a FORTRAN program that ran on an LSI4 computer. It had scads of SHARED variables declared at the top of each module. While tracking down an obscure bug, I decided to see how consistent these global declarations were - was something that was supposed to be global to the module accidentally shared or vice versa? I wrote another program to analyze the scope of these variables and list which modules referenced which variables - the result: I found a misspelled variable; LFLAG had a missing L in the SHARED statement and became LFAG!

    It was a pain to compile on floppy disks - took about an hour.

  • herby (nodebb)

    As someone who grew up with Fortran, it does bring back memories. The first programs I wrote were in Fortran II (no fancy WRITE statements). One Fortran program I worked with was a cross assembler for a 6502 processor that assumed it would only be used for small programs. When expanded (you just increase the dimensions), the logic of it failed miserably. I re-coded the symbol table hash algorithm and the subsequent sort and it ran MUCH faster. Thankfully I forgot lots of it, but a few years ago I got into it again where they were using assigned GO TO's to emulate subroutines and doing it very poorly. I ripped out lots of code on that one.

    Oh, as was almost mentioned in some of the comments, but the correct quote is "One can write FORTRAN in any language". It is a state of mind.

    p.s. I note the use of '&' as the continuation character (in column 6 of course) in the code. I remember when a co-worker just used digits 1-... and when they got to #10 used a zero. Didn't turn out well.

  • Kevin (unregistered)

    I had to convert FORTRAN 4 to Ada in the early days of my career. So, I feel your pain.

  • Erwin (unregistered) in reply to Sole Purpose of Visit

    ... or rather, 5HFRIST

    Also, the language had a data type for complex numbers.

  • bobcat (unregistered)

    low whistle I... Think I need to go lie down now.

    Maybe vodka.

  • Kaewberg (unregistered) in reply to bobcat

    That actually looks fairly clean, for Fortran. I will have a few more whiskeys now though.

  • Oliver Jones (google)

    It does have implicit none. That's a good start.

    Gotta say, making fun of old FORTRAN is like making fun of the signaling gear in municipal subways.

  • Tim (unregistered)

    Looks like classic "job security" coding. Make sure that you're the only programmer and that there are no comments and variable and routine names are as obscure as possible. If the code becomes vital enough and only you can understand it - voila - instant job security!

  • eric bloedow (unregistered) in reply to Piotr Sulecki

    reminds me of a time i tried to write a simple game in old Apple BASIC: i tried to use a variable called "score", but the compiler considers "OR" to be a protected word...but instead of giving an error when compiling, the compiler CHANGED "score" to "sc OR e", ALL THROUGH THE PROGRAM! and since that old computer didn't even have a "search" command, much less a "search and replace" command, it was a terrible pain to fix it!

  • bruce.desertrat (unregistered) in reply to TheCPUWizard

    Uh, I"ve seen card decks with many penciled notations on them...

  • Harrow (unregistered)

    In Fortran IV, "INTEGERS A, B, C" becomes "INTEGER SA, B, C" and A remains implicitly declared REAL when it first appears in the code. The compiler issues no warning that the integer variable SA is declared but never used.

  • Steve The Mob Boss (unregistered)

    Maybe I'm just easily impressed, but if the forecast says there is going to be a snowstorm, and there is a snowstorm, that counts as correct. Certainly if that is the best recent example of the forecast being wrong, then it's doing pretty well.

  • I dunno LOL ¯\(°_o)/¯ (unregistered) in reply to Ac

    "A co-worker was tasked with modifying one program where all the data was held in one single array helpfully named 'A'. The location (index) within A determined the data's meaning, and locations were repurposed at different stages of running the program."

    One can write assembly in any language.

  • urkerab (nodebb)

    The year in which I started University was the last year that they taught FORTRAN by default and the first year that they taught C to first-year students. (I didn't learn anything from either course.)

Leave a comment on “The More Things Change: Fortran Edition”

Log In or post as a guest

Replying to comment #:

« Return to Article