Is there any good reason to develop a new software project with Fortran anymore?
Scientific computing is often written in Fortran for a few reasons:
- Scientists don't know other languages,
- You can get better performance in Fortran than C for scientific code (lots of massive arrays), because of aliasing restrictions in Fortran, which allow the compiler to optimize better. This can make a 30% difference in speed,
- There are a lot of scientific libraries in Fortran.
So, I would say the only good reason would be you're working with scientists (like computational chemists or physicists, say) who have a lot of entrenched fortran, dont want to learn new stuff, and the speed is super important.
Otherwise, there are probably better ways to achieve the same results (C++ libraries or Python libraries, say).
Yes:
- if you need to deal with vectors and matrixes a lot
- if you do lots of heavy numerical work
- if you want to make use of some of the most optimised numerical libraries in the world
- if you are into supercomputing
But there is of course no need to limit yourself to one language. One project I worked on, for example, used C++ and a GUI library to draw models of oil-field pipe networks, and then used Fortran to optimise the flow of gas and liquids through the pipes.
...At a conference on computational physics in South Korea (CCP2006), most of the plenary speakers who talked about codes used Fortran. Perhaps scientists prefer Fortran because they're productive when using it.
There are many good reasons for using Fortran. How often do you hear of someone hacking a fortran app? It's not like the language is broken. Sure there are some nice features that wouldn't be readily available but you can still make it work.
Just think of it as retro programming or vintage development.
Scientific numerical software is often still written in Fortran, for the reasons given in other answers. I'd just add that in 2008 I heard an Intel employee say that their high-performance Fortran compiler outsells their equivalent C compiler. The Fortran compiler sales were also growing faster.
No (with clauses):
Fortran is a language with a very low expressivity (see footnote), unexistent libraries for common non-numeric tasks, an awful handling of strings, no exception handling, a dangerous system of variable declaration (unless overridden), no decent IDE, an obnoxious standardization, no decent and fully compliant free compiler (g95/gfortran do not support the full language specs, and I heard they have troubles), incredibly limited namespacing capabilities, among many others.
It makes absolutely no sense today to start developing a large project in Fortran, It would be like ploughing a vast terrain with a hand plough. Doable, but a waste of time. Many laboratories directed by the new generation of professors are ditching Fortran and moving either to C++ or to python. Young computer-savy students don't want to touch Fortran code with a 3 foot pole, because they know that better alternatives exist, so only the unsavy will accept it, and generally produce low quality code as a consequence of their low interest in programming as such. You are therefore screening out people interested in programming. Moreover, if the code for whatever reason happen to go commercial (for example, a spin-off), then you will have to rewrite it: hiring will be a nightmare otherwise.
You should use a highly expressive language as much as you can, reducing lines of code and bugs, improving development speed, code clarity and testability. Then, profile your code, and optimize the really time-critical parts in Fortran. On this, I am all for it (but consider C first).
More on the point http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/
Footnote: See this page on the pedia
Language Statements ratio[25] Lines ratio[26]
C 1 1
C++ 2.5 1
Fortran 2.5 0.8
Java 2.5 1.5
Perl 6 6
Smalltalk 6 6.25
Python 6 6.5
According to the pedia, the data come from Code Complete. You are also welcome to play with this page for a comparison of different languages for a set of benchmark codes. Comparing a language with itself brings the absolute values.
This question is so old.
There are many reasons for using Fortran, many of them have already been stated so I won't repeat those.
A small digression, if I may - although unrelated to your question by title, the post at the link may also clear away some doubts.
But, allow me to add just one more reason, which as far as one can see, nobody thought to mention still. That is, and this of course depends on the type and projected life length of your project, is that fortran today has extremelly good backing. Technical and financial wise - I would dare to say even, that maybe only a handful of languages have available the number of compilers Fortran has (we're talking still actively developed ones here), and with the names like Intel, Lahey, and NAG it is not going anywhere in the not so near future. With its principle of strong backward compatibility it is a language that fits very good for long term projects.
This being a forum oriented mostly at professional programmers, not engineers and alike, one of course can expect what is usually the common answer to this kind of question - but remember, they said in the 80ties that "Fortran was dead", they repeated it in the 90ties, and they're still (I see) saying it today.
Check out the first link, it may clear away some doubts on the Fortran-python-matlab trilemma :); if you still feel uncertain, refine your question a little.