Slashdot Mirror


How Not to Write FORTRAN in Any Language

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."

21 of 502 comments (clear)

  1. Excellent points by YankeeInExile · · Score: 5, Insightful

    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.

    --
    How does the Slashdot Effect happen given that no slashdotters ever RTFA?
    1. Re:Excellent points by YankeeInExile · · Score: 2, Insightful

      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.

      --
      How does the Slashdot Effect happen given that no slashdotters ever RTFA?
  2. FORTRAN considered useful...like SQL by dillon_rinker · · Score: 4, Insightful

    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.

  3. HEY /. !! Look at what we wrote!! by curtisk · · Score: 2, Insightful
    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!"

    --

    Sehr geehrter Toilettenbenutzer!

  4. Article format by hobit · · Score: 5, Insightful
    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.

    --
    As Nietsche famously said, "If you stare too long into the Abyss, 1d4 Tanar'ri of random type will attack you."
  5. Was introducting Bush/WMDs really necessary? by Saint+Stephen · · Score: 4, Insightful

    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.

    1. Re:Was introducting Bush/WMDs really necessary? by tesmako · · Score: 3, Insightful
      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.

    2. Re:Was introducting Bush/WMDs really necessary? by FreeUser · · Score: 4, Insightful

      It even talks about leaving the UN. I don't see how it could offend anyone so much. Maybe next time the author will be more politcally correct in his examples.

      I hope not. The world is ill with political correctness. We need to be able to talk about issues, in any manner we like, without fear of reprisal.

      The new CorrectThink/PoliticalCorrectness coming from the right is even more frightening than that which came from the left ... not because of its contents (although one could make a strong argument for that: elevating the right's propensity for living in denial of Bush's machinations WRT Iraq to political correctness is far more sinister than elevating anti-sexism and anti-racism to the same level, though IMHO both are unhelpful), but because of its ever widening scope, touching every aspect of life, and every aspect of politics from micro-managed day-to-day minutia of Bush's latest behavior to general issues of philosophy and lifestyle, in ways the left thankfully never dreamed.

      People on both the right and the left should be very politically incorrect, and if a few partisans on either side get offended, so much the better. We need straight, frank dialogue, and an ability to express opinion without fear of political, professional, and financial reprisal. That is, after all, what the founding father's meant by "freedom of speech," not the corporate muzzling we have today.

      I can hear the right whining now: "We have freedom of speech, but freedom of speech has consiquences" (paraphrasing Baby Bush).

      By that definition, Communist Russia had freedom of speech. You could say anything you like, but freedom of speech had consiquences ... like landing in Guantanamo ... oops, I mean the Gulag.

      Really, the only expression that should be forbidden is one written in FORTRAN. *ducks!*

      --
      The Future of Human Evolution: Autonomy
    3. Re:Was introducting Bush/WMDs really necessary? by Geoffreyerffoeg · · Score: 2, Insightful

      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.

      He didn't mention the WMDs onle because it just happened to fit his story, did he?

  6. Why use FORTRAN these days? by francisew · · Score: 4, Insightful

    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.

  7. Re:Learning It? by tie_guy_matt · · Score: 3, Insightful

    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!

  8. Re:How not to write irritating articles on the Web by Anonymous Coward · · Score: 2, Insightful

    ...except that each time a page loads, a new set of ads is displayed, potentially making it more profitable for the author.

    So the artificial 'page' breaks are a byproduct of profit motive, nothing more.

    Sad, but true.

  9. Re:FORTAN programs are small right? by Booker+C.+Bense · · Score: 2, Insightful

    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.

  10. A bit like Visual Basic by Mr_Silver · · Score: 4, Insightful
    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 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++.

    --
    Avantslash - View Slashdot cleanly on your mobile phone.
  11. Re:Ah... But which notation is clearer? by Aardpig · · Score: 2, Insightful

    We're still using F77 here, so I didn't know that. :-)

    Fortran 90/95/2003 are well worth 'upgrading' to -- for starters, the array syntax is fantastic. If A and B are arrays, you can assign from one to another simply by 'A=B'. Likewise, 'A=sin(B)' would set each element of A to the sine of the corresponding element of B. Code like this is a doddle to parallelize automatically, enabling one to write parallel code with very little effort.

    --
    Tubal-Cain smokes the white owl.
  12. Well... by Locke2005 · · Score: 2, Insightful

    As somebody that has been programing for 25 years, all I can say with regard to this article is "Well, duh! Tell me something I don't already know!" Seriously, if you've been programming for more than 3 years and haven't already figured out by yourself (and by bad example) how to write understandable code, maybe you shouldn't be programming!

    --
    I've abandoned my search for truth; now I'm just looking for some useful delusions.
  13. Re:hardly unfortunate by YU+Nicks+NE+Way · · Score: 3, Insightful

    The point of multidimensional arrays in FORTRAN is simple and straightforward: they're contiguous blocks of storage. In C, multidimensional arrays are a fiction, because a[i][j] is given exactly the semantics of *(*(a + i) + j), instead of *(a + i * second_dim + j). That extra dereference takes away a huge number of optimization opportunities.

    Pointers are useful in systems programming, but K&R made C a much less useful scientific language by not including the multidimensional array dereference operator. That's fine -- they weren't writing a language for scientific computation. I even think they made the right design choice, since there was already one around; it was called "FORTRAN".

  14. Re:hardly unfortunate by hawk · · Score: 2, Insightful

    Generally, I mean sustained heavy calculation with large blocks of data.
    '
    Sure, you *can* write those operators and templates, but they tend to already be there in Fortran. And if they're not, it's near certain that you can find existing, well-tested libraries.

    The "less code" was my own experience several years ago while still using both for this kind of work. It's been long enough that I"m straining to remember specifics, but the dusty brain cells want to say [no, scratch this example; it make no sense].

    Whether you use pointers or not, the C compiler may be forced to make allowances for it. Fortran pointers are far more limited, and the compiler needn't consider the extra possibilities.

    And as for goto? Why is it any worse that one exists in Fortran than C? I've used one twice in the last ten years (or is it once). The alternative was setting a status variable to be checked to skip the block of code (for the general case) immediately following the select case structure. I *could* have avoided the goto, but the code was much clearer by using it.

    hawk

  15. Re:hardly unfortunate by Anonymous Coward · · Score: 1, Insightful

    I think part of the problem is that many of us learned FORTRAN 77. I had a prof in college who was a FORTRAN fanboy, and he quoted someone saying, "I don't know what the language of 2000 will be, but it will be called FORTRAN." Basically, rather than dumping the old design and starting over with a new math-based language, they are just evolving the old one to the point where it is no longer the same beast it used to be. I haven't even looked at the latest versions, but I gather they might be acceptable to a computer scientist.

    Whether this is a good thing or a bad thing is another discussion. Programmers like to start over with the assumption that "it's going to be right this time." Often, though it's better to make incremental changes on a well established base. It all comes down to how much change is required, I guess.

    Lucky for us all, there's no lock-in on languages. You can use FORTRAN, I can use C, someone else can use Perl. Here's to healthy competition (which seems to be a rarity these days.)

  16. Well... by tetabiate · · Score: 2, Insightful

    FORTRAN (FORmula TRANslation) was never meant to be a general-purpose programming language, it is strongly biased towards scientific calculations. It has native support for doing fast computations with scalars and arrays of integer, real and complex data types. In modern revisions of the language (F90/95, Fortran 2000/2003) it gained support for dynamic memory allocation (although there is no garbage collection), abstract data types, pointers and object-oriented programming but few people use these capabilities. And yes, it is possible to write beautiful programs in FORTRAN although bad practices prevail due to the backwards capability of modern FORTRAN with F66/F77.

  17. white space isn' t your problem by hikerhat · · Score: 2, Insightful
    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.