Structured Programming in Fortran

Author: Drew McCormack
Web Site: www.maccoremac.com

There are many books on Fortran programming available, and they all do a very good job of describing the syntax and constructions of the language. But there are very few books on Fortran that explain how to write robust software. These books exist in abundance for languages like C++ and Java, but Fortran programmers are usually left to fend for themselves, and the results are not always pretty.

I’m beginning a new course on Fortran programming at my university, and I decided I wanted to put a strong emphasis on software development and design. I didn’t just want to teach students what an if/then/else/endif construction was, but also how you build up a complex piece of software out of Abstract Data Types, so that it is maintainable and can be easily extended.

I’m making available two of the chapters from the course in the hope that they will fill in some of the gaps in the literature for other Fortran developers. These chapters deal with general principles of software design, and how you work with Abstract Data Types (ADTs) in Fortran 90.

Comments

Bridging Fortran and other languages

Interesting topic, and I'll be reading over the chapters tonight after work.

Will you be covering mixing Fortran with other languages?

Bridging Fortran

What did you have in mind? Calling C from Fortran? Something else?

Drew

---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org

Mainly calling C from

Mainly calling C from Fortran and vice versa. I'm not a scientist - merely a keenly interested engineer - but I find it useful to be multilingual when the situation calls for it.

I would add calling Fortran

I would add calling Fortran from a scripting language: Python, Ruby or Perl come to mind (in that order). Do the bits that are hard in fortran in a scripted language, and to the computationally intensive part in Fortran.

Maarten

Awesome!

Hey Drew,
I really enjoyed your write-up! Thanks for sharing! You are right, there are very few texts like this!
I agree with other commenters that also I would find it very interesting to learn about how to call fortran from C, and also from python!

I might have found two typos:
- page 73, example in gray box at bottom: I think it should be
do i=1, n
y(i) = 3
end do

or you might as well write y=3 without the loop (which is shorter... but maybe you wrote it with the loop to make your point a little clearer...)

- on page 83, top gray box: the subroutine SetSleepTime should be ended with "end subroutine" instead of "end function"

complete notes?

Hi Mr. McCormack:

Where can I get the complete notes of your "Structured Programming in Fortran" course?, is it a comercial book that I can buy at amazon? (it does not appears in their search service)

Best regards.

Re: Complete Notes?

The notes are from a course I am giving, but there is no book. The chapters I posted from the notes are the only ones that cover structured programming. The rest you would find in any book on Fortran programming.

Drew

---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org