Skip to main content
Log in

Detection of Redundant Code Using R 2 D 2

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

We present the R 2 D 2 redundancy detector. R 2 D 2 identifies redundant code fragments in large software systems written in Lisp. For each pair of code fragments, R 2 D 2 uses a combination of techniques ranging from syntax-based analysis to semantics-based analysis, that detects positive and negative evidences regarding the redundancy of the analyzed code fragments. These evidences are combined according to a well-defined model and sufficiently redundant fragments are reported to the user. R 2 D 2 explores several techniques and heuristics to operate within reasonable time and space bounds and is designed to be extensible.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  • Abelson, H., Sussman, G.J., and Sussman, J. 1985. Structure and Interpretation of Computer Programs, 6 ed. Cambridge, MA, MIT Press.

    Google Scholar 

  • Baker, B.S. 1995. On finding duplication and near-duplication in large software systems, Proceedings of Second Working Conference on Reverse Engineering, eds. L.M. Wills, P. Newcomb, and E.J. Chikofsky, pp. 86–95. IEEE Computer Society Press.

  • Baker, H.G. 1992. Metacircular semantics for common lisp special forms, ACM LISP Pointers 5(4): 11–20.

    Google Scholar 

  • Baumgartner, G., Läufer, K., and Russo, V.F. 1998. On the interaction of object-oriented design patterns and programming languages, Technical Report CSD-TR-96-020, Department of Computer Science, Purdue University, February.

  • Baxter, I.D., Yahin, A., Moura, L., Sant’Anna, M., and Bier, L. 1998. Clone detection using abstract syntax trees, Proceedings of International Conference on Software Maintenance, eds. T.M. Koshgoftaar and K. Bennett, pp. 368–378. IEEE Computer Society Press.

  • Bowdidge, R.W. and Griswold, W.G. 1998. Supporting the restructuring of data abstractions through manipulation of a program visualization, ACM Transactions on Software Engineering and Methodology 7(2): 109–157.

    Google Scholar 

  • Bracha, G. and Cook, W. 1990. Mixin-based inheritance, OOPSLA/ECOOP’ 90 Proceedings, ed. N. Meyrowitz, ACM SIGPLAN, pp. 303–311.

  • Charniak, E. and McDermott, D. 1985. Introduction to Artificial Intelligence. Addison-Wesley.

  • Conte, S.D., Dunsmore, H.E., and Shen, V.Y. 1986. Software Engineering Metrics and Models. Menlo Park, CA, Benjamin/Cummings Publishing Company.

    Google Scholar 

  • Ducasse, S., Rieger, M., and Demeyer, S. 1999. A language independent approach for detecting duplicated code, Proceedings of ICSM’99 (International Conference on Software Maintenance), eds. H. Yang and L. White, pp. 109–118. IEEE, September.

  • Faidhi, J.A.W. and Robinson, S.K. 1987. An empirical approach for detecting program similarity within a university programming environment, Computers and Education 11(1): 11–19.

    Google Scholar 

  • Gabriel, R.P., White, J.L., and Bobrow, D.G. 1991. CLOS: Integrating object-oriented and functional programming, Communications of the ACM 34(9): 29–38.

    Google Scholar 

  • Gamma, E., Helm, R., Johnson, R., and Vlissides, J. 1996. Design Patterns: Elements of Reusable Object-Oriented Software. Reading, MA, Addison-Wesley.

    Google Scholar 

  • Griswold, W.G. 1991. Program Restructuring as an Aid to Software Maintenance, Ph.D. Thesis, University of Washington.

  • Hennessey, W.L. 1989. COMMON LISP. New York, McGraw-Hill.

    Google Scholar 

  • Johnson, J.H. 1992. Identifying redundancy in source code using fingerprints, Proceedings of GASCON’ 92, Toronto, Ontario, November 9-11, pp. 171–183.

  • Johnson, J.H. 1994. Substring matching for clone detection and change tracking, Proceedings of International Conference on Software Maintenance, Victoria, Canada, September 19-23, eds. H.A. Muller and M. Georges, pp. 120–126. IEEE Computer Society Press.

  • Kamiya, T., Ohata, F., Kondou, K., Kusumoto, S., and Inoue, K. 2001. Maintenance support tools for Java programs: CCFinder and JAAT, Proceedings of the 23rd International Conference on Software Engeneering (ICSE-01), Los Alamitos, CA, May 12-19, pp. 837–838. IEEE Computer Society. Press.

  • Keene, S.E. 1989. Object-Oriented Programming in Common Lisp: A Programmer’s Guide to CLOS. Cambridge, MA, Addison-Wesley.

    Google Scholar 

  • Komondoor, R. and Horwitz, S. 2001. Tool demonstration: Finding duplicated code using program dependences, Lecture Notes in Computer Science, Vol. 2028, pp. 383–386.

  • Krinke, J. 2001. Identifying similar code with program dependence graphs, Proceedings of Eight Working Conference on Reverse Engineering (WCRE 2001), Stuttgart, Germany, October, pp. 301–309.

  • Laguë, B., Proulx, D., Merlo, E.M., Mayrand, J., and Hudepohl, J. 1997. Assessing the benefits of incorporating function clone detection in a development process, Proceedings of 1997 International Conference on Software Maintenance, pp. 314–321. IEEE Computer Society Press.

  • Laubsch, J. 1992. Zebu: A tool for specifying reversible LALR(1) parsers, Technical Report HPL-92-147, Hewlett Packard Laboratories, December 01.

  • Leitão, A.M. 2001. Reengenharia de programas, Ph.D. Thesis, Dep. de Eng. Informática, Instituto Superior Técnico, Universidade Técnica de Lisboa, October.

  • Maizel, J. and Lenk, R. 1981. Enhanced graphic matrix analysis of nucleic acid and protein sequences, Proceedings of the National Academy of Sciences, Genetics 78: 7665–7669.

    Google Scholar 

  • Mayrand, J., Leblanc, C., and Merlo, E. 1996. Experiment on the automatic detection of function clones in a software system using metrics, Proceedings of the International Conference on Software Maintenance, Washington November 4-8, pp. 244–254. IEEE Computer Society Press.

  • Moon, D.A. 1986. Object-oriented programming with Flavors, ACM SIGPLAN Notices 21(11): 1–8, OOPSLA’ 86 Conference Proceedings, ed. N. Meyrowitz, Portland, OR, September 1986.

  • Norvig, P. 1991. Correcting a widespread error in unification algorithms, Software Practice and Experience 21(2): 231–233.

    Google Scholar 

  • Ottenstein, K. 1976. An algorithmic approach to the detection and prevention of plagiarism, ACM SIGSCE Bulletin 8(4): 30–41.

    Google Scholar 

  • Pettorossi, A. and Proietti, M. 1996. Rules and strategies for transforming functional and logic programs, ACM Computing Surveys 28(2): 360–414.

    Google Scholar 

  • Shapiro, S.C. and The SNePS Implementation Group. 1995. SNePS 2.3 User’s Manual, Department of Computer Science, SUNY at Buffalo, Buffalo, NY.

    Google Scholar 

  • Shortliffe, E.H. 1974. MYCIN: A Rule-Based Computer Program for Advising Physicians Regarding Antimicrobial Therapy Selection, Ph.D. Thesis, Stanford Artificial Intelligence Laboratory, Stanford, CA, October 1974.

    Google Scholar 

  • van Deursen, A. 1998. The leap year problem, 33, Centrum voor Wiskunde en Informatica (CWI), ISSN 1386-369X, December 31, SEN-R9807, p. 7.

    Google Scholar 

  • Verco, K.L. and Wise, M.J. 1996. Plagiarism à la mode: a comparison of automated systems for detecting suspected plagiarism, The Computer Journal 39(9): 741–750.

    Google Scholar 

  • Waters, R.C. 1994. Cliche-based program editors, ACM Transactions on Programming Languages and Systems 16(1): 102–150.

    Google Scholar 

  • Whitney, M., Kontogiannis, K., Johnson, J.H., Bernstein, M., Corrie, B., Merlo, E., McDaniel, J.G., De Mori, R., Müller, H.A., Mylopoulos, J., Stanley, M., Tilley, S.R., and Wong, K. 1995. Using an integrated toolset for program understanding, Proceedings of the GASCON’ 95, November 1995, pp. 262–274.

  • Wilensky, R. 1986. Common LISPcraft. New York, W. W. Norton & Co.

    Google Scholar 

  • Wilson, P.R. 1995. Garbage collection, Computing Surveys.

  • Winston, P.H. and Horn, B.K.P. 1988. Lisp, 3rd ed. Reading, MA, Addison-Wesley.

    Google Scholar 

  • Wise. 1992. Detection of similarities in student programs: YAP’ing may be preferable to plague’ing, SIGCSEB: SIGCSE Bulletin (ACM Special Interest Group on Computer Science Education) 24.

  • Wise. 1996. YAP3: Improved detection of similarities in computer program and other texts, SIGCSEB: SIGCSE Bulletin (ACM Special Interest Group on Computer Science Education) 28.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Leitão, A.M. Detection of Redundant Code Using R 2 D 2 . Software Quality Journal 12, 361–382 (2004). https://doi.org/10.1023/B:SQJO.0000039793.31052.72

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1023/B:SQJO.0000039793.31052.72

Keywords

Navigation