The investment in established codes is preserved as modern capabilities are added.

An incremental approach to modernization of scientific software written in the Fortran 77 computing language has been developed. This approach makes it possible to preserve the investment in legacy Fortran software while augmenting the software with modern capabilities to satisfy expanded requirements. This approach could be advantageous (1) in situations in which major rewriting of application programs is undesirable or impossible, or (2) as a means of transition to major rewriting.

Programs written in Fortran 77 and other early versions of Fortran retain much intellectual and commercial value. These codes have been carefully validated and often perform excellently, even on modern computers. However, the early versions of Fortran are often not adequate for the computations needed for the increasingly complex systems typically encountered in current practice. For example, early Fortran programs may not utilize dynamic memory or their data structures may not reflect problem domains well. Often, user interfaces are poor or nonexistent. On the other hand, modern programming languages (most notably, object-oriented languages) offer much better support for complex programming projects.

The developers of the present incremental approach have found that contrary to the conventional wisdom among object-oriented programmers, it is not necessary to redesign codes from the bottom up to make them object-oriented. Many object-oriented programs make use of non-object- oriented libraries for basic functions — for example, calling operating systems. The important question in modernization of a legacy code is whether the subroutines in the code have sufficient basic functionality. For most legacy codes that have been in use for a decade or more, this is the case. The weaknesses of legacy codes arise with respect to flexibility, extensibility, and related issues.

The present incremental approach is based partly on the assumption that such weaknesses can be addressed at a higher level, by building interface software libraries that mediate between main programs and underlying legacy codes. Major goals in this approach are to increase program safety, simplify interfaces to subroutines, add dynamic memory management, encapsulate different parts of programs, add abstract data types that reflect the problem domains, and add or improve user interfaces.

The present incremental approach can be characterized as one of building modern superstructures around legacy codes rather than completely rewriting those codes. Building such a superstructure increases the opportunity to reuse the intellectual capital already invested in the legacy code and entails less risk that the rewrite might not work properly. As much as possible, one avoids modification of original subroutines; instead, one strives to embed the modern features in an interface library.

This approach admits of several methodologies. One such methodology is based on Fortran 90, because this language has modern features yet maintains compatibility with older Fortran software. Other methodologies could be based on other modern computing languages (for example, C++) in which one can write programs capable of calling the original Fortran subroutines. Once software constructed following this approach works correctly, there is always the option of replacing individual pieces of the legacy code, and eventually even the entire code. One important advantage of the use of a software superstructure is that the legacy code can still be used during a modernization effort.

This work was done by Viktor Decyk and Charles Norton of Caltech for NASA's Jet Propulsion Laboratory. For further information, access the Technical Support Package (TSP) free on-line at www.techbriefs.com/tsp under the Information Sciences category.

This software is available for commercial licensing. Please contact Don Hart of the California Institute of Technology at (818) 393-3425. Refer to NPO-21166.



This Brief includes a Technical Support Package (TSP).
Document cover
Modernizing Fortran 77 Legacy Codes

(reference NPO-21166) is currently available for download from the TSP library.

Don't have an account?



Magazine cover
NASA Tech Briefs Magazine

This article first appeared in the September, 2003 issue of NASA Tech Briefs Magazine (Vol. 27 No. 9).

Read more articles from the archives here.


Overview

The document discusses an innovative approach to modernizing legacy Fortran software, particularly those written in early versions like Fortran 77. As computational power has increased, the complexity of scientific projects has also grown, necessitating more advanced programming capabilities. Traditional Fortran versions are often inadequate for modern needs, leading to the challenge of whether to abandon legacy codes or find ways to integrate them into contemporary programming frameworks.

The authors, Viktor Decyk and Charles Norton from Caltech, propose a methodology that focuses on building a modern "superstructure" around existing legacy codes rather than completely rewriting them. This approach allows for the preservation of valuable intellectual capital while minimizing the risks associated with extensive rewrites. The modernization effort is likened to renovating a building, where scaffolding (interface functions) is constructed around the original structure (legacy code), enabling ongoing use during the transition.

Key goals of this modernization strategy include improving program safety, simplifying interfaces to subroutines, adding dynamic memory management, encapsulating different parts of the program, and enhancing user interfaces. The methodology emphasizes the importance of maintaining backward compatibility, particularly through the use of Fortran 90, which incorporates modern features while still being able to call older Fortran subroutines. Other modern programming languages, such as C++, could also be utilized in this context.

The document highlights that many legacy codes, despite their age, have been well-designed in terms of functionality but may lack flexibility and extensibility. By creating an interface library that mediates between the main program and the legacy code, the authors argue that many of these issues can be addressed without modifying the original subroutines.

Ultimately, the proposed incremental approach allows for gradual evolution towards a more modern object-oriented structure while keeping the legacy code operational throughout the process. This strategy not only facilitates the integration of new features but also ensures that the existing software continues to deliver value during the modernization effort. The work is positioned as a significant advancement in the field of computational science, particularly for organizations like NASA that rely on robust and validated software for complex scientific computations.