[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/1480945.1480971acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article

Clone detection and removal for Erlang/OTP within a refactoring environment

Published: 19 January 2009 Publication History

Abstract

A well-known bad code smell in refactoring and software maintenance is duplicated code, or code clones. A code clone is a code fragment that is identical or similar to another. Unjustified code clones increase code size, make maintenance and comprehension more difficult, and also indicate design problems such as lack of encapsulation or abstraction.
This paper proposes a token and AST based hybrid approach to automatically detecting code clones in Erlang/OTP programs, underlying a collection of refactorings to support user-controlled automatic clone removal, and examines their application in substantial case studies. Both the clone detector and the refactorings are integrated within Wrangler, the refactoring tool developed at Kent for Erlang/OTP.

References

[1]
J. Armstrong. Programming Erlang. Pragmatic Bookshelf, 2007.
[2]
B. S. Baker. A Program for Identifying Duplicated Code. Computing Science and Statistics, 24:49--57, 1992.
[3]
B. S. Baker. On Finding Duplication and Near-Duplication in Large Software Systems. In L. Wills, P. Newcomb, and E. Chikofsky, editors, Second Working Conference on Reverse Engineering, Los Alamitos, California, 1995.
[4]
M. Balazinska, E. Merlo, M. Dagenais, B. Lague, and K. Kontogiannis. Partial Redesign of Java Software Systems Based on Clone Analysis. In Working Conference on Reverse Engineering, pages 326--336, 1999.
[5]
H. A. Basit and S. Jarzabek. Detecting higher-level imilarity patterns in programs. SIGSOFT Softw. Eng. Notes,30(5):156--165, 2005. ISSN 0163-5948.
[6]
I. D. Baxter, A. Yahin, L. Moura, M. Sant'Anna, and L. Bier. Clone Detection Using Abstract Syntax Trees. In ICSM '98, Washington, DC, USA, 1998.
[7]
S. Ducasse, M. Rieger, and S. Demeyer. A language independent approach for detecting duplicated code. In Proceedings ICSM99 (International Conference on Software Maintenance, pages 109--118. IEEE, 1999.
[8]
M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1999. ISBN 0-201-48567-2.
[9]
Y. Higo, T. Kamiya, S. Kusumoto, and K. Inoue. ARIES: Refactoring Support Environment Based on Code Clone Analysis. In IASTED Conf. on Software Engineering and Applications, pages 222--229, 2004.
[10]
L. Jiang, G. Misherghi, Z. Su, and S. Glondu. Deckard: Scalable and accurate tree-based detection of code clones. In ICSE '07: Proceedings of the 29th international conference on Software Engineering, pages 96-- 105, Washington, DC, USA, 2007. IEEE Computer Society.
[11]
T. Kamiya, S. Kusumoto, and K. Inoue. CCFinder: A Multi-Linguistic Token-based Code Clone Detection System for Large Scale Source Code. IEEE Computer Society Trans. Software Engineering, 28(7):654--670, 2002.
[12]
C. Kapser and M. W. Godfrey. "Clones Considered Harmful" Considered Harmful. In Proc. Working Conf. Reverse Engineering (WCRE), 2006.
[13]
R. Komondoor and S. Horwitz. Tool Demonstration: Finding Duplicated Code Using Program Dependences. Lecture Notes in Computer Science, 2028:383--386, 2001.
[14]
R. Koschke and R. Falke and P. Frenzel. Clone Detection Using Abstract Syntax Suffix Trees. In WCRE '06, pages 253--262, Washington, DC, USA, 2006.
[15]
H. Li and S. Thompson. Tool Support for Refactoring Functional Programs. In Partial Evaluation and Program Manipulation, San Francisco, California, USA, January 2008.
[16]
H. Li, S. Thompson, and C. Reinke. The Haskell Refactorer, HaRe, and its API. Electr. Notes Theor. Comput. Sci., 141(4):29--34, 2005.
[17]
H. Li, S. Thompson, L. LÜovei, Z. Horváth, T. Kozsik, A. Víg, and T. Nagy. Refactoring Erlang Programs. In EUC'06, Stockholm, Sweden, November 2006a.
[18]
H. Li, S. Thompson, G. Orosz, and M. Töth. Refactoring with Wrangler, updated. In ACM SIGPLAN Erlang Workshop 2008, Victoria, British Columbia, Canada, September 2008.
[19]
Z. Li, S. Lu, and S. Myagmar. Cp-miner: Finding copy-paste and related bugs in large-scale software code. IEEE Trans. Softw. Eng., 32(3):176-- 192, 2006b. ISSN 0098-5589. Member-Yuanyuan Zhou.
[20]
H. Mattsson, H. Nilsson, and C. Wikstrom. Mnesia -- a distributed robust dbms for telecommunications applications. In PADL '99: Proceedings of the First International Workshop on Practical Aspects of Declarative Languages, pages 152--163, London, UK, 1998. Springer-Verlag.
[21]
A. Monden, D. Nakae, T. Kamiya, S. Sato, and K. Matsumoto. Software Quality Analysis by Code Clones in Industrial Legacy Software. In METRICS '02, Washington, DC, USA, 2002.
[22]
S. Peyton Jones, editor. Haskell 98 Language and Libraries: the Revised Report. Cambridge University Press, 2003. ISBN 0-521-82614-4.
[23]
ProTest: property-based testing. http://www.protest-project.eu.
[24]
C. H. Roy and R. Cordy. A Survey of Software Clone Detection Research. Technical report, School of Computing, Queen's University at Kingston, Ontario, Candada, 2007.
[25]
K. Sagonas. Experience from Developing the Dialyzer: A Static Analysis Tool Detecting Defects In Erlang Applications. Presented at the ACM SIGPLAN Workshop on the Evaluation of Software Defect Detection Tools, 2005.
[26]
D. Tsadok. ANSI C implementation of a Suffix Tree. Technical report, Computer-Science Department, Haifa University, Israel, August 2002.
[27]
E. Ukkonen. On-Line Construction of Suffix Trees. Algorithmica, 14(3): 249--260, 1995.
[28]
Yaws -- An Open Source Web Server Written in Erlang. http://yaws. hyber.org/.

Cited By

View all
  • (2024)Behind the Intent of Extract Method Refactoring: A Systematic Literature ReviewIEEE Transactions on Software Engineering10.1109/TSE.2023.334580050:4(668-694)Online publication date: Apr-2024
  • (2022)A Feasibility Study of Using Code Clone Detection for Secure Programming Education2022 IEEE 46th Annual Computers, Software, and Applications Conference (COMPSAC)10.1109/COMPSAC54236.2022.00238(1502-1507)Online publication date: Jun-2022
  • (2021)A Summary on the Stability of Code Clones and Current Research TrendsCode Clone Analysis10.1007/978-981-16-1927-4_12(169-180)Online publication date: 4-Aug-2021
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
PEPM '09: Proceedings of the 2009 ACM SIGPLAN workshop on Partial evaluation and program manipulation
January 2009
208 pages
ISBN:9781605583273
DOI:10.1145/1480945
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 January 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. duplicated code
  2. erlang
  3. program analysis
  4. program transformation
  5. refactoring
  6. wrangler

Qualifiers

  • Research-article

Conference

PEPM '09
Sponsor:
PEPM '09: Partial Evaluation and Program Manipulation
January 19 - 20, 2009
GA, Savannah, USA

Acceptance Rates

Overall Acceptance Rate 66 of 120 submissions, 55%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Behind the Intent of Extract Method Refactoring: A Systematic Literature ReviewIEEE Transactions on Software Engineering10.1109/TSE.2023.334580050:4(668-694)Online publication date: Apr-2024
  • (2022)A Feasibility Study of Using Code Clone Detection for Secure Programming Education2022 IEEE 46th Annual Computers, Software, and Applications Conference (COMPSAC)10.1109/COMPSAC54236.2022.00238(1502-1507)Online publication date: Jun-2022
  • (2021)A Summary on the Stability of Code Clones and Current Research TrendsCode Clone Analysis10.1007/978-981-16-1927-4_12(169-180)Online publication date: 4-Aug-2021
  • (2020)A Fine-Grained Analysis on the Inconsistent Changes in Code Clones2020 IEEE International Conference on Software Maintenance and Evolution (ICSME)10.1109/ICSME46990.2020.00030(220-231)Online publication date: Sep-2020
  • (2020)Generalization-Driven Semantic Clone Detection in CLPLogic-Based Program Synthesis and Transformation10.1007/978-3-030-45260-5_14(228-242)Online publication date: 22-Apr-2020
  • (2017)Detecting code clones with gaps by function applicationsProceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3018882.3018892(12-22)Online publication date: 2-Jan-2017
  • (2016)MacroficationProceedings of the 25th European Symposium on Programming Languages and Systems - Volume 963210.5555/3089528.3089553(644-671)Online publication date: 2-Apr-2016
  • (2016)ValiErlangProceedings of the 1st Brazilian Symposium on Systematic and Automated Software Testing10.1145/2993288.2993300(1-10)Online publication date: 19-Sep-2016
  • (2016)Macrofication: Refactoring by Reverse Macro ExpansionProgramming Languages and Systems10.1007/978-3-662-49498-1_25(644-671)Online publication date: 2016
  • (2015)Classifying obstructive and nonobstructive code clones of Type I using simplified classification schemeAdvances in Software Engineering10.1155/2015/8293892015(5-5)Online publication date: 1-Jan-2015
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media