Open Access Open Access  Restricted Access Subscription or Fee Access

Omitting Code Clones Based on Ranking the Called Clones


(*) Corresponding author


Authors' affiliations


DOI: https://doi.org/10.15866/irecos.v11i9.10312

Abstract


Code clones represent a stumbling blocking the way of having a more readable, maintainable and less complicated source codes, free of bugs and errors. Many studies had been proposed for detecting and omitting the four types of cloned codes based on pattern matching, syntax parsing, tree parsing and refactoring which is the most commonly used technique to remove the code clones from software, while maintaining its original behavior. In this paper, we propose an automated refactoring technique and its correspondence algorithm to omit code clones of type 1 and type 2. The proposed technique performance was tested and evaluated using four open source Java projects JFreeChart, JRuby, JCommon and Apache ant. The performance of the source codes was indicated based on number of metrics as the lines of code, number of blank lines, method’s count and cyclomatic complexity before and after applying the proposed technique. The experimentation results indicated that the proposed technique had showed superiority over the state-of-the-art through omitting the cloned codes with the possibility of maintaining the stability and correctness of behavior of the source codes under consideration.
Copyright © 2016 Praise Worthy Prize - All rights reserved.

Keywords


Code Clones; Clone Refactoring; Abstract Syntax Tree; Damerau–Levenshtein Distance

Full Text:

PDF


References


M. Tufano, F. Palomba,, G. Bavota, R. Oliveto, M. Di Penta, A. De Lucia & D. Poshyvanyk, When and why your code starts to smell bad, (2015, May), In Proceedings of the 37th International Conference on Software Engineering,(1), pp. 403-414, ISBN: 978-1-4799-1934-5, IEEE Press. ‏
http://dx.doi.org/10.1109/icse.2015.59

C. K. Roy, & J. R. Cordy, A survey on software clone detection research‏,(2007), Technical Report 541, Queen’s University at Kingston.
Avaliable in http://maveric0. uwaterloo. ca/~migod/846/papers/roy-CloningSurveyTechReport. pdf

S. Shafieian, & Y. Zou, Comparison of Clone Detection Techniques,(2012)‏, Technical report Queen’s University, Kingston, Canada.
Avaliable in https://www. researchgate.net/profile/Saeed_Shafieian/publication/267840728_Comparison_of_Clone_Detection_Techniques/links/54b6aa760cf2bd04be324938.pdf

J. Li & M. D. Ernst, CBCD: Cloned Buggy Code Detector,(2012, June), In Proceedings of the 34th International Conference on Software Engineering, pp. 310-320, ISBN: 978-1-4673-1067-3, IEEE Press. ‏
http://dx.doi.org/10.1109/icse.2012.6227183

H. Kim, Y. Jung, S. Kim & K. Yi MeCC: Memory Comparison-Based Clone Detector, (2011, May). In Proceedings of 33rd International Conference on Software Engineering (ICSE), pp. 301-310.
http://dx.doi.org/10.1145/1985793.1985835

E. Murphy-Hill, C. Parnin & A. P. Black, How we refactor, and how we know it(2012), IEEE Transactions on Software Engineering, 38(1), pp. 5-18.
http://dx.doi.org/10.1109/tse.2011.41

I. G. de Guzmán, M. Piattini & R. Pérez-Castillo, Green software maintenance, ‏(2015), In Green in Software Engineering,Springer International Publishing, pp. 205-229.
http://dx.doi.org/10.1007/978-3-319-08581-4_9

A. Hessellund, Refactoring as a Technique for the Reengineering of Legacy Systems, (2004), ITU, København.
Avaliable in https://www. researchgate.net/profile/Anders_Hessellund/publication/265425159_Refactoring_as_a_Technique_for_the_Reengineering_of_Legacy_Systems/links/55b127c108aed621ddfd4e5c.pdf

M. Fowler, Refactoring: Improving The Design Of Existing Code,(Pearson Education India,2009).
Avaliable in http://esigatesting. inta. gov. ar/webdav/files/pdf/sample-signed. pdf

M. F. Zibran & C. K. Roy, Conflict-aware optimal scheduling of prioritised code clone refactoring, (2013), Software, IET, 7(3), pp. 167-186.
http://dx.doi.org/10.1049/iet-sen.2012.0058

M. F. Zibran & C. K. Roy, Towards flexible code clone detection, management, and refactoring in IDE, (2011), Proceedings of the 5th International Workshop on Software Clones, pp. 75-76.
http://dx.doi.org/10.1145/1985404.1985423

R. Tairas & J. Gray, Increasing Clone Maintenance Support By Unifying Clone Detection And Refactoring Activities, (2012), Information and Software Technology, 54(12), pp. 1297 -1307.
http://dx.doi.org/10.1016/j.infsof.2012.06.011

M. Kim, T. Zimmermann & N. Nagappan, A Field Study Of Refactoring Challenges And Benefits, (2012, November), In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering, pp. 50, ISBN: 978-1-4503-1614-9.
http://dx.doi.org/10.1145/2393596.2393655

E. Choi, N. Yoshida & K. Inoue, What Kind Of And How Clones Are Refactored?: A Case Study Of Three OSS Projects, (2012), In Proceedings of the Fifth Workshop on Refactoring Tools, pp. 1-7, ISBN: 978-1-4503-1500-5.
http://dx.doi.org/10.1145/2328876.2328877

X. Ge & E. Murphy-Hill, Manual Refactoring Changes With Automated Refactoring Validation, (2014, May), In Proceedings of the 36th International Conference on Software Engineering, pp. 1095-1105., ISBN: 978-1-4503-2756-5.
http://dx.doi.org/10.1145/2568225.2568280

G. Szőke, C. Nagy, R. Ferenc & T. Gyimóthy, A Case Study Of Refactoring Large-Scale Industrial Systems To Efficiently Improve Source Code Quality,(2014), Computational Science and Its Applications–ICCSA 2014, pp. 524-540.
http://dx.doi.org/10.1007/978-3-319-09156-3_37

G. P. Krishnan & N. Tsantalis, Unification And Refactoring Of Clones, (2014, February), In Proceedings ofWeek-IEEE Conference onSoftware Maintenance, Reengineering and Reverse Engineering (CSMR-WCRE), 2014 Software Evolution, pp. 104-113, Electronic ISBN: 978-1-4799-3752-3.
http://dx.doi.org/10.1109/csmr-wcre.2014.6747160

H. A. Basit, H. S. Khan, F. Hamid & I. Suhail, Tool Support For Managing Method Clones, (2015), IEEE 9th International Workshop on Software Clones (IWSC), pp. 40 -46, ElectronicISBN: 978-1-4673-6914-5.
http://dx.doi.org/10.1109/iwsc.2015.7069888

M. Mondal,, C. K. Roy & K. A. Schneider, SPCP-Miner: A Tool For Mining Code Clones That Are Important For Refactoring Or Tracking, (2015, March), In 2015 IEEE 22nd International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 484-488, Electronic ISBN: 978-1-4799-8469-5.
http://dx.doi.org/10.1109/saner.2015.7081861

N. Tsantalis, D. Mazinanian & G. P. Krishnan, Assessing the Refactorability of Software Clones, (2015), IEEE Transactions on Software Engineering,41(11), pp. 1055 -1090.
http://dx.doi.org/10.1109/tse.2015.2448531

E. L. Alves, T. Massoni & P. D. de Lima Machado, Test Coverage Of Impacted Code Elements For Detecting Refactoring Faults: An Exploratory Study,(2016), Journal of Systems and Software. ‏ ISSN 0164-1212.
http://dx.doi.org/10.1016/j.jss.2016.02.001

D. Saha, P. Dhoolia, M. Garg & V. Vaibhav, Delta Refactoring for Merge Conflict Avoidance, (2016, February), In Proceedings of the 9th India Software Engineering Conference, pp. 26-36.
http://dx.doi.org/10.1145/2856636.2856640

J. Xuan, B. Cornu,, M. Martinez, B. Baudry, L. Seinturier & M. Monperrus, B-Refactoring: Automatic Test Code Refactoring To Improve Dynamic Analysis, (2016). Information and Software Technology, (76), pp. 65-80.
http://dx.doi.org/10.1016/j.infsof.2016.04.016

B. Biegel & S. Diehl, Highly configurable and extensible code clone detection, (2010, October), In 17th Working Conference onReverse Engineering (WCRE), pp. 237-241, Print ISSN: 1095-1350.
http://dx.doi.org/10.1109/wcre.2010.34

I. D. Baxter, A. Yahin, L. Moura, M. S. Anna & L. Bier,. Clone Detection Using Abstract Syntax Trees,(16-20 Nov 1998), In Proceedings of International Conference on Software Maintenance, pp. 368-377, PrintISSN: 1063-6773.
http://dx.doi.org/10.1109/icsm.1998.738528

F. J. Damerau, A Technique For Computer Detection And Correction Of Spelling Errors, (1964), Communications of the ACM, 7(3), pp. 171-176. ‏
http://dx.doi.org/10.1145/363958.363994

V. I. Levenshtein, Binary codes capable of correcting deletions, insertions, and reversals, (1966, February), In Soviet physics doklady, 10(8), pp. 707-710. ‏
http://dx.doi.org/10.1109/isit.1994.394907

Damerau–Levenshtein distance, available at: https://en. wikipedia. org/wiki/Damerau%E2%80%93Levenshtein_distance [accessed at: 23/12/2015]
http://dx.doi.org/10.1109/rivf.2010.5632914

JavaParser version 1. 5, available at: https://code. google. com/archive/p/javaparser/ [accessed at: 12/12/2015]
http://dx.doi.org/10.1145/2157136.2157441

A. H. Watson, T. J. McCabe & D. R. Wallace, Structured testing: A testing methodology using the cyclomatic complexity metric, (1996), NIST special Publication, 500(235), 1-114.
Available in http://asetechs. com/NewSite2015/Documentation/_ressources/QualityMeasurements/McCabe_cyclomatic_audit_process. pdf

JFree, available at: http://www. jfree. org/jfreechart/ [accessed at : 25/1/2016]
http://dx.doi.org/10.1353/ol.2011.0013

JRuby, avalable at: http://jruby. org/ [accessed at : 29/1/2016]
http://dx.doi.org/10.1007/978-1-4302-1637-7_8

JCommon, available in: http://www. java2s. com/Code/Jar/j/Downloadjcommonjar. htm [accessed at : 29/1/2016]
http://dx.doi.org/10.1086/685430

The Apache Ant, available in: https://ant. apache. org/bindownload. cgi [accessed at : 15/2/2016]
http://dx.doi.org/10.1007/978-1-4302-0092-5_2


Refbacks

  • There are currently no refbacks.



Please send any question about this web site to info@praiseworthyprize.com
Copyright © 2005-2024 Praise Worthy Prize