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.