How many times have you learned Fortran in your life?

Fortran was born more than 60 years ago and being a standardized language, it acquires new features every 5 to 10 years. So if you’re old enough :t_rex:, you have probably learned Fortran several times! Of course, you probably have not learned everything in each new standard but you took what you needed or was improving your programming. Here is the place to share your story with the community…


Personally, I first learned Fortran at the beginning of my Ph.D. in 1995-1996 :man_student: . I began with Fortran 77 because I had to use software already written in that style. But swiftly learned Fortran 90/95 to translate those programs in a more modern style (free form, getting rid of numeric labels, no more goto… :partying_face:).

It’s probably only in the late 2000’s that I learned the array syntax introduced by Fortran 90 (if my memory is OK), and forall statements. In 2011, I was interested by Fortran 2003, mainly because of the C interoperability, for the gtk-fortran project.

In the mid 2010’s, I read several books published after Fortran 2008. I use a few features of that version, but I can’t pretend to really know Fortran 2008. Reading books is one thing :books:, using their content is another thing :man_factory_worker:. But I also learned more general things in those books like good practices (tests, style…), OpenMP, etc.

I now feel I should learn Fortran one more time :man_student: … And you?

7 Likes

I first learned Fortran in 2014 for the master thesis research project in my chemical engineering degree. At the time I was only using Fortran 90/95 procedural programs with all my routines aggregated into a single file without modules.

In 2016 I took a finite element course using Python. The most “advanced” part of the course was to write a class for a Lagrange polynomial interpolant. This led me to discover that Fortran had object-oriented programming concepts too.

Now during my PhD studies, I’ve been using Fortran readily for various simulations and other small projects. My favorite part has become interfacing Fortran with various codes in C.

So far, I haven’t found the time (or the right project) to dive into co-arrays, but hope to do so with the help of Milan’s book in the future. So far, my desktop machine has been fast enough for the type of calculations I’m doing, with OpenMP for the parallelization.

4 Likes

Basically I have learned three times: Fortran 77, Fortran 90 and Fortran2003/2008. I work mainly in numerical simulation of groundwater flow and the standard software is called MODFLOW and it has been developed since 1984 by the USGS. The first version that I used was MODFLOW96 and it was developed in Fortran 77. The next version of the software was called MODFLOW2000 and it used some features of Fotran90 (mainly modules and dynamic memory allocation), but most of the code still was Fortran 77. Then MODFLOW2005 started to use derived data types and the last version MODFLOW6 (released in 2017) uses many of the object-oriented programming capabilities offered by Fortarn2003/2008. So in my case in order to understand a code that I need to work with on a daily basis and has been in continuous development since 1984 I have had to learn three different incarnations of the Fortran language.

5 Likes

Thank you @vmagnin for asking this question and sharing your learning experiences with Fortran.
I started learning Fortran90 in early 2016 during my PhD work to developed a finite element method for an elastodynamics problem. It was mainly procedural based program.
However, with time, I kept on falling for modern Fortran (mainly because it was my first programming language and I was completely aware how it does things). By the end of my Ph.D., I developed a fully functional fortran library (or, framework) for writing FEM codes (it is called EASIFEM). It is like Matlab but for implementing FEM. EASIFEM is written in OOP style (things, I borrowed from python and CPP and implemented using modern Fortran) and multi-dispatch style (things that I learned from Julia and implemented using modern Fortran). So, over the course of 5 years, I have learned fortran may be 5-6 times. Now, I am adding MPI based distributed parallel computing in EASIFEM by using modern Fortran.

Regards
Vikas

6 Likes

I’ve been learning Fortran (and programming in general) for approximately two years. I found an interesting book “Introduction to Modern Fortran” from library and experimented with many of its code examples.
I don’t have any academic or software development background.

5 Likes

I think I learned Fortran about 6 times.

  1. First I learned FORTRAN 77 in 2006 in my undergrad meteorology program. The text used was the Professional Programmer’s Guide to Fortran77 by Clive Page. This was my first real contact with programming if I don’t count Pascal in high school and Microsoft BASIC which we had on our MS-DOS home computer growing up but mostly used for games. Although I remember thinking that all uppercase and 7th column were weird, most things made sense. Probably because the teacher was good. The compiler we used at school was g77, precursor to gfortran. We had some good practical exercises with it, such as for projects in numerical methods classes, and I started tinkering on my own at home with Silverfrost Fortran. Whenever we struggled with some Fortran issue, my thesis advisor would say “never leave the house without Metcalf & Reid in your back pocket!” (he says Metcalf & Reid because he owned the “Fortran 90 Explained” edition which was before Malcolm Cohen joined as co-author).

  2. In 2008 I got Fortran 95/2003 Explained (Metcalf, Reid, Cohen) as a gift from friends. I started reading it cover to cover, thinking of it as an ordinary textbook, but I struggled a lot with it. If you’ve read one of these books, you know that the text is dry, non-linear, and is more of a reference than teaching material. But prior experience with F77 helped and I was soon able to “level-up” my Fortran knowledge and learn dynamic allocation, whole-array arithmetic. In the Fall of that year I started working on my thesis project, which was implementing an alternative time discretization (forward-backward instead of leapfrog + Asselin filter, in case you’re familiar with that stuff) in the Princeton Ocean Model (POM). There are now quite a few variants of POM, but back then there was only the F77, serial, single Fortran file POM. During the implementation I also refactored the code to free-form and using whole-array arithmetic whenever possible. It was a fun exercise, and I learned that more concise code (e.g. whole-array arithmetic instead of nested do-loops) is not necessarily more (and is sometimes less) efficient.

  3. In 2009 I came to U. of Miami for my PhD and pretty early on began working on porting a spectral wave model from MATLAB to Fortran (umwm.org). This was the only time that I learned MATLAB, which I soon forgot almost everything about. The motivation was the need to run the model in distributed parallel mode, and the need to integrate it with 3 other existing Fortran software (ESMF, WRF, HYCOM) into a single application. During this time I learned about parallel programming with MPI, interfacing some basic C code, and caveats with floating point calculations.

  4. In 2013 I started working on a datetime library (this was my first GitHub project) because I found myself often writing clunky code to track time in a Gregorian calendar, which is typically used by weather and ocean models, as well as measurements. There was other date and time Fortran code around, but I really liked the Python datetime API so I tried to mimic that. During this time I learned in more depth about derived types, type-bound methods, and custom/generic operators.

  5. In 2017 I started working with Manning on my Fortran book. Somebody said that you really learn a thing when you need to find a way to explain it to others. I think this is true. I probably learned more about Fortran during the writing of the book (Aug 2017 - Jan 2020) than I have in all the time before. Of course, I learned a lot about writing as well, and I think this alone was worth for all the work I put into it.

  6. Then in late 2019 we started fortran-lang and I’ve been learning a ton from all of you across all its repositories. Although I had individual open source projects before (and some of them relatively popular), this was my first experience with community open source development.

I still don’t feel like I really know Fortran. :slight_smile:

9 Likes

Ah, yes I forgot UPPERCASE! I get rid of uppercase in the legacy codes I was using only in the late 2000’s…
It’s true the Metcalf is not for beginners… Very precise and inspired by the standard. It’s my reference. But yes, it must be used as a reference.

It inspires me another question: has anyone read the whole Fortran standard? :cold_face: Which version?

Idea for the adventurous: Write a Fortran program that uses all features of the language, parses the text of the standard, parses its own source code, and ensures it’s standard conforming. :crazy_face:

1 Like

Could be easier (?) with the 1957 FORTRAN… Smaller language at that time… :yum:

This topic makes me feel old; I still remember the novelty of zero-trip DO loops.

4 Likes

@vmagnin and everyone who has posted thus far:

At a somewhat deeper level, the question really ain’t how many times has one learnt Fortran. Rather, it’s how many programming paradigms does one pick up whilst using computing to solve problems over a fair duration of time.

The responses thus far are typical of how the computing education system in technical domains has been over the last few decades.

So one picks up basics of procedural programming in the “early” days, a paradigm foundational to FORTRAN up to the FORTRAN 77 revision.

Then one starts to combine the procedural approach with aspects of good coding practices (GCP) as termed also as structured and modular programming styles as these became better supported by Fortran 90/95 standards.

Object-oriented programming paradigm and functional programming aspects becomes viable with Fortran 2003.

Parallel programming, at least in the SPMD mode with the PGAS model. got standardized and refined with Fortran 2008 and 2018 respectively.

The good thing is Fortran has continued to evolve toward a multiparadigm programming language.

The unfortunate part though is that Fortran has appeared a hesitant and a rather slow follower of the trends in technical computing and mostly lost its presence in academia and many parts of industry.

The paradigm of generic programming (which can be kinda seen as templated metaprogramming also) should also have been on the list above. But current standard only includes rudimentary support for some aspects with subprogram (procedural) genericity. One now has to hope Fortran 202Y will provide the needed facilities but with robust and reliable compiler support for that likely only around year 2035 :sob: How many here will truly be “coding in anger” a decade and a half from now!?

The “story” with Fortran could have been a lot different with many, many more scientists and engineers, at least those on the brighter side of mid-30s, having formally learned the multiparadigm approach with all of the paradigms I list above and their applications in scientific and technical computing from the get-go early in their academic career. Alas, that is not the case.

5 Likes

I took an Intro to Fortran course my first semester of college (2005). I didn’t get back to programming at all until my first job in 2011. At that point I was basically just programming (and learning) Fortran 90, but really just free format FORTRAN 77.

A couple years later I started learning Python, getting better at bash, sed, awk, and a bit of Perl. At that point I came back to Fortran trying to apply some the techniques and practices I learned in those other languages, and was happy to find the later standards (03/08) supported much of what I wanted.

I turned away from Fortran again to learn Ruby (on Rails), Javascript, and then Haskell. Coming back to Fortran from those languages motivated me to start working on the beginnings of what became fpm, which I started work on as soon as I met @certik . That is also what motivates me to work on the generics subcommittee, as it will enable many of the practices I learned from those languages.

So I would say I’ve learned (or come back to learning) Fortran 3 times now. But I’d say it’s learning other languages that pushed me to learn more.

6 Likes

In 1977 in my second year at uni (QMC, London) we were taught Ratfor because it should help us to write better structured programs than the wild lands of raw Fortran that we had to use in 1978. For a long time compilers came with a Ratfor front end but I don’t think that’s the case anymore.

2 Likes

@FortranFan has a valid point, at least for me it never felt like I relearn a language but more like a gradual process of discovering more possibilities and applying them to my projects. Only recently I hit a point with Fortran where there seems to be no more to discover and the language sometimes feels incomplete or clunky.

But maybe I’m not long enough around here, judging from the other comments. I started in 2017 basically from scratch using a C++ tutorial but coding it up in Fortran, it was a great C++ tutorial because it was a guide on electronic structure methods and (procedural) programming and I had to learn both at this point. From there I started gradually learning Fortran by trial-and-error, compiler warnings and existing source code while discovering and applying new concepts.

At least for me the biggest change in my perception of Fortran (and programming languages in general) was joining the open-source community in 2019 by pushing my first real-world project on GitHub. I was expecting to get a lot of response on the implementation, source code, whatever… instead I got questions about installation, compilers and deployment. To me it felt like Fortran was never the problem, just the tooling (in fact it turned out there are good tools for Fortran around).

6 Likes

I first “learned” FORTRAN in 1981, during a degree in Physics, probably using NOS on a CDC mainframe, through a terminal (check out http://bitsavers.org/pdf/cdc/cyber/nos/60435400J_NOS_Version_1_Reference_Volume_1_Aug79.pdf for user-friendliness). It was horrific and I retreated to BBC Basic.

10 years later I was employed by NAG Ltd, whose Algol, Fortran, C, Ada, etc numerical libraries had made a splash since the 70s. One of my colleagues, Malcolm Cohen, was writing a Fortran 90 compiler, the very first one to appear. 30 years on, I am still learning Fortran from the Standard that he edits and the book that he co-authored with Michael Metcalf and John Reid. I have a few iterations of that book: the “revised edition, Fortran 8x Explained” from 1989 is the oldest of the editions in my library, the very first one was based on the first draft of the f90 Standard, dated 1987.

7 Likes

If I remember well, I had some F77 lectures during my master in 91-92 (DEA at this time in France), maybe before, but I’m not sure. Then, I’ve used it during my master project in theoretical chemistry and later one during my PhD (93-96). When, I’ve got my permanent academic position, I’ve started to write research codes (in quantum dynamics) from scratch in F77.
Around 2004, I’ve moved those codes in f90, using dynamical allocations, modules, derived types, overloading… I don’t remember, the book I’ve used. I still have it, but in my office!
Recently in 2016, I did follow a 3-days f2003 lecture from a computational center in France (IDRIS). I was mainly interested by the oriented object features. Now, I’ve started using these OOP features for a new code.

5 Likes

I first learned Fortran IV in my first year of university (in 1982/83). Then I relearned what was presented to us as Fortran 77 with the Vax/VMS extensions in master (1987), for projects (gas accretion on binary stars). During my thesis, I discovered a lot of tricks thanks to the reading of a galaxy photometry code. Afterwards, while developing my own N-body and hydrodynamics codes, I followed the evolutions to Fortran 90, then 95, by following trainings by HPC computing centers to facilitate learning. Now, I am slowly initiating myself to Fortran 2008. You learn all the time with Fortran :slight_smile:

5 Likes

I learned fortran the first time in 2000 for my undergraduate thesis, with a good set of lectures notes on Fortran 90 from some British university. In that occasion I had no idea of how OOP was supposed to work and I made all sorts of weird architectural decisions, learning the hard way why data hiding matters. During the PhD I acquired a modular coding style and started using OO more. In my second postdoc, in view of contributing to a demanding ERC project, I looked for some source of best practices and stumbled across “Code Complete 2”, which I loved becaused it contained most of the practices that I had converged towards on my own. I also wrote some parallel PETSc code, which is its own dialect. Since I am not using much more than MPI for what I do, I would like to learn more about co-arrays in the most recent standards of the language. When co-arrays came out, I remember reading some comments from Steve Lionell about them not being quite there yet (I think he was referring to performance). Time has passed and it looks like the language is mature for practitioners to enjoy it. I have ordered a couple of copies of Milan’s book, one for me and one for my future postdoc (if and when I’ll find one). Amazon is due to deliver them this afternoon: Christmas!

4 Likes

Yes. Malcolm Cohen has very likely read the whole standard for 2008 and 2018 (as the editor for those documents).

1 Like

I’ve learned several languages, all named Fortran. Starting with IBM Fortran IV in 1968 (for IBM 1130, while in high school), then the same language in the 1969-1970 school year, intro college programming (for freshmen), with the WATFOR/WATFIV compiler. [The assigned textbook was the IBM FORTRAN Language Reference Manual.] Later in undergraduate college, I “upgraded” to the IBM G and H compilers, all on the college’s central IBM 360/65. Grad school in 1973 brought a Univac 1108 with Fortran 5, and later a VAX 8600 (bought by our research group in physics) with DEC Fortran (a definite step up). The VAX was the first system without a card reader. At Cray, I started programming in parallel with coarrays in the late 1990’s with the Cray Fortran90 compiler. Subsequently, Fortran 2003, 2008, and now 2018 (compiler name changed to just “ftn” to avoid having to change it with each new standard).

6 Likes