Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming IT Technology

How Not to Write FORTRAN in Any Language 502

gManZboy writes "In an article that's sure to p/o Fortran programmers, Donn Seeley has assembled a rant that posits there are characteristics of good coding that transcend all programming languages, except Fortran. Seriously though, his point is that early FORTRAN made coding ugly. Thus the joke 'Don't write FORTRAN' was applied to anyone with ugly code. Though Fortran has in recent years overcome its early challenges, the point -- 'Don't write FORTRAN' (i.e. ugly stuff) -- still applies."
This discussion has been archived. No new comments can be posted.

How Not to Write FORTRAN in Any Language

Comments Filter:
  • by ChuckleBug ( 5201 ) * on Friday January 28, 2005 @02:36PM (#11505942) Journal
    When I took computer programming in high school, it was all FORTRAN. We used a wonderfully dry textL FORTRAN IV with WATFOR and WATFIV. We didn't have any sort of microcomputer (this was 1980, and we were behind the times even then), but we had a keypunch, so we'd write code on a form, punch cards, rubber band 'em together, and send them off to be run on the district's big iron. Then you'd wait a week and get back a few sheet of green and white striped paper with ***SYNTAX ERROR*** all over it. And we liked it that way!

    Although that was a toothache of a programming experience, I have never lost this bizarre fondness I have for that ugly, unwieldy, but somehow cool FORTRAN. Writing that stuff makes you feel like you're talking the language of a retro-scifi computer, like the ones in the original Star Trek that spoke in that odd mechanical monotone. Robby the Robot had to
    have been programmed in FORTRAN (and NO he was NOT a guy in a suit! I'm not listening! La la la!).

    At any rate, old-fashioned FORTRAN may deserve to be bashed, but I can't help shedding a tear.
    • by Anonymous Coward
      "Besides, the determined Real Programmer can write Fortran programs in any language." - Ed Post

      see: http://www.pbm.com/~lindahl/real.programmers.html

    • by fm6 ( 162816 ) on Friday January 28, 2005 @03:05PM (#11506360) Homepage Journal
      The problem with FORTRAN is that it was the very first high-level programming language. ("High-level" meaning a language that allows you to think in formulas and variables, not operation codes and registers.) So they had to make all the mistakes that taught computer scientists how not to write a grammar. Which mistakes produced a language that is both difficult to code and difficult to parse.

      Unfortunately, FORTRAN has achieved a role in scientific computing it will probably never lose. One co-worker of mine was a recent physics PhD who spent his entire academic career trying to persuade his fellow scientists that they'd save themselves a lot of grief by switching to C -- with no success.

      • hardly unfortunate (Score:5, Interesting)

        by hawk ( 1151 ) <hawk@eyry.org> on Friday January 28, 2005 @03:46PM (#11506870) Journal
        For certain purposes (including most of what I do), fortran is unmatched.

        It is *possible* to write C that runs as fast as Fortran for heavy math. However, it involves hand-optimizing your C until this happens.

        Fortran handles calculations quite well, thank you. It take less Fortran code to handle many common operations, and array options are built in and optimized to high heaven.

        With Fortran 90 and 95, the grammars that led to the CS horror (e.g., computed gotos) are marked either deleted or obsolescent (meaning expect deletion in another standard or two).

        Also, due to the selection of which features are included in Fortran and which are not, Fortran compilers can make much stronger assumptions than, for example, C compilers working with pointers.

        There's nothing unfortunate at all about Fortran's (not FORTRAN any more) role in scientific computing. The tragedy is the number of people who bought into those silly C campaigns.

        hawk
        • by joggle ( 594025 )
          It is *possible* to write C that runs as fast as Fortran for heavy math. However, it involves hand-optimizing your C until this happens.

          With libraries like SPOOLES [netlib.org] I don't need to. One of the primary advantages of C is the availability of many libraries out there that have been developed over the years. Of course, this is in general. In specific domains (like particle physics) the great deal of Fortran code out there ensures that the language won't go away any time soon.

    • Who still remembers IF comparatives,greaterline,equalline,lessline? :)
      (I think this was circa Fortran IV...)

      Oh man, writing code with nested loops and multiple comparisons was a /nightmare/...
    • True enough ... and if you programmed on punch-cards, you got a much better understanding of the structure of FORTRAN, and why it was designed that way.

      COBOL too ... interesting that it hasn't been mentioned in either the article, or the comments I've read so far. *grin*

      • Tended to be FORTRAN for scientific computing and COBOL for business computing, with the two groups never communicating with each other.
        Then there was PL/I which allows writing FORTRAN and/or COBOL within an ALGOL structure.

        In addition to the punch-cards, remember that second generation mainframes were the equivalent of 64k bytes. Cramped, very cramped. The 7070 was 10,000 10-digit words (decimal) with three signs, which comes out in the same neighborhood.
    • the keycard punched YOU!
    • by Anonymous Coward
      You had new punch cards to use? Back when I was in high school we had to recycle old punch cards from national elections, fill in the holes with white-out, cut new holes with our pen knife then tie them together with catgut!
    • by Lodragandraoidh ( 639696 ) on Friday January 28, 2005 @03:32PM (#11506690) Journal
      I just had a flashback to 1981...

      My highschool offered its first computer science course, and I took the first class.

      We had Apple computers running Basic, NEC (or was it NCR?) machines running Fortran, 2 terminals and a printer/terminal connected to a mini computer at school district headquarters.

      I don't recall the specifics of the version of fortran - all I recall is you would actually boot the machine into a fortran interpreter, then you would type in your program by hand and run it. We might have been able to save our application onto a 5 1/4" floppy disk not sure...

      The only printer was the terminal - so if you wanted a printout, you had to login via terminal/printer and output your program contents (provided you had typed it in previously and saved it) and/or run it to capture the output. I want to say the system could run both basic and fortran applications - so access to the printer/terminal was always tight - particularly if a project was due.

      This was my first experience with a time-sharing system - we had quotas - that if we went over the number of hours alotted we would be denied access. The eggheads in our group loved the mini and tuned up their noses at the little micros in the lab.

      I played dungeon (precursor to the Zork trilogy)on the county's computer, in addition to doing my assigned tasks, and spent many hours in the computer room after school. I recall one kid claiming to have changed his grades on that machine (apparently all of our grades were entered in the mini through terminals in the school office) - but I never validated that.

      We did a lot of flow charts and wrote our programs out before entering them in the system (or we were supposed to). Just glad we did not have to deal with paper tape/punch cards - although punch cards were to revisit me in a few years (I unintentionally played 52 card pick-up with a deck of them when delivering them to a data center - but that is another story).

      I wonder what kind of programming classes are available in highschools today? My daughter took a course involving HTML and CSS markup - but I don't recall seeing any programming classes on her curriculum. Are kids learning java/perl/python like we learned basic/fortran?

    • by Richard Steiner ( 1585 ) <rsteiner@visi.com> on Friday January 28, 2005 @03:39PM (#11506784) Homepage Journal
      ...but it's still quite possible to write readable and modular code even in Fortran 66.

      (I'm saying this as a programmer who spent 12 of the past 15 years doing exactly that -- writing and maintaining Fortran 66 code that was part of a critical production system at a major airline).

      As with any language, the onus is on the programmer who is writing the code to organize it and implement it in a way which is easy for subsequent programmers to follow and understand.

      We were able to do it even within the limits and conventions present in the environment (external variable/parameter references limited to six (6) characters, internal references limited to either five (5) or one (1) character, subroutine names limited to six characters) by using common sense and trying to use a consistent coding style.

      Yes, arithmetic IFs are ugly, computed GOTO statements can be confusing, and strings defined using Hollerith notation are strange to folks who haven't seen it before, and programs are hard to follow when everything is lined up neatly in column 7 without any spacing between code and comments. So don't use that style, avoid confusing notation, and refrain from using confusing syntax or statements which might make the intent of the program unclear.

      It's the same advice in any languages -- cute tricks might save a few bytes or clock cycles, but in a production environment it's usually long-term MAINTAINABILITY that counts -- and that's true in *any* language!
      • by AJWM ( 19027 ) on Friday January 28, 2005 @04:05PM (#11507136) Homepage
        You left out whitespace being meaningless and implicit declaration of variables -- which can lead to things like
        DO 10 I = 1.10
        unexpectedly assigning 1.10 to the new variable DO10I instead of starting a do-loop with I as the loop variable, ranging from 1 to 10. (Which, for the non FORTRAN cogniscenti, would be
        DO 10 I = 1,10
        where the first 10 is the label of the end of the loop)

        Which led to the loss of a space probe, back in the day.
  • fool! (Score:5, Funny)

    by Anonymous Coward on Friday January 28, 2005 @02:36PM (#11505949)
    sure to p/o Fortran programmers

    You mean "sure to p .divide. o Fortran programmers.
    • Re:fool! (Score:5, Funny)

      by pilgrim23 ( 716938 ) on Friday January 28, 2005 @02:42PM (#11506042)
      -and he said with a voice quite solemn: "You'd better start int he seventh column!"
  • Excellent points (Score:5, Insightful)

    by YankeeInExile ( 577704 ) * on Friday January 28, 2005 @02:37PM (#11505959) Homepage Journal

    While I take issue with his blantant anti-FORTRANism, he makes the excellent point: Write good code in whatever language you write. Just because you can write Perl that looks like line noise does not meen you must.

    • Let me add to that -- writing well in Human Languages is important too. Otherwise you're going to lose your audience of yore with loose usage.

    • Just because you can write Perl that looks like line noise does not meen you must.
      You mean that you can write Perl that doesn't look like line noise? WhodaThunkIt.
  • Learning It? (Score:5, Interesting)

    by Klar ( 522420 ) * <curchin@g[ ]l.com ['mai' in gap]> on Friday January 28, 2005 @02:39PM (#11505984) Homepage Journal
    Thus the joke 'Don't write FORTRAN' was applied to anyone with ugly code.
    I mostly program in C, Java,php and C++(and several other languages that I dont use as much), and am always interested in picking up new languages to play around with. Is Fortran worth learning? And are there any things that it does a lot better than other languages?
    • Re:Learning It? (Score:2, Informative)


      Well, I'm by no means an uber-coding guru, but I used to prgram in C, and I just finised a three-year job writing many little programs in Fortran 90. I liked it, for what it is. The modern variants of Fortran are, in general, much nicer to look at, and if you know C and/or other languages, you could probably pick it up pretty easily.

      I think I found basic i/o to be much easier in Fortran than C, but then that might be because my C is so rusty I have to keep re-looking everything up. Oh well.

      For a (mostl
      • doesn't gcc include a fortran compiler? (g77?)
        • Re:Learning It? (Score:3, Informative)

          doesn't gcc include a fortran compiler? (g77?)

          It does, but it's starting to show its age. There's a new GCC Fortran 95 compiler under development ("gfortran") that will be officially released with GCC 4.

          • Re:Learning It? (Score:3, Informative)

            by mz001b ( 122709 )
            There's a new GCC Fortran 95 compiler under development ("gfortran") that will be officially released with GCC 4

            and an even better, almost working one, g95 [g95.org] -- this is the code base that the gfortran people forked from. gfortran does not work, and is much further behind than g95.

    • If you have the time/resources it's fun to learn another language just because you can. On the other hand, if you want to write real, maintainable code then why use a dead/dieing language. It would be like writing your documentation in latin!
      • Re:Learning It? (Score:4, Insightful)

        by tie_guy_matt ( 176397 ) on Friday January 28, 2005 @03:15PM (#11506477)
        Fortran has been dieing longer than BSD has. People still write code in it, people still learn it as their first language, and there are millions of huge bug free programs that still need to be kept up to date. As many people have pointed out here, there are lots of virtues to Fortran 90 that make it worth using over other languages for certian applications. Fortran has made its way into the woodwork and it is here to stay!
    • No. I took Fortran and Pascal in college and despite the fact Pascal had problems, I almost always tried to write the code in it instead of Fortran because the Fortran code was ugly and unmanageable and worse after 2 weeks I couldn't figure out why I wrote something (yet I have written C/C++ code 8 years ago that I still can read and understand why I did something.

      Like any language Fortran had it's uses back in the 80s as a language well suited for mathematical computations, but with availability of C/C++
      • The REAL Math whizzes in college used APL and wrote complete programs in one line. Damn showoffs, I still hate thier guts! Good thing they work for ME now ;)
    • Re:Learning It? (Score:3, Informative)

      by Anonymous Coward
      Are there things that it does a lot better than other languages?

      You're kidding, right? FORmula TRANslation was meant for solving problems in numerical methods. It is still one of the best languages in the world for solving those kinds of problems. No, it was never meant to write operating systems (but apparently is was used for at least one OS). It is also a highly portable language; iff you stay away from extensions. If you are looking for good numerical code, you probably end up at Netlib. And mos

      • Some people have even written C/C++ interfaces to FORTRAN numerical libraries

        MANY languages have wrappers around netlib and other giant fortran numerical libraries. The reason being that 99.9% of the programmers who need access to parts of that code could never even BEGIN to re-write it in another language. That code will likely be with us well after the name FORTRAN is forgotten.

        Perl's PDL (Perl Data Language) is a very nice abstraction for dealing with almost any sort of numerical data, and it uses net
    • Re:Learning It? (Score:3, Informative)

      by avandesande ( 143899 )
      The special thing about Fortran is that you can process a whole vector instead of using a for() loop. This makes it easy for compilers to break up tasks among multiple processors.
    • Re:Learning It? (Score:5, Informative)

      by phritz ( 623753 ) on Friday January 28, 2005 @02:54PM (#11506209)
      Is Fortran worth learning? And are there any things that it does a lot better than other languages?

      Maybe, and absolutely. Note that the article ignorantly used FORTRAN to mean FORTRAN 66. In fact, Fortran 90 has all the features of a modern programming language. Add to that the fact that fixed-format produces far prettier looking code than C's mess of curly braces and parentheses, although you can also use free-format if you choose. Really, the article makes no sense if you look at what FORTRAN is today.

      Answering your questions directly:
      Fortran 90 does array, vector, and matrix processing better than any other language, and can do some parallelization of vector processing with a compiler flag. If you're doing scientific programming, Fortran 90 is really the language you should be using. On the other hand, for programs that are actually supposed used by laypeople, there's not much support for doing that with FORTRAN.

      • Re:Learning It? (Score:3, Interesting)

        I ALMOST agree with you. As far as "standard" languages go, FORTRAN does do this best. The problem is, there's a much better solution now.

        1) Array, vector, and matrix processing can not only be done better, but with FAR less work in MATLAB, and using their converter, will nicely produce C (C++?) on the other end.
        2) Parallelization of vector processing can also be done with >version R11 of Matlab, again with many fewer lines of codes, using a toolkit. (see here [mathworks.com])

        A couple years ago I was working on some "
      • Even more scary? (Score:3, Interesting)

        by Sycraft-fu ( 314770 )
        There is Visual Fortran and Fortran .NET. Visual Fortran I've actually seen and installed on a computer. Watching one of the grad students start to write a Windows program, with GUI, in Fortran was rather scary. I haven't messed with Fortran .NET but apparantly you can really generate .NET code with it. This also mean that one could write stuff in Fortran and call it from C++. To make things even scarier, there's a PERL .NET kit. So one could write a PERL program that calls on Fortran.

        These are things man
    • While Fortran 77 is ugly and I saw terrible programs written in Fortran 77, Fortran 90 or 95 is a pretty modern and nice language and if you know C, it is easy to learn Fortran 90. It is not that much different from anything else. It is great in numerical programs (especially linear algebra) as the matrix handling is nice and fast. The only problem is that only recently free (as in speech) Fortran 90 compilers has become available and they are still in beta stage. However, for Linux, Intel Fortan Compiler i
    • I mostly program in C, Java,php and C++(and several other languages that I dont use as much)

      My brain had a fatal error when it tried to compile your sentence.
    • Re:Learning It? (Score:3, Interesting)

      by raga ( 12555 )

      Is Fortran worth learning?

      For number-crunching applications, it is the greatest.

      it has a strict but simple syntax (far fewer ways you can make unintentional errors, unlike, say C++)

      it is blazingly fast (only writing in Assembly code could likely beat it in speed)

      it has great compiler flags for parallel processing and optimization (just make sure you have "clean" code that doesn't jump in and out of loops)

      it is easily portable (I can run code written for the CRAY X/Y-MP in the 1980s, on a G5 in 2005)

      i

  • by Anonymous Coward on Friday January 28, 2005 @02:41PM (#11506012)
    In an article that's sure to p/o Fortran programmers and bore the hell out of everyone else, Donn Seeley...
  • I took over from a guy with a Masters Degree, who only took Fortran in his day and everything he wrote looked like it. (He also was a pretty bad coder besides, with at least one variable spelled three different ways in one module. eek)

    I'm more of a western coder ... lots of wide open spaces in between clauses for readability. Documentation in bits rather than 100 lines of code then a paragraph about what happened in there.

    I'm sure someone somewhere would gripe about my style too.

  • by Anonymous Coward on Friday January 28, 2005 @02:42PM (#11506040)
    As long as you use vi. You can never write beautiful code with emacs

    I just figured I'd follow one pointless flame fest with another.
  • by FriedTurkey ( 761642 ) on Friday January 28, 2005 @02:43PM (#11506048)
    Isn't FORTRAN used these days primarily to figure out mathematical and engineering calculations? I am sure most of these programs are small and maintained by a few people. So does it matter if it is ugly? I am sure there are FORTRAN libraries to access databases but how many are really large programs??

    I have had to make changes to UNIX shell scripts and PERL code before. Most of the undocumented cryptic scripts were small enough to figure out what I needed to change.
    • I am sure most of these programs are small and maintained by a few people.
      Actually, most production FORTRAN systems are beheamoth systems for modeling very complex behaviors. Although the community that keeps these systems up-to-date is probably relatively small.

      But not always: My friend Carl was writing CGI in FORTRAN to run on the XKL TD-1

    • I was part of the last year at my Uni to learn Fortran-77 (studied 1997-2001, chemical engineering). They teach Maple now, I think.

      Yes, FORTRAN is very common for engineering calculations: I've written things like distillation column models in it. It's fast, simple and there are lots of numerical libraries for it. I wouldn't want to use it on a project I had to maintain, but for getting the job done it's pretty good.
    • SMALL?

      When I did some lab as part of my CS study, one unfortunate group of four students got the assignment to write documentation for part of some FORTRAN behemoth written over 15 years by successive grad students in the math department. It was horrible.

      It was worth four credits (= 4 weeks), so documenting part of that small program was supposed to take four man months.

      Our group wrote a GUI in Tcl/Tk interfacing VTK to show nice 3D graphs of the output of that program. We were lucky we could look at som

    • Actually, real fortan programs tend to be quite large.
      Not OS large, but 10 to 100 megabytes of source code is not
      uncommon. The typical program is hacked on by grad
      students two or three at time over the progress of years.

    • Small? There's a software collection I run (and used to be in charge of the porting efforts to OS X for) that's about 2.5 million lines of code. Of that, 800,000 are FORTRAN (the rest is C, Java, C++, and Tcl, primarily).

      I definitely wouldn't call 800,000 lines of code "small".
  • by bigtallmofo ( 695287 ) on Friday January 28, 2005 @02:43PM (#11506056)
    Seriously, it's about time that someone knocked Fortran programmers down a peg or two. It seems impossible to get any type of programming job if you don't know Fortran.

    Every job classified ad section is filled to the brim with Fortran positions while less relevant languages like Java, C# and Visual Basic are almost completely neglected.

    I for one welcome news like this if it help Fortran programmers acquire just a little humility.
  • by dillon_rinker ( 17944 ) on Friday January 28, 2005 @02:45PM (#11506083) Homepage
    The name "FORTRAN" came from "FORmula TRANslator." It was created so that engineers and scientists could write programs to perform calculations. They wouldn't need a degree in programming, and they wouldn't be reliant on programming staff. They would be able to independently take advantage of a company's (or university's) computing resources. It wasn't DESIGNED to be a pretty language; it was designed to be used by people who would have stared blankly at you if you'd mentioned the concept of a pretty language. It served its purpose well.

    It reminds me of SQL in that respect. I have worked with managers who knew less about computers than their secretaries, but they were able to use SQL to write queries to get information that they wanted. SQL was written for that purpose. It ain't pretty, but it serves its target market.

    I doubt that designers of armored cars and dump trucks worry about the slings and arrows of the Ferrari's designers; I think this rant is pretty much in the same vein as that. Beauty and utility are not synonymous.

    • Considering that FORTRAN pre-dates C by almost 15 years and was the first general purpose computer language, it's kind of a stretch to say it wasn't designed to be pretty. It was a lot prettier than the assembly of the time.
    • Fortran is hardly used these days, while SQL is still ubiquitous. In recent years people seem to have stopped predicting SQL's demise. SQL has its weaknesses, but is extremely useful if you know its strengths.
    • Your description of the purpose of Fortran doesn't really match anything I have seen before regarding it. My understanding is that Fortran was the first "high level" programming language and was designed to be used by everyone not just poorly trained egineers and scientists.

      Being "first" had some advantages (namely long life) but many disadvantages as different programming styles and methodologies had not yet been invented, discussed or evaluated. As far as I can tell later versions of Fortran (ie IV, V,
    • hmmm the first programs I ever wrote were in Fortran on punchcards... I had to submit a stack before 4pm in order for it to be run overnight... woe betide me if I got them in the wrong order, I had a simple trick to check quickly... When they were in the right order, I would write a couple of words on the top edge so I could check at a glance that the stack hadn't been shuffled as a prank... 1975, happy memories...
  • by curtisk ( 191737 ) on Friday January 28, 2005 @02:48PM (#11506125) Homepage Journal
    Cripes.

    So are they using "FORTRAN" as a adjective replacing "crappy" and then whipped up an article that has been covered in about 5,000 different programming books and/or documentation regarding some largely accepted guidelines for writing clean, manageable and efficient code?

    Why is this on the front page?

    "Acmqueue Click-thrus ACTIVATE!! Go Go Go!"

  • by GillBates0 ( 664202 ) on Friday January 28, 2005 @02:49PM (#11506134) Homepage Journal
    and more literal "DONT you Brainfuck with me".

    For the uninitiated, Brainfuck [wikipedia.org]'s a Turing Complete language with eight language statements, each consisting of a single character:

    > increment the pointer.
    + increment the byte at the pointer.
    - decrement the byte at the pointer.
    . output from the byte at the pointer (ASCII).
    , input to the byte at the pointer (ASCII)
    [ jump forward to the statement after the corresponding ] if the byte at the pointer is zero.
    ] jump back to the statement after the corresponding [ if the byte at the pointer is nonzero.

    I'd post actual code, but the /. filter is fucking me up.

  • Article format (Score:5, Insightful)

    by hobit ( 253905 ) on Friday January 28, 2005 @02:49PM (#11506149)
    It would be nice



    if the article weren't broken



    into such small pieces.



    That way I could



    print it for my students.

    Sort of amusing for an article that discusses using white space in a good way.

  • by Saint Stephen ( 19450 ) on Friday January 28, 2005 @02:51PM (#11506165) Homepage Journal
    I have to say my interest in the article plunged through the floor when I saw the example using Bush/WMDs as the subject. I immediately realized I'm either reading something written by a college student or someone who has not matured much beyond that. How gauche.

    Regardless of how you feel about the politics, it's just not kosher to use examples like that. Clearly this is a person with an axe to grind.

    I read the fucking article. I didn't see too much very insightful, or see any specific reference to Fortran at all.
    • I'd have to say that it had the opposite effect for me, my eyes glazed over with a joyful sparkle. At that point I knew I had to see where they were going with it.

      But that being said I agree with your point, and I'm not a big Bush fan myself.

    • by tesmako ( 602075 ) on Friday January 28, 2005 @03:10PM (#11506426) Homepage
      I don't see any reason to stay off a historical fact just because it made someone look stupid. If you are this easily offended by things you read in articles I must suggest that you stay off the internet.

      Things would be different if the statement was in any way controversial, but as things stand now everyone already knows it to be true.

      • I don't see any reason to stay off a historical fact just because it made someone look stupid.

        Me neither. There is a reason to avoid it, though, if it is irrelevant, stupid, and politically motivated.

        Surely there are dozens of political facts other than this case that can be made into an analogy with Fortran. Surely there are hundreds of historical non-political such facts. Surely there are thousands of non-historical, computer-related facts that he could've used to draw a reasonable, on-topic analogy.

        H
    • I have to say my interest in the article plunged through the floor when I saw the example using Bush/WMDs as the subject. I immediately realized I'm either reading something written by a college student or someone who has not matured much beyond that. How gauche.

      *College student?* I wrote this kind of stuff back in *grade school* in 1962 in FORTRAN except back then it was JFK.

      _flame on_
      Considering the commercial, political and generally juvenile slide slashdot has taken lately, this is about par for the
  • woo (Score:3, Funny)

    by nomadic ( 141991 ) <`nomadicworld' `at' `gmail.com'> on Friday January 28, 2005 @02:53PM (#11506194) Homepage
    They're really starting to shake up the industry on slashdot, I'm sure this will create a lot of disruption in the massive FORTRAN industrial establishment. Oooh, next they should link an article criticizing ALGOL, that will shake up things even more.
  • by toddbu ( 748790 ) on Friday January 28, 2005 @02:55PM (#11506223)
    Back in the good old days before C/C++ was popular, FORTRAN was a great programming language for doing anything that had to do with math or bit manipulation. The alternatives were things like COBOL or Pascal. What I loved about FORTRAN was that you could do cool things like treat strings as ints or do negative subscripting to rewrite the OS. I had a graphics class that I wrote some FORTRAN code in because I could break down a matrix into a single row just by passing in a pointer. I loved the fact that everything was pass by reference, which is why it took me so long to switch to C. If you had an optimizing compiler you could do stuff like make 1 == 2 because the constant value 1 was mapped to the same memory location for all instances and if you passed the constant into a function then you change the constant value inside the function.

    I prided myself in college that I could write FORTRAN in any language. I had a prof that couldn't figure out why I was doing bit manipulation in COBOL. (Yes, this can be done in COBOL through multiplication and division, but it's really ugly.)

  • So what if Fortran is ugly--all languages get uglier the less they are used and the more high-level languages are developed. I'm sure lots of people would look at assembly code and say it's ugly too. It's only a matter of time before our kids look at C++ code and say, "Boy, am I glad I didn't have to program like that!".

    Kinda reminds me of "Back to the Future III" where Marty plays that shoot-em-up arcade game in front of kids, and all they can do is complain "You mean you have to use your hands. That's
  • by beelsebob ( 529313 ) on Friday January 28, 2005 @02:58PM (#11506261)
    ... people would have got the point. Christ even John Backus (FORTRAN's creator) said that FORTRAN and even all imperative languages were horrible ugly hack, and that we should all go away and use "[the] functional style, and it's algebra of programs". [acm.org](warning: pdf link).
  • It took me 2 hours to compile my first simple Fortran program, because I didn't realize that the first 5 columns were off limits. That's where the line numbers used to be on the punch cards.

    Why this limitation persisted into a verion of Fortran that no longer even required line numbers - no idea.
    • Why this limitation persisted into a verion of Fortran that no longer even required line numbers - no idea. Because a lot of this code got dumped onto disks and is still used today. Actually I don't know that line numbers were ever required, just often put in so you could re-assemble your cards if you dropped them.

      The limitation of 72 characters come from this too. Line numbers or sequence numbers were often put in columns 73-80. If compiliers started paying attention to what was in those columns, lots o

  • by francisew ( 611090 ) on Friday January 28, 2005 @02:59PM (#11506269) Homepage

    Since major companies like IBM have chosen to produce compilers that perform best with FORTRAN. (absoft markets the compilers with a front end)

    I like C, and a slew of other languages much better...

    But my G5 dual-processor desktop machine can be optimized to run at around 35 GFLOPS. Try that on an 8086 derivative What, maybe you can get 2-4 GFLOPS per machine (if a dual-processor system)? I have a low-end supercomputer on my desk! Unfortunately, without FORTRAN, it wouldn't be so super.

    FORTRAN is the only language that will easily take advantage of the HW (Altivec 'velocity engine' and parallel processing).

    Each language is good for some tasks. FORTRAN happens to be good for performance in science and engineering work.

    • Alot of it has to do with legacy scientific and engineering libraries. There are millions of lines of proven libraries that were originally written in the 60s and 70s for various scientific and engineering analysis disciplines.

      When I was at the university of texas, there was a parallel programming course that was conducted in fortran and c++. The professor of it quoted how much it would cost in labor and manhours to transfer all those fortran libraries to a more "modern" language - and it was many many m
  • ...although many programming languages have features superior to Fortran in various ways, it is by no means obvious that any language is sufficiently better than Fortran to justify making the switch. In fact, the ways many things are done in Fortran are now recognized as being superior to that of many other programming languages. One example involves the methods used to create and access global data. For a few years, the Algol/Pascal method involving block structure was considered superior, but now compute
  • QOTD (Score:2, Funny)

    by pete-classic ( 75983 )
    Heh. The quote of the day at the bottom of slasdot was somthing like "HONK USE IF THEN" earlier this morning.

    -Peter
  • by adolfojp ( 730818 ) on Friday January 28, 2005 @03:08PM (#11506398)
    1. Do not separate the presentation logic from the application logic. I love it when I have to search for a specific code function sandwiched between the visual element constructors and modifiers.
    2. Do not create a data layer. It is great to search through thousands of line of code to change the sql code.
    3. Use one very long class instead of separating the program's functionality into small atomic units. I just love 7th or 8th level if statements that are repeated everywhere.
    4. Don't comment or doccument anything. Good code should be self docummenting right?
    5. Don't handle exceptions. Good programs don't make em.
    6. Don't use configuration files. Because we love to recompile everything to change settings.


    Forgive my rant, it has been one long week... after another... of working with other people's code.

    Cheers,
    Adolfo
  • by angst_ridden_hipster ( 23104 ) on Friday January 28, 2005 @03:12PM (#11506445) Homepage Journal
    ... or did they consistently replace "APL" with "FORTRAN" in the article.

    I could fix that for them with sed, or maybe a Perl script. Now, where did I leave all my leaning toothpicks...
  • Have you ever had the misfortune of working with APL?
  • Way back when, you only had a few choices. If you were a scientist/engineer you used Fortran. If you programmed business/text applications you used Cobol. Fortran stunk for business use, and Cobol stunk for math uses.
  • "If you can't do it in FORTRAN, do it in Assembly language. If you can't do it in Assembly, it isn't worth doing."

    A Guide to Real Programmers. [sorehands.com]


  • by Glomek ( 853289 ) on Friday January 28, 2005 @03:28PM (#11506645)

    The p/o'd response basically sounds like "He's equating Fortran with FORTRAN-66 (or 77)".

    I know that I do this too. When someone says "It's written in FORTRAN" I don't think Fortran-95, I think FORTRAN-77... and I'm usually right.

    I suspect that there are two reasons for this:

    1. FORTRAN-77 was the big thing during FORTRAN's heyday, so most of the legacy FORTRAN code out there is FORTRAN-77.

    2. For a long time, the best Free Software [gnu.org] FORTRAN compilers out there (g77 [gnu.org], f2c [netlib.org]) have been FORTRAN-77 compilers. g95 [sourceforge.net] is still fairly young.
  • by Mr_Silver ( 213637 ) on Friday January 28, 2005 @03:32PM (#11506693)
    I can liken this to Visual Basic. There are so many crappy visual basic applications out there designed by 14 year olds with no understanding of HCI and it's just got to a point where people go "vb? erk!" and avoid it completely.

    Which is a shame really because you should be judging the quality of the application - and not what it was written in. Seriously, if it does x and it does it quickly and well with a nice user interface - does it really matter that it was written in Algol 68?

    As a by no-means perfect example, check out this site [uk.net] which is, I think, a reasonably nice looking application written in Visual Basic (it acts as a GUI to the free SMS gateways out there). I don't claim to have it perfect, but the feedback I've had from people indicate that they don't think it's the usual run-of-the-mill-vb-application.

    Disclaimer: I wrote it and the preference section is a little nasty, but I'm working on it. Also, I know that VB is only really for doing RAD but I don't have the time or inclination to learn Visual C++.

  • Blast from the Past (Score:3, Interesting)

    by mborland ( 209597 ) on Friday January 28, 2005 @03:37PM (#11506760)
    Apologies in advance, this reminded me of something I ran into a few years go. This is a two-page ad from a New Yorker magazine in 1968 (or 1969, not sure which). I was so interested in the ad that I transcribed it and put editorials in brackets.

    [A two page ad. A middle-age man with a youthful, shy grin, dark horn-rimmed glasses, slicked, short hair, and the premonition of a hairy chest emerging from a blue denim(?) shirt, fills the left page; the vista of urban sprawl outside a window behind him; painted scrawls of mathematical formulas superimposed. On the right hand page is a block of sans-serif text]

    Meet an elder statesman in the computer business.

    IBM's Jon Backus is 43, pretty young for an elder statesman in most industries. But then, the computer business is less than 20 years old and a mathematician Bakcus has been in it since the beginning. He started workig with computers in the early 1950's. It was about the time a leading business magazine estimated that no more than 50 companies would ever have use for a comptuer. Today, it is estimated that there are well over 50,000 comptuer installations in the United States alone. Part of the reason for this astonishing growth: the progress made in programming. In this field, John Backus was a pioneer. "It bothered us, in the early days of computers, that so few people coluld use them" he says. "One reason was, programming cost as much as the machine. A small compnay just couldn't afford data processing." With a small group of associates, John Backus tackled the problem and stayed with it for three years. The result was the simplified programming system called FORTRAN (FORmula TRANslator) which made programming considerably less expensive than before. Today, FORTRAN is probably the most widely used programming system in the world. Currently, John Backus is working on a new mathematical concept which is still in the realm of pure theory. But his theories, like the work of many IBM scientists, ultimately have a way of making computers more useful.

    [A red line runs across the text. A matching red 'IBM' (not the blue, CRT lines version) appears in the margin.]

    From a beginning less than two decades ago, computer technology has made remarkable progress. John Backus is one of many outstanding men and women in the industry who have turned a laboratory marvel into tens of thousands of computers helping people around the world.

  • by alispguru ( 72689 ) <bob,bane&me,com> on Friday January 28, 2005 @03:51PM (#11506930) Journal
    ... from scientist and engineer coders. For these guys, FORTRAN is the only reasonable way for them to turn their domain knowledge into production code, for three main reasons:

    Libraries - the most bullet-proof, battle-tested numerical code is pretty much all in FORTRAN

    Optimizers - if you must wring the last factor of two of performance out of big vectorizing iron, and you're not a CS guru, the FORTRAN compiler is still your best bet

    Semantics - FORTRAN the language enforces some constraints that make vectorizing optimization work better than less constrained stuff like C

    The problem is, for these guys FORTRAN is a means to an end - most of them have had very little formal training in good coding practice, and worse, most of the code they read was written by people with similar experience.

    Maybe what we should do is require scientists and engineers to pair-program with recent CS graduates. Both sides would learn a lot from that.

  • by hikerhat ( 678157 ) on Friday January 28, 2005 @05:30PM (#11508256)
    The article is basically some guy who has a hard time reading code and blamesItOn trivial_things like whiteSpace usage and camelCase vs_underscores_. If you're having a hard time understanding code it has nothing to do with little nit picky things like white space and underscores (unless the code has been deliberately obfuscated). It is because:
    1. You don't have enough experience reading/writing code. You have to read (more so than write) a tremendous amount of code to get good at reading code.
    2. You don't understand the problem the code is solving.
    3. The code is very badly designed at a higher level than things like white space and underscores.
    A lot of people get frustrated when they don't understand code right away, and rather than trying to grok why they don't understand it (because 2/3rds of the time it is the reader's fault, not the coders), they just bitch about white space and brace placement. That is never the problem.

Math is like love -- a simple idea but it can get complicated. -- R. Drabek

Working...