Class and object extraction from imperative code

Chap-Liong Ong · 1994

There is considerable interest in reengineering existing software into object-oriented systems. One of the tasks in such reengineering efforts is to extract the embedded classes and objects. This thesis proposes an approach to extract implementations of abstractions in code maintenance, and applies the approach to develop an object extraction tool for use with FORTRAN code. Reported proposals and implementations for object extraction are summarized. A scheme for automatic class and object extraction is presented. This approach identifies instance variables and methods of classes from a system coded in an imperative language, such as FORTRAN, and reproduces them in a class-based or object-oriented language, such as C++. Prospective instance variables and objects are identified from constructs such as labeled common blocks or formal parameters. Methods are extracted by analyzing how the instance variables were used in the program. Classes are formed by combining the instance variables and the methods. A prototype extractor was implemented. Given a FORTRAN program, the prototype automatically produces a list of potentially useful classes and objects in C++. Experiments were performed to validate the object extractor. From 948 lines of FORTRAN code using some textbook data structures, the program extracted 623 lines of code. Close to half of the lines extracted corresponded to text book methods. The other half were extraneous methods. Of the correct methods produced, only 5 lines of code were missing. A closely related problem to object extraction is assembling the extracted code to form the original application. A study with the reengineering process at the National Micropopulation Simulation Resource indicated that when a new paradigm is adopted, the code may be substantially changed. These changes make the object extractor useful only in the early stages of a reengineering task. Nevertheless, an object extractor is still a useful tool for reengineering applications, since it extracts objects without much human effort, and it helps in program understanding and code analysis.

Read the paper · More papers on PaperTik