This Article 
 Bibliographic References 
 Add to: 
Extracting Reusable Functions by Flow Graph-Based Program Slicing
April 1997 (vol. 23 no. 4)
pp. 246-259

Abstract—An alternative approach to developing reusable components from scratch is to recover them from existing systems. In this paper, we apply program slicing, a program decomposition method, to the problem of extracting reusable functions from ill-structured programs. As with conventional slicing first described by Weiser, a slice is obtained by iteratively solving data flow equations based on a program flow graph. We extend the definition of program slice to a transform slice, one that includes statements which contribute directly or indirectly to transform a set of input variables into a set of output variables. Unlike conventional program slicing, these statements do not include either the statements necessary to get input data or the statements which test the binding conditions of the function. Transform slicing presupposes the knowledge that a function is performed in the code and its partial specification, only in terms of input and output data. Using domain knowledge we discuss how to formulate expectations of the functions implemented in the code. In addition to the input/output parameters of the function, the slicing criterion depends on an initial statement, which is difficult to obtain for large programs. Using the notions of decomposition slice and concept validation we show how to produce a set of candidate functions, which are independent of line numbers but must be evaluated with respect to the expected behavior. Although human interaction is required, the limited size of candidate functions makes this task easier than looking for the last function instruction in the original source code.

[1] F. Abbattista, G.M.G. Fatone, F. Lanubile, and G. Visaggio, "Analyzing the Application of a Reverse Engineering Process to a Real Situation," Proc. Third Workshop Program Comprehension,Washington D.C., pp. 62-71, Nov. 1994.
[2] F. Abbattista, F. Lanubile, and G. Visaggio, "Recovering Conceptual Data Models is Human-Intensive," Proc. Fifth Int'l Conf. Software Eng. and Knowledge Eng.,San Francisco, Calif., pp. 534-543, 1993.
[3] H. Agrawal and J.R. Horgan, "Dynamic Program Slicing," Proc. ACM SIGPLAN '90 Conf. Programming Language Design and Implementation, pp. 246-256, June 1990.
[4] H. Agrawal, J. Horgan, E. Krauser, and S. London, “Incremental Regression Testing,” Proc. Conf. Software Maintenance—1993, pp. 348-357, Sept. 1993.
[5] V.R. Basili, G. Caldiera, F. McGarry, R. Pajerski, G. Page, and S. Waligora, "The Software Engineering Laboratory: An Operational Software Experience Factory," Proc. 14th Int'l Conf. Software Eng.,Australia, pp. 370-381, 1992.
[6] J. Beck and D. Eichmann, "Program and Interface Slicing for Reverse Engineering," Proc. 15th Int'l Conf. Software Eng.,Baltimore, Md., pp. 54-63, 1993.
[7] K. Bennett, "Legacy Systems: Coping with Success," IEEE Software, vol. 12, no. 1, pp. 19-23, Jan. 1995.
[8] T.J. Biggerstaff, B.G. Mitbander, and D.E. Webster, "Program Understanding and the Concept Assignment Problem," Comm. ACM, May 1994, pp. 72-82.
[9] E.J. Byrne, "A Conceptual Foundation for Software Re-engineering," Proc. Conf. Software Maintenance,Orlando, Fla., pp. 226-235, 1992.
[10] G. Caldiera and V.R. Basili, "Identifying and Qualifying Reusable Software Components," Computer, pp .61-70, Feb. 1991.
[11] G. Canfora and A. Cimitile, "Reverse Engineering and Intermodular Data Flow: A Theoretical Approach," Software Maintenance: Research and Practice, vol. 4, pp. 37-59, 1992.
[12] G. Canfora, A. Cimitile, A. De Lucia, and G.A. Di Lucca, "Software Salvaging Based on Conditions," Proc. Int'l Conf. Software Maintenance,Victoria, Canada, pp. 424-433, Sept. 1994.
[13] G. Canfora, A. Cimitile, and M. Munro, "A Reverse Engineering method for Identifying Reusable Abstract Data Types," Proc. Working Conf. Reverse Engineering,Baltimore, Md., pp. 73-82, 1993.
[14] G. Canfora, A. Cimitile, M. Tortorella, and M. Munro, "A Precise Method for Identifying Reusable Abstract Data Type in Code," Proc. Int'l Conf. Software Maintenance,Victoria, Canada, pp. 404-413, 1994.
[15] S.C. Choi and W. Scacchi, "Extracting and Restructuring the Design of Large Systems," IEEE Software, pp. 66-71, Jan. 1990.
[16] A. Cimitile and G. Visaggio, "Software Salvaging and Call Dominance Tree," The J. of Systems and Software, vol. 28, no. 2, pp. 117-127, Feb. 1995.
[17] F. Cutillo, F. Lanubile, and G. Visaggio, "Extracting Application Domain Functions from Old Code: A Real Experience," Proc. Second Workshop on Program Comprehension,Capri, Italy, pp. 186-191, July 1993.
[18] J.M. DeBaud, B. Moopen, and S. Rugaber, "Domain Analysis and Reverse Engineering," Proc. Int'l Conf. Software Maintenance,Victoria, Canada, pp. 326-335, 1994.
[19] M.F. Dunn and J.C. Knight, "Automating the Detection of Reusable Parts in Existing Software," Proc. 15th Int'l Conf. Software Eng.,Baltimore, Md., pp. 381-390, 1993.
[20] J. Ferrante,K.J. Ottenstein,, and J.D. Warren,“The program dependence graph and its use in optimization,” ACM Trans. Programming Languages and Systems, vol. 9, no. 3, pp. 319-349, June 1987.
[21] P. Fiore, F. Lanubile, and G. Visaggio, "Analyzing Empirical Data from a Reverse Engineering Project," Proc. Second Working Conf. Reverse Eng.,Toronto, Ontario, July 1995.
[22] K. Gallagher and J. Lyle, “Using Program Slicing in Software Maintenance,” IEEE Trans. Software Eng., Aug. 1991, pp. 751-761.
[23] S. Horwitz, T. Reps, and D. Binkley, “Interprocedural Slicing Using Dependence Graphs,” ACM Trans. Programming Languages and Systems. vol. 12, no. 1, pp. 26-60, Jan. 1990.
[24] J. Jiang, X. Zhou, and D.J. Robson, "Program Slicing for C—the Problems in Implementation," Proc. Conf. Software Maintenance,Sorrento, Italy, pp. 182-190, 1991.
[25] J.K. Joiner, W.T. Tsai, and X. P. Chen, "Data-Centered Program Understanding," Proc. Int'l Conf. Software Maintenance,Victoria, Canada, pp. 272-281, 1994.
[26] H.S. Kim, Y.R. Kwon, and I.S. Chung, "Restructuring Programs Through Program Slicing," Int'l J. Software Eng. and Knowledge Eng., vol. 4, no. 3, pp. 349-368, 1994.
[27] B. Korel and J. Laski, "Dynamic Program Slicing," Information Processing Letters, vol. 29, no. 3, Oct. pp. 155-163, 1988.
[28] W. Kozaczynski, J. Ning, and A. Engberts, "Program Concept Recognition and Transformation," IEEE Trans. Software Eng., vol. 18, no. 12, pp. 1,065-1,075, Dec. 1992.
[29] C. Krueger, “Software Reuse,” ACM Computing Surveys, June 1992, pp. 131‐183.
[30] F. Lanubile and G. Visaggio, "Function Recovery Based on Program Slicing," Proc. Conf. Software Maintenance,Montreal, Quebec, pp. 396-404, 1993.
[31] S. Letovski and E. Soloway, "Delocalized Plans and Program Comprehension," IEEE Software, pp. 198-204, May 1986.
[32] S. Liu and N. Wilde, "Identifying Objects in a Conventional Procedural Language: An Example of Data Design Recovery," Proc. Conf. Software Maintenance,San Diego, Calif., pp. 266-271, 1990.
[33] P.E. Livadas and S.D. Alden, "A Toolset for Program Understanding," Proc. Second Workshop Program Comprehension,Capri, Italy, pp. 110-118, 1993.
[34] P.E. Livadas and P.K. Roy, "Program Dependency Analysis," Proc. Conf. Software Maintenance,Orlando, Fla., pp. 356-365, 1992.
[35] J.P. Loyall and S.A. Mathisen, “Using Dependence Analysis to Support the Software Maintenance Process,” Proc. Conf. Software Maintenance, pp. 282–291, Sept. 1993.
[36] J.R. Lyle and M.D. Weiser, "Automatic Program Bug Location by Program Slicing," Proc. Second Int'l Conf. Computers and Applications,Peking, China, pp. 877-882, June 1987.
[37] H.D. Pande, W.A. Landi, and B.G. Ryder, "Interprocedural Def-use Associations for C Systems with Single Level Pointers," IEEE Trans. Software Eng., vol. 20, no. 5, pp. 385-403, May 1994.
[38] A. Podgurski and L.A. Clarke, "A Formal Model of Program Dependences and Its Implications for Software Testing, Debugging, and Maintenance," IEEE Trans. Software Eng., vol. 16, no. 9, pp. 965-979, Sept. 1990.
[39] C. Rich and L. Wills, "Recognizing a Program's Design: A Graph Parsing Approach," IEEE Software, vol. 7, no. 1, 1990.
[40] H. Ritsch and H.M. Sneed, "Reverse Engineering Program via Dynamic Analysis," Proc. Working Conf. Reverse Eng.,Baltimore, Md., pp. 192-201, 1993.
[41] S. Rugaber, K. Stirewalt, and L.M. Wills, "The Interleaving Problem in Program Understanding," Proc. Second Working Conf. Reverse Eng.,Toronto, Canada, pp. 166-175, 1995.
[42] E. Soloway and K. Ehrlich, "Empirical Studies of Programming Knowledge," IEEE Trans. Software Eng., vol. 10, no. 5, pp. 595-609, 1984.
[43] M. Weiser, "Program Slicing," IEEE Trans. Software Eng., vol. 10, no. 4, pp. 352-357, July 1984.
[44] N. Wilde, J.A. Gomez, T. Gust, and D. Strasburg, “Locating User Functionality in Old Code,” Proc. Int'l Conf. Software Maintenance, pp. 200-205, Nov. 1992.

Index Terms:
Software reuse, reusable functions, reverse engineering, code scavenging, modularization, software comprehension, program slicing, data flow analysis.
Filippo Lanubile, Giuseppe Visaggio, "Extracting Reusable Functions by Flow Graph-Based Program Slicing," IEEE Transactions on Software Engineering, vol. 23, no. 4, pp. 246-259, April 1997, doi:10.1109/32.588543
Usage of this product signifies your acceptance of the Terms of Use.