Fortran re-engineering example (1)

To illustrate the craft of re-engineering an older Fortran program. Imagine 1000-ft cable stretched between two towers, with a supporting tower midway. A cable car moving along this cable has a velocity that is dependent on its position along the cable. The program prints a table of values starting with the cable car at the first tower, and moving to the last tower at increments of 10 feet.  At each increment it prints, the number of the nearest tower, the distance from the first tower and the velocity of the cable car.

Here is the original Fortran program:


Re-engineering this program will involve migrating the code to a modern version of Fortran. This includes removing legacy structures such as goto statements, de-capitalizing the code, and modernizing control structures. The first step is to convert the program to lowercase and remove the spurious comment delimiters, C (which really only delimit empty lines). The variables in this code actually have quit good identifiers, so they do not need to be changed.


The next step involves investigating the structural logic of the code – and the best way of doing this is making a print copy and marking it up. The biggest problem with many of these programs is the unstructured logic they contain.



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

This site uses Akismet to reduce spam. Learn how your comment data is processed.