Kicking And Screaming

How valuable is code that runs fast, but can’t be extended or modified? How can you be productive in a code base that’s grown into a big ball of mud because that was how you made things fast? How much speed would you be willing to give up in the name of developer happiness and productivity?

In my time as a Fortran programmer, I’ve found that community to be full of the sentiments “That’s how we’ve always done it” and “that’s just not how we do things”. Fortran just seems to be stuck using old techniques and practices, and nobody wants that to change. To some degree, I can understand this. Fortran is a language used primarily for heavy number crunching that needs to be fast. Using new features and techniques can result in code that runs slower. In a language and community that values speed at all costs, I can see the resistance.

I also think there is a bit of selection bias going on here. Most Fortran programmers I know started their coding career with Fortran. I suspect most people who went on to learn other languages quickly grew frustrated at the lack of modern tooling and conveniences available in Fortran. No variable length strings. No standardized build system. Little to no editor support. No testing frameworks. And so, once they learned another language that made it easier to be more productive, they never looked back. And so the ones left simply weren’t interested in learning new things.

I’m not convinced that the state of Fortran programming can’t be improved. I’m not sure the choices made in the Fortran community have been made with the full knowledge of the trade-offs involved, and the possibilities that new techniques and technologies can bring. I think it’s time to bring new life to Fortran.

I’m starting simply, with some basics. First, I’m using a modern version control system, git, to help make it easier to share my code. Next, I’ve created a build system that understands the idiosyncrasies of Fortran, so you don’t have to spend tons of time maintaining convoluted Makefiles. And lastly, I’m creating open source libraries using modern software design principles to make them easier to reuse, extend, and modify. The most important of these being a testing framework, vegetables. I’ve got several others implemented so far, and ideas for even more.

I also plan to create several online courses to teach Fortran in a way that includes modern design principles and techniques. I’ve already finished the first one. I’ll also have some courses teaching version control principles, and teaching some testing practices. Of course, since this isn’t my full time job, I’m not sure just how long it will take me to get to all of it.

This is going to be a tough job, and it’s going to take a lot of effort, but if somebody doesn’t get started we’ll never be able to improve the lives of those poor souls left maintaining the legacy Fortran code bases still being used to drive science and engineering. I hope I’ll be able to convince some of you to join me.

7 thoughts on “Kicking And Screaming

  1. What platform and compiler are you using ? We are still using the old Watcom F77 / C / C++ system on Windows 7 Pro due to incompatibilities with the newer compilers. We have 850,000 lines of F77 that is very difficult to change without significant effort.


    1. I’m using gfortran on Linux.
      I imagine that code base would be a hassle to work in. I’d be curious what your typical cycle time is. Like, how long from “we need to change this” until you can say that you’ve made the change and are confident you didn’t break anything else in the process? How much would you be able to save if you could cut that time down by an order of magnitude?


      1. It depends on the level of the change. Changes in outlying areas can be released in an hour or two. Changes in the central core require execution of our 600+ benchmarks and careful differential analysis of up to a week. We generally release a patch roll-up version every month or two.


      2. Ah, we have been considering trying out gfortran using the Simply Fortran IDE. We have a lot of non-standard code such as carriage control, unions, structures, and records. Gfortran does support all of these.


      3. Actually, that cycle time doesn’t sound too bad. You probably aren’t in need of drastic changes at this point. I’d say just start budgeting in some time to clean up/modernize the code you change when a change is required, and slowly the code will get better, especially in areas you touch more often.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s