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

86 of 502 comments (clear)

  1. FORTRAN - The ugly but lovable little SOB by ChuckleBug · · Score: 5, Interesting

    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.

    1. Re:FORTRAN - The ugly but lovable little SOB by Anonymous Coward · · Score: 3, Funny

      "Besides, the determined Real Programmer can write Fortran programs in any language." - Ed Post

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

    2. Re:FORTRAN - The ugly but lovable little SOB by fm6 · · Score: 4, Informative
      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.

    3. Re:FORTRAN - The ugly but lovable little SOB by TechnoLuddite · · Score: 2, Funny
      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*

    4. Re:FORTRAN - The ugly but lovable little SOB by Lodragandraoidh · · Score: 4, Interesting

      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?

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
    5. Re:FORTRAN - The ugly but lovable little SOB by Anonymous Coward · · Score: 2, Interesting

      Oh yes! - debugging arithmetic IFs and computed GOTOs makes grown men cry - following code should work OK - but illustrates arithmetic IFs:

      SUBROUTINE FOUR1 (DAT,NN,ISIG)

      c This is a Cooley-Tukey fast-Fourier trans-
      c form in FORTRAN. Transform(K) =
      c Sum(DATA(J)*exp(ISIGN*2*Pi*Sqrt(-1)
      c *(J-1)*(K-1)/NN), summed over all J and K
      c from 1 to NN. The data is a one-dimensional
      c complex arra, i.e., the real and imaginary
      c parts are adjacent in storage, as FORTRAN
      c places them. The array's length is NN =
      c 2**K. If necessary, append values to th
      c data to reach an even power of two.
      c ISIGN is +1 or -1; a -1 transform followed
      c by a +1 transform (or vice versa) returns
      c the original data multiplied by NN. The
      c transformed data are returned in the
      c array DATA, end replace the original input.
      DIMENSION DAT(*)
      N = 2*NN
      J=1
      DO 5 I=1,N,2
      IF (I-J) 1,2,2
      1 TEMPR=DAT(J)
      TEMPI=DAT(J+1)
      DAT(J)=DAT(I)
      DAT(J+1)=DAT(I+1)
      DAT(I)=TEMPR
      DAT(I+1)=TEMPI
      2 M=N/2
      3 IF (J-M) 5,5,4
      4 J=J-M
      M=M/2
      IF (M-2) 5,3,3
      5 J=J+M
      MMAX=2
      6 IF (MMAX-N) 7,10,10
      7 ISTEP=2*MMAX
      THETA=6.2831853/FLOAT(ISIG*MMAX)
      SINTH=SIN(THETA/2.)
      WSTPR=-2.*SINTH*SINTH
      WSTPI=SIN(THETA)
      WR=1.
      WI=0.
      DO 9 M=1,MMAX,2
      DO 8 I=M,N,ISTEP
      J=I+MMAX
      TEMPR=WR*DAT(J)-WI*DAT(J+1)
      TEMPI=WR*DAT(J+1)+WI*DAT(J)
      DAT(J)=DAT(I)-TEMPR
      DAT(J+1)=DAT(I+1)-TEMPI
      DAT(I)=DAT(I)+TEMPR
      8 DAT(I+1)=DAT(I+1)+TEMPI
      TEMPR=WR
      WR=WR*WSTPR-WI*WSTPI+WR
      9 WI=WI*WSTPR+TEMPR*WSTPI+WI
      MMAX=ISTEP
      GO TO 6
      10 RETURN
      END

    6. Re:FORTRAN - The ugly but lovable little SOB by Canadian_Daemon · · Score: 2, Interesting

      I wonder what kind of programming classes are available in highschools today? As a grade 12 student in British Columbia, Canada, I 've done VB and C++. The other classes (Desktop publishing etc) do html and dreamweaver. I found that in order to do Java, I had to do it by myself, without the class.
      As a side note, although our clients are Windows, the server is freeBSD, and were running OO.org. Within a year or two we should be completely switched to Linux. And some of the elementary schools in the area are alreadly pure linux.

      --
      This sig is definitive. Reality is frequently inaccurate.
    7. Re:FORTRAN - The ugly but lovable little SOB by Tony-A · · Score: 2, Informative

      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.

  2. fool! by Anonymous Coward · · Score: 5, Funny

    sure to p/o Fortran programmers

    You mean "sure to p .divide. o Fortran programmers.

    1. Re:fool! by pilgrim23 · · Score: 4, Funny

      -and he said with a voice quite solemn: "You'd better start int he seventh column!"

      --
      - Minutus cantorum, minutus balorum, minutus carborata descendum pantorum.
  3. 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?
  4. Learning It? by Klar · · Score: 4, Interesting

    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?

    1. Re:Learning It? by What'sInAName · · 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 (mostly Fortran-like) language that has a free compiler, you might also take a look at F as well. (http://www.fortran.com/F/).

    2. Re:Learning It? by Anonymous Coward · · Score: 3, Informative
      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 most of that is probably still FORTRAN. Some people have even written C/C++ interfaces to FORTRAN numerical libraries, because the FORTRAN code is still the best implementation for solving the problem.

      Yes, please do write good code. Poorly written code is a pain in any language.

    3. Re:Learning It? by avandesande · · Score: 2, Informative

      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.

      --
      love is just extroverted narcissism
    4. Re:Learning It? by phritz · · Score: 5, Informative
      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.

    5. Re:Learning It? by Peter+La+Casse · · Score: 2, 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.

    6. 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!

    7. Re:Learning It? by mz001b · · Score: 2, Informative
      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 -- this is the code base that the gfortran people forked from. gfortran does not work, and is much further behind than g95.

    8. Re:Learning It? by TheUnFounded · · 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)

      A couple years ago I was working on some "Cutting Stock" optimization problems. The current system was written in Fortran, but Matlab was the language of choice for the new one. Its probably more expensive, but talk about saving you some trouble in the long run...

    9. Re:Learning It? by DoctorRad · · Score: 2, Informative
      For a (mostly Fortran-like) language that has a free compiler, you might also take a look at F as well. (http://www.fortran.com/F/).

      Seconded. F is a subset of Fortran95, with all the deprecated syntax options taken out. This promotes good coding style. Any F program will compile with a f95 compiler, so you can get the same code running on much bigger machines very easily.

      Matt...

    10. Re:Learning It? by twiddlingbits · · Score: 2, Funny

      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 ;)

    11. Re:Learning It? by raga · · Score: 2, Interesting
      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)

      it has a well tested and supported library for almost all types of numerical methods and heuristics.

      Other than that, it is pretty much worthless.{grin}

      cheers- raga

  5. Missing something by Anonymous Coward · · Score: 5, Funny

    In an article that's sure to p/o Fortran programmers and bore the hell out of everyone else, Donn Seeley...

  6. Oy.. The code I've seen.. by ackthpt · · Score: 2, Interesting
    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.

    --

    A feeling of having made the same mistake before: Deja Foobar
  7. You can write beautifully in ANY language... by Anonymous Coward · · Score: 5, Funny

    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.

  8. FORTAN programs are small right? by FriedTurkey · · Score: 4, Interesting

    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.

    1. Re:FORTAN programs are small right? by YankeeInExile · · Score: 2, Informative

      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

      --
      How does the Slashdot Effect happen given that no slashdotters ever RTFA?
    2. Re:FORTAN programs are small right? by BenjyD · · Score: 2, Interesting

      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.

    3. Re:FORTAN programs are small right? by Scarblac · · Score: 2, Interesting

      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 some smaller FORTRAN programs that were used to parse the stuff before then, only a few thousand lines, but it was still hardly possible to figure out what was what.

      No namespaces...

      --
      I believe posters are recognized by their sig. So I made one.
    4. 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.

  9. About time someone spoke up about Fortran. by bigtallmofo · · Score: 5, Funny

    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.

    --
    I'm a big tall mofo.
  10. 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.

    1. Re:FORTRAN considered useful...like SQL by Tablizer · · Score: 2, Informative

      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.

      Target market? Do you mean when IBM first designed it, or how it is actually used now? Most SQL "users" are developers. However, SQL is poorly suited for developers. Beyond a single SELECT statement, SQL's flaws start to pile up pretty quick. I think it is time to replace SQL with a better relational language. A RDBMS can perhaps use both SQL and the replacement so that non-techies can use the more English-like SQL if desired.

      Alternatives include Chris Date's "Tutorial D". I am also working on a replacement, tentatively called "Tops Query Language". However, I don't think they will catch on because SQL can fixed to be "good enough" if the industry is ever pushed to improve the situation.

  11. 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!

  12. Even better... by GillBates0 · · Score: 2, Funny
    and more literal "DONT you Brainfuck with me".

    For the uninitiated, Brainfuck'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.

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
  13. 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."
    1. Re:Article format by gManZboy · · Score: 3, Informative

      We are actually in the process of changing the printer-friendly version to display the article all on one page. Sorry it's not ready today, hopefully by next week.

      --
      Ed Grossman, InformationWeek
  14. 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?

  15. woo by nomadic · · Score: 3, Funny

    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.

  16. A great programming language by toddbu · · Score: 5, Interesting
    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.)

    --
    If you don't want crime to pay, let the government run it.
    1. Re:A great programming language by seminumerical · · Score: 2, Informative
      I loved the fact that everything was pass by reference

      Actually, FORTRAN IV, on some computers of the day (I think IBM 360/370 using FORTRAN's G or H), used pass by "value and result" rather than pass by reference. There were so many differences amongst the dozens of dialects of FORTRAN out there in my day (late 70's) that portability was nonexistent and I changed languages.

      --
      In wartime... truth is so precious that she should always be attended by a bodyguard of lies. (Churchill)
  17. Re:One man's ugly skank... by m50d · · Score: 2, Interesting

    I think people like perl because you can do cool things in a short program with it, not because it's beautiful.

    --
    I am trolling
  18. And assembly is pretty? by Infinityis · · Score: 2, Interesting

    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 like a baby's toy."

    I, for one, look forward to the day when I can think code and have it be done instead of writing it line-by-line.

    1. Re:And assembly is pretty? by deadlinegrunt · · Score: 4, Funny

      "I, for one, look forward to the day when I can think code and have it be done instead of writing it line-by-line."

      So you have aspirations to be in management or an end user? I'm not clear here.

      --
      BSD is designed. Linux is grown. C++ libs
  19. You would have thought... by beelsebob · · Score: 3, Interesting

    ... 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".(warning: pdf link).

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

    1. Re:Why use FORTRAN these days? by rebelcool · · Score: 2, Informative

      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 millions of dollars and years of work. So, the course taught parallel programming by having students doing this work! It was fairly successful, and is probably still taught. The converted libraries generated by students are in use in several fields. It was alot of parallel linear algebra libraries, IIRC.

      --

      -

  21. Re:One man's ugly skank... by BlueCodeWarrior · · Score: 2

    The existence of Perl poetry says that you're wrong...

  22. Fortran >=90 is nice and easy to learn by poszi · · Score: 2, Informative

    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 is free (as in beer) and works fine. It includes also documentation of the language so you may try it.

    --

    Save the bandwidth. Don't use sigs!

  23. QOTD by pete-classic · · Score: 2, Funny

    Heh. The quote of the day at the bottom of slasdot was somthing like "HONK USE IF THEN" earlier this morning.

    -Peter

  24. How to program in any language. by adolfojp · · Score: 3, Funny

    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

  25. Is it just me... by angst_ridden_hipster · · Score: 2, Funny

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

    --
    Eloi, Eloi, lema sabachtani?
    www.fogbound.net
  26. FORTRAN Ugly? by Hu's_on_first · · Score: 2, Funny

    Have you ever had the misfortune of working with APL?

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

  28. In Soviet Russia... by dim5 · · Score: 2, Funny

    the keycard punched YOU!

    --

    Is something burning?
    Oh, it's my karma.

  29. Punched Cards and Rubber Bands? LUXURY! by Anonymous Coward · · Score: 3, Funny

    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!

  30. Why FORTRAN makes people think FORTRAN-66 (or 77) by Glomek · · Score: 4, Informative

    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 FORTRAN compilers out there (g77, f2c) have been FORTRAN-77 compilers. g95 is still fairly young.
  31. 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.
  32. Blast from the Past by mborland · · Score: 2, Interesting
    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.

  33. Yes, older languages can be ugly... by Richard+Steiner · · Score: 5, Interesting

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

    --
    Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
    The Theorem Theorem: If If, Then Then.
    1. Re:Yes, older languages can be ugly... by AJWM · · Score: 4, Interesting
      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.
      --
      -- Alastair
  34. hardly unfortunate by hawk · · Score: 4, Interesting

    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

    1. Re:hardly unfortunate by joggle · · Score: 2, Interesting
      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 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.

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

    3. Re:hardly unfortunate by Fruit · · Score: 2, Informative
      Actually C has those too:
      int main(void) {
      char x[7][13];
      printf("%d\n", sizeof x);
      return 0;
      }

      % ./a.out
      91
    4. 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

    5. Re:hardly unfortunate by Anonymous Coward · · Score: 2, Interesting

      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.


      Actually, it doesn't any more. Hate to be the one to break it to you, but C hasn't stood still either.

      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.

      BZZT, wrong! The latest version of C, "C99" (supported by almost every compiler out there, including GCC) adds a keyword that might be useful for you:

      restrict

      Here's how you use it. When you declare a pointer variable (maybe you have a function that accepts an array of floats), instead of going:

      void myFunction(float *myListOfNumbers) { /* blah blah */}

      you write:

      void myFunction(float *restrict myListOfNumbers) { /* blah blah */}

      What does that do? Well, when you 'restrict' a pointer, it means you are telling the compiler that the memory it points to will only ever be accessed by using that pointer. (And not, say, by some other completely different function that just happens to create the same pointer (value) and twiddle bits of memory independently.)

      What does that _mean_? It means that you get the "FORTRAN memory access model", exactly where you want it, with just a few keystrokes. All the optimizations your FORTRAN compiler does, your C compiler will do too, since they become legal.

      There's nothing unfortunate at all about Fortran's (not FORTRAN any more) role in scientific computing.

      Indeed! As a working scientist, I'm sometimes happy that others still use junk like Fortran: less competition for me to worry about! :) I shouldn't be so nice, but if you want to learn more about this, you might start here:

      http://sc.tamu.edu/help/power/powerlearn/html/Sc al arOptnw/sld042.htm

    6. Re:hardly unfortunate by Dachannien · · Score: 2, Informative

      Either that's a bad example, or compiler optimization has come a long way, baby. Or maybe I just don't get what you're getting at. But a quick test using gcc reveals this:

      http://sokar.cwru.edu/multidim.html

      Note that the code that calculates the offset into the x array (italicized for convenience) is one instruction shorter for x[i][j] rather than the code you listed.

    7. Re:hardly unfortunate by pavon · · Score: 4, Informative
      You are misinformed. char x[5][10] does allocate a contiguous block of memory, and x[i][j] does index that memory the exactly as if you were to write *(&x + 10*i + j) !

      I know this for a fact as I have written graphics software that treated multidimensional arrays as a contiguous blocks of memory accessing it using x[i][j] notation and iterated pointer notation depending on the circumstance and both worked the same. I have also read the assembler output from a C compiler and it indeed compiled x[i][j] the same as *(&x + 10*i + j).

      To further back up my statement here is a direct quote from Kernighan and Ritchie's "The C Programming Language" Chapter 5:
      5.9 Pointers vs. Multi-dimensional Arrays
      Newcomers to C are sometimes confused about the difference between a two-dimensional array and an array of pointer such as name in the example above. Given the definitions.
      int a[10][20];
      int *b[10];
      then a[3][4] and b[3][4] are both syntactically legal references to a single int but a is a true two-dimensional array: 200 int-sized locations have been set aside, and the conventional rectangular subscript calculation 20×row+col is used to find the element a[row][col]. For b, however, the definition only allocates 10 pointers and does not initialize them; initialization must be done explicitly, either statically or with code. Assuming that each element of b does point to a twenty-element array, then there will be 200 ints set aside, plus ten cells for the pointers. The important advantage of the pointer array is that they rows of the array may be of different lengths. That is, each element of b need not point to a twenty-element vector; some may point to two elements, some to fifty, and some to none at all.

      So the notation x[i][j] will compile down to either *(&x + 10i + j) or *(*(x+i) + j) depending on whether x was declared a true multidimensional array or an array of pointers.

      One caveat (and possible source for your confusion) is that when declaring a true multidimensional array you must know the dimensions at compile time. You cannot for example declare x[width][height], and if you allocate a chunk of memory with malloc, you can access it as a single-dimensional array using the x[i] notation, but there is no notation for treating it as a multidimensional array. I have had to manually index dynamically allocated chunks of data using *(&x + 10i + j) before, and I agree it is a pain. Fortunately C++ fixed that and you can allocate multidimensional arrays at runtime and use the x[i][j] notation.

      To be fair however, I'm pretty sure that FORTRAN 77 did not have automatic or allocatable arrays either - there were some implementation-specific ways of doing it, but it was not officially added until FORTRAN 90. But I am young enough that FORTRAN 90 was my first FORTRAN, and what I know about 77 is only from historic reading, not experience, so take that with a grain of salt.
    8. Re:hardly unfortunate by beliavsky · · Score: 2, Interesting

      >Could you give specifics, please? That post was >a bit too abstract to give any credence to. >What calculations? Why do these use less code
      >(and how do they compare to C++, with its use >of operators and templates?).

      Fortran 90/95/2003 shines in its treatment of multidimensional arrays. It resembles Matlab, with the advantages (and disadvantages) of a compiled language. Here are some of its specific strengths:

      (1) To dynamically allocate a 3D array the code is just

      real, allocatable :: x(:,:,:)
      allocate (x(n1,n2,n3))

      It's messier in C++.

      (2) The array can be passed to a function just as a scalar is, without needing to mess with pointers. Arrays know their own size, so the dimensions of the array need not be passed as function arguments.

      (3) Most intrinsic functions of Fortran are elemental, so exponentiating array x is done with just

      x = exp(x)

      No need for a triple loop as in C++.

      (4) There are fast, flexible array intrinsic functions. If x is a matrix, one can compute the sum of all elements, the sum of each column, and the sum of each row with just

      y = sum(x)
      y = sum(x,dim=1)
      y = sum(x,dim=2)

      (5) One can work with arbitrary array sections with notation such as x(1:n1:2,:n2-1) .

      (6) One can define elemental functions and subroutines that operate on a scalar or an array of any dimension, just as the intrinsic functions do.

      (7) Arrays of user-defined-types are convenient to work with. For example, given a data type

      type :: person
      real :: age,weight
      end type person

      One can declare

      type(person) :: players(10,20)

      and then access the array of ages with just

      players%age

      In C/C++ one has built-in access only to the age of a single person with something like

      players[0][0]%age

      (8) Arrays can have a lower bound of 1 (the default) or any other integer. For many if not most calculations, 1-based indexing is more natural.

      (9) The basic array syntax of

      x(i,j,k)

      in Fortran is more readable than the awkward

      x[i][j][k]

      of C/C++

      Fortran rules!

    9. Re:hardly unfortunate by Mr2001 · · Score: 2, Informative

      One caveat (and possible source for your confusion) is that when declaring a true multidimensional array you must know the dimensions at compile time. You cannot for example declare x[width][height]

      I'm pretty sure GCC lets you do that, doesn't it?

      --
      Visual IRC: Fast. Powerful. Free.
  35. Even more scary? by Sycraft-fu · · Score: 2, Interesting

    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 was not meant to do :)

  36. FORTRAN gets its bad reputation... by alispguru · · Score: 3, Informative
    ... 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.

    --

    To a Lisp hacker, XML is S-expressions in drag.
  37. 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.
  38. Re:Speed of Fortran by twiddlingbits · · Score: 3, Informative

    " it's a lot quicker to write/maintain makes most of that speed differential meaningless." No it doesn't. Some of the FORTRAN code is used in algorithms that do things like Finite Element Analysis, High Energy Physics and Weather Prediction where it is not uncommon for something to run for HOURS or run many times with different variable settings (i.e. Monte Carlo). These systems invariably use highly optimized FORTRAN code. CPU time is NOT free and often an Engineer is charged a "tax" by IT for his CPU useage over his allocation. You only save the programmer time once, you save execution time EVERY run. I've worked in the Aerospace biz many years and have never seen big number crunching programs done in C/C++ or Java. I have seen some Assembler but not much. I've also written C code for embedded systems and I do know it can be written very efficently, but it's not at all optimized for Math thus FORTRAN beats it.

  39. Re:Nothing for you to see here, please move along. by Rei · · Score: 4, Interesting

    Certainly, you can write poorly in any language. But you can't necessarily do the opposite.

    For example, I initially resisted C++. I viewed it as poorly designed objects on C (after experiencing the beautifully done objects of LPC), and programming examples for it made objects of things that never should have been objects - and as such I wanted nothing to do with it.

    However, the other features of C++ ended up proving themselves infinitely useful, and since the value of C++ objects has shot up notably in my mind. Examples:

    Templates: I can't even imagine how many pieces of code I wrote before C++ in which I wrote different versions of the same function for different variable types. Talk about a maintainance nightmare :P

    Const correctness: I remember resisting this like crazy, because it makes initial programming harder. But not only does it offer some serious benefits to the compiler at optimization time, but it's saved me many times from errors and really helped with code cleanup and refactoring into functions. My only real problem with it, now, is programmers who don't const their libraries, thus preventing me from consting variables that I need to pass to them at each step of the way.

    Destructors: I don't think I need to even get into why having your variables clean up their memory when they go out of scope is probably the best thing that ever happened concerning fighting memory leaks. You can also do garbage collection with smart pointers, but that's a topic for some other time and is less standard.

    std::vector: I can't believe that I used to not only have to clean up variable size arrays before, but used to have to have each array contain three variables - the pointer, the count of elements, and the allocated size - all of which would need to be checked and adjusted at each insertion and deletion.

    std::string: A lot easier to use than C's unwieldy strings, and easy to convert to and from regular C strings.

    I could go on for a long time... a good language can save you many programming headaches if you're willing to learn it.

    --
    We also have a halon fire extinguisher. Its always nice to have a fire extinguisher that kills people around.
  40. 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.
  41. GPL by Bananenrepublik · · Score: 3, Informative

    Unfortunately, g95'S developer chose to rather violate the GPL than to either work together with the gcc people or at least let them use his code. Look here for more information on the split.

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

  43. 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.
  44. Re:Nothing for you to see here, please move along. by locofungus · · Score: 2, Informative

    For the second case:

    #include <iostream>

    class A { public: virtual void do_something() { std::cout << "A" << std::endl; } };
    class B:public A { public: virtual void do_something() { std::cout << "B" << std::endl; } };

    void myfunc(A& a) {
    a.do_something();
    }



    Does this code print A or B when myfunc is called? Which do_something() is executed? Unless you are using function pointers, this ambiguity does not exist in C (or FORTRAN)

    For the first case I wrote:
    There is no way of telling just by looking at this code.

    in C if I have int i; do_something(i); I know that i doesn't change. I don't need to look at the prototype (ok do_something could be a macro)

    What I would have liked is for the caller to a non-const reference to still have to write that '&'. The callee gets the benefit of the reference and anyone looking at the caller code immediately knows that there might be something happening that isn't explicit in the code they are looking at.

    In theory a smart syntax highlighter could do this but it would probably have to almost be a compiler to handle this, especially if you want it to be correct, even in the face of macros. And I don't want to have to wait for a compilation every time I load a file up into my editor.

    An editor could not handle something like:

    #ifdef REALLY_SCREW_THINGS_UP
    void shit(int& i) { i=i+1; }
    #else
    void shit(int i) { }
    #endif

    int main() {
    int i=0;
    shit(i);
    }


    But a compiler could have refused to compile unless that call in main was changed to shit(&i); if REALLY_SCREW_THINGS_UP was defined.

    --
    God said, "div D = rho, div B = 0, curl E = -@B/@t, curl H = J + @D/@t," and there was light.