Goto Elimination Strategies in the Migration of Legacy Code to Java

Legacy systems are often large and difficult to maintain, but rewriting them from scratch is usually not a viable option. Reenginering remains the only way to modernize them. We have been recently involved in a migration project aiming at porting an old, large (8 MLOC) legacy banking system to a modern architecture. The goal of the project is: (I) moving from an old, proprietary language to Java; (2) replacing ISAM indexed files with a relational database; (3) upgrading the character oriented interface to a modern GUI. One of the steps in the migration process deals with the elimination of unstructured code (unconditional jumps such as GOTO statements). In this paper we present four alternative strategies for GOTO elimination that we evaluated in the project. Each has pros and cons, but when used in a real case, it turned out that one produced completely unreadable code, hence it was discarded. The final choice was a combination of the three remaining strategies.

[1]  Corrado Böhm,et al.  Flow diagrams, turing machines and languages with only two formation rules , 1966, CACM.

[2]  Brenda S. Baker,et al.  An Algorithm for Structuring Flowgraphs , 1977, J. ACM.

[3]  M. Howard Williams Generating Structured Flow Diagrams: The Nature of Unstructuredness , 1977, Comput. J..

[4]  David B. Whalley,et al.  Avoiding unconditional jumps by code replication , 1992, PLDI '92.

[5]  Laurie J. Hendren,et al.  Taming control flow: a structured approach to eliminating goto statements , 1994, Proceedings of 1994 IEEE International Conference on Computer Languages (ICCL'94).

[6]  Zohar Manna,et al.  Translating Program Schemas to While-Schemas , 1975, SIAM J. Comput..

[7]  Kevin A. Schneider,et al.  Source transformation in software engineering using the TXL transformation system , 2002, Inf. Softw. Technol..

[8]  Tadao Kasami,et al.  On the capabilities of while, repeat, and exit statements , 1973, Commun. ACM.

[9]  Niels P. Veerman Revitalizing modifiability of legacy assets , 2004, J. Softw. Maintenance Res. Pract..

[10]  Lyle Ramshaw,et al.  Eliminating go to's while preserving program structure , 1988, JACM.

[11]  Edsger W. Dijkstra,et al.  Go To Statement Considered Harmful , 2022, Software Pioneers.

[12]  Ana Maria Erosa,et al.  A Goto-Elimination Method And Its Implementation For The McCat C Compiler , 1995 .

[13]  Erik H. D'Hollander,et al.  Using hammock graphs to structure programs , 2004, IEEE Transactions on Software Engineering.

[14]  M. Howard Williams,et al.  Conversion of Unstructured Flow Diagrams to Structured Form , 1978, Comput. J..

[15]  Harry M. Sneed,et al.  Restructuring of COBOL/CICS legacy systems , 2002, Sci. Comput. Program..

[16]  Cristina Cifuentes A Structuring Algorithm for Decompilation , 1993 .