Conflict-aware optimal scheduling of prioritised code clone refactoring

Conflict-aware optimal scheduling of prioritised code clone refactoring

For access to this article, please select a purchase option:

Buy article PDF
(plus tax if applicable)
Buy Knowledge Pack
10 articles for £75.00
(plus taxes if applicable)

IET members benefit from discounts to all IET publications and free access to E&T Magazine. If you are an IET member, log in to your account and the discounts will automatically be applied.

Learn more about IET membership 

Recommend Title Publication to library

You must fill out fields marked with: *

Librarian details
Your details
Why are you recommending this title?
Select reason:
IET Software — Recommend this title to your library

Thank you

Your recommendation has been sent to your librarian.

Duplicated or similar source code, also known as code clones, are possible malicious ‘code smells’ that may need to be removed through refactoring to enhance maintainability. Among many potential refactoring opportunities, the choice and order of a set of refactoring activities may have distinguishable effect on the design/code quality measured in terms of software metrics. Moreover, there may be dependencies and conflicts among those refactorings of different priorities. Addressing all the conflicts, priorities and dependencies, a manual formulation of an optimal refactoring schedule is very expensive, if not impossible. Therefore an automated refactoring scheduler is necessary to ‘maximise benefit and minimise refactoring effort’. However, the estimation of the efforts required to perform code clone refactoring is a challenging task. This study makes two contributions. First, the authors propose an effort model for the estimation of code clone refactoring efforts. Second, the authors propose a constraint programming (CP) approach for conflict-aware optimal scheduling of code clone refactoring. A qualitative evaluation of the effort model from the developers’ perspective suggests that the model is complete and useful for code clone refactoring effort estimation. The authors also quantitatively compared their refactoring scheduler with other well-known scheduling techniques such as the genetic algorithm, greedy approaches and linear programming. The authors’ empirical study suggests that the proposed CP-based approach outperforms other approaches they considered.


    1. 1)
      • 1. Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: ‘Refactoring: improving the design of existing code’ (Addison Wesley Professional, 1999).
    2. 2)
      • 2. Juergens, E., Deissenboeck, F., Hummel, B., Wagner, S.: ‘Do code clones matter?’. Proc. 31st Int. Conf. Software Engineering (ICSE), Vancouver, BC, Canada, May 2009, pp. 485495.
    3. 3)
      • 3. Kapser, C., Godfrey, M.W.: ‘Cloning considered harmful’ considered harmful: patterns of cloning in software’, Empir. Softw. Eng., 2008, 13, (6), pp. 645692 (doi: 10.1007/s10664-008-9076-6).
    4. 4)
      • 4. Zibran, M., Saha, R., Asaduzzaman, M., Roy, C.: ‘Analyzing and forecasting near-miss clones in evolving software: an empirical study’. Proc. 16th IEEE Int. Conf. Engineering of Complex Computer Systems (ICECCS), Las Vegas, Nevada, USA, April 2011, pp. 295304.
    5. 5)
      • 5. Rieger, M., Ducasse, S., Lanza, M.: ‘Insights into system-wide code duplication’. Proc. 11th IEEE Working Conf. Reverse Engineering (WCRE), Delft, The Netherlands, November 2004, pp. 100109.
    6. 6)
      • 6. Fowler, M.: ‘Refactoring catalog’,, accessed March 2012.
    7. 7)
      • 7. Zibran, M., Roy, C.: ‘Towards flexible code clone detection, management, and refactoring in IDE’. Proc. Fifth Int. Workshop of Software Clones (IWSC), Honolulu, Hawaii, USA, May 2011, pp. 7576.
    8. 8)
      • 8. Pérez, J., Crespo, Y., Hoffmann, B., Mens, T.: ‘A case study to evaluate the suitability of graph transformation tools for program refactoring’, Int. J. Softw. Tools Technol. Transf., 2010, 12, pp. 183199 (doi: 10.1007/s10009-010-0153-y).
    9. 9)
      • 9. Liu, H., Li, G., Ma, Z., Shao, W.: ‘Conflict-aware schedule of software refactorings’, IET Softw., 2008, 2, (5), pp. 446460 (doi: 10.1049/iet-sen:20070033).
    10. 10)
      • 10. Bouktif, S., Antoniol, G., Neteler, M., Merlo, E.: ‘A novel approach to optimize clone refactoring activity’. Proc. Eighth Annual Conf. Genetic and Evolutionary Computation (GECCO), Seattle, Washington, USA, July 2006, pp. 18851892.
    11. 11)
      • 11. Lee, S., Bae, G., Chae, H.S., Bae, D., Kwon, Y.R.: ‘Automated scheduling for clone-based refactoring using a competent GA’, Softw. Pract. Exper., 2010, 41, (5), pp. 521550 (doi: 10.1002/spe.1031).
    12. 12)
      • 12. Barták, R.: ‘Constraint programming: in pursuit of the holy grail’. Proc. Week of Doctoral Students (WDS), Part IV (invited lecture), Prague, Czech Republic, June 1999, pp. 555564.
    13. 13)
      • 13. Zibran, M.: ‘A multi-phase approach to university course timetabling’. MSc thesis, Department of Mathematics and Computer Science, University of Lethbridge, Canada, September 2007, pp. 1125.
    14. 14)
      • 14. Zibran, M., Roy, C.: ‘A constraint programming approach to conflict-aware optimal scheduling of prioritized code clone refactoring’. Proc. 11th IEEE Int. Working Conf. Source Code Analysis and Manipulation (SCAM), Williamsburg, Virginia, USA, September 2011, pp. 105114.
    15. 15)
      • 15. Kodhai, E., Vijayakumar, V., Balabaskaran, G., Stalin, T., Kanagaraj, B.: ‘Method level detection and removal of code clones in C and Java programs using refactoring’, Int. J. Comput. Commun. Inf. Syst. (IJCCIS), 2010, 2, (1), pp. 9395.
    16. 16)
      • 16. Roy, C., Cordy, J.: ‘A mutation/injection-based automatic framework for evaluating clone detection tools’. Proc. IEEE Int. Conf. Software Testing, Verification, and Validation Workshops (ICSTW), Denver, Colorado, USA, April 2009, pp. 157166.
    17. 17)
      • 17. Saha, R., Roy, C., Schneider, K.: ‘An automatic framework for extracting and classifying near-miss clone genealogies’. Proc. 27th IEEE Int. Conf. Software Maintenance (ICSM), Williamsburg, Virginia, USA, September 2011, pp. 293302.
    18. 18)
      • 18. Uddin, S., Roy, C., Schneider, K., Hindle, A.: ‘On the effectiveness of Simhash for detecting near-miss clones in large scale software systems’. Proc. 18th IEEE Working Conf. Reverse Engineering (WCRE), Lero, Limerick, Ireland, October 2011, pp. 1322.
    19. 19)
      • 19. Zibran, M., Roy, C.: ‘IDE-based real-time focused search for near-miss clones’. Proc. 27th ACM Symp. Applied Computing (SAC), Riva del Garda, Trento, Italy, March 2012, pp. 12351242.
    20. 20)
      • 20. Advani, D., Hassoun, Y., Counsell, S.: ‘Understanding the complexity of refactoring in software systems: a tool-based approach’, Int. J. Gen. Syst., 2006, 35, (3), pp. 329346 (doi: 10.1080/03081070600661051).
    21. 21)
      • 21. Higo, Y., Kamiya, T., Kusumoto, S., Inoue, K.: ‘ARIES: refactoring support tool code clone’. Proc. Third Workshop on Software Quality (3-WoSQ), St. Louis, Missouri, USA, July 2005, pp. 14.
    22. 22)
      • 22. Higo, Y., Kamiya, T., Kusumoto, S., Inoue, K.: ‘Refactoring support based on code clone analysis’. Product Focused Software Process Improvement (PROFES), Springer, Berlin, Heidelberg Press, 2004, LNCS, 3009, pp. 220233.
    23. 23)
      • 23. Schulze, S., Kuhlemann, M.: ‘Advanced analysis for code clone removal’. Proc. GI-Workshop on Software Reengineering (WSR), Bad-Honnef, Germany, May 2009, pp. 1012.
    24. 24)
      • 24. Yoshida, N., Higo, Y., Kamiya, T., Kusumoto, S., Inoue, K.: ‘On refactoring support based on code clone dependency relation’. Proc. 11th IEEE Int. Software Metrics Symp. (METRICS), Como, Italy, September 2005, pp. 1625.
    25. 25)
      • 25. DeLine, R., Venolia, G., Rowan, K.: ‘Software development with code maps’, ACM Commun., 2010, 53, (8), pp. 4854 (doi: 10.1145/1787234.1787250).
    26. 26)
      • 26. Mens, T., Taentzer, G., Runge, O.: ‘Analysing refactoring dependencies using graph transformation’, J. Softw. Syst. Model., 2007, 6, (3), pp. 269285 (doi: 10.1007/s10270-006-0044-6).
    27. 27)
      • 27. Sillito, J., Murphy, G., Volder, K.: ‘Asking and answering questions during a programming change task’, IEEE Trans. Softw. Eng., 2008, 34, (4), pp. 434451 (doi: 10.1109/TSE.2008.26).
    28. 28)
      • 28. Bansiya, J., Davis, C.: ‘A hierarchical model for object-oriented design quality assessment’, IEEE Trans. Softw. Eng., 2002, 28, (1), pp. 417 (doi: 10.1109/32.979986).
    29. 29)
      • 29. Chidamber, S., Kemerer, C.: ‘A metric suite for object-oriented design’, IEEE Trans. Softw. Eng., 1994, 25, (5), pp. 476493 (doi: 10.1109/32.295895).
    30. 30)
      • 30. Sahraoui, H., Godin, R., Miceli, T.: ‘Can metrics help to bridge the gap between the improvement of OO design quality and its automation?Proc. 16th IEEE Int. Conf. Software Maintenance (ICSM), San Jose, California, USA, October 2000, pp. 154162.
    31. 31)
      • 31. Simon, F., Steinbrucker, F., Lewerentz, C.: ‘Metrics based refactoring’. Proc. Fifth European Conf. Software Maintenance and Reengineering (CSMR), Lisbon, Portugal, March 2001, pp. 3038.
    32. 32)
      • 32. Tahvildari, L., Kontogiannis, K.: ‘A metric-based approach to enhance design quality through meta-pattern transformations’. Proc. Seventh European Conf. Software Maintenance and Reengineering (CSMR), Benevento, Italy, March 2003, pp. 183192.
    33. 33)
      • 33. Saha, R., Asaduzzaman, M., Zibran, M., Roy, C., Schneider, K.: ‘Evaluating code clone genealogies at release level: an empirical study’. Proc. 10th IEEE Int. Working Conf. Source Code Analysis and Manipulation (SCAM), Timisoara, Romania, September 2010, pp. 8796.
    34. 34)
      • 34. Asaduzzaman, M., Roy, C., Schneider, K.: ‘VisCad: flexible code clone analysis support for NiCad’. Proc. Fifth Int. Workshop of Software Clones (IWSC), Waikiki, Honolulu, Hawaii, USA, May 2011, pp. 7778.
    35. 35)
      • 35. Cordy, J., Roy, C.: ‘The NiCad clone detector’. Proc. 19th IEEE Int. Conf. Program Comprehension (ICPC), tool demo, Kingston, Ontario, Canada, June 2011, pp. 219220.
    36. 36)
      • 36. Winston, W.: ‘Operations research applications and algorithms’ (Duxbury Press, Belmont, CA, USA, 1994, 3rd edn.).
    37. 37)
      • 37. Obitko, M.: ‘Introduction to genetic algorithms’, A tutorial on genetic algorithm,, accessed March 2012.
    38. 38)
      • 38. Davidor, Y.: ‘Epistasis variance: a viewpoint on GA-hardness’. Proc. First Workshop on the Foundations of Genetic Algorithms (FOGA), Bloomington, Indiana, USA, July 1990, pp. 2335.
    39. 39)
      • 39. Eiben, A., Raue, P., Ruttkay, Z.: ‘Solving constraint satisfaction problems using genetic algorithms’. Proc. First IEEE Conf. Evolutionary Computation, Orlando, Florida, USA, June 1994, pp. 542547.
    40. 40)
      • 40. Robillard, M., Coelho, W., Murphy, G.: ‘How effective developers investigate source code: an exploratory study’, IEEE Trans. Softw. Eng., 2004, 30, (12), pp. 889903 (doi: 10.1109/TSE.2004.101).
    41. 41)
      • 41. Zibran, M., Roy, C.: ‘Conflict-aware optimal scheduling of code clone refactoring: a constraint programming approach’. Proc. (Student Symp. of the 19th IEEE Int. Conf. Program Comprehension (ICPC), Kingston, Ontario, Canada, June 2011, pp. 266269.
    42. 42)
      • 42. Orso, A., Shi, N., Harrold, M.: ‘Scaling regression testing to large software systems’, SIGSOFT Softw. Eng. Notes, 2004, 29, (6), pp. 241251 (doi: 10.1145/1041685.1029928).
    43. 43)
      • 43. O'Keeffe, M., Ó Cinnéide, M.: ‘Search-based refactoring: an empirical study’, J. Softw. Maint. Evol. Res. Pract., 2008, 20, (1), pp. 345364.
    44. 44)
      • 44. Ducasse, S., Rieger, M., Golomingi, G.: ‘Tool support for refactoring duplicated OO code’. Proc. Object-Oriented Technology (ECOOP'99 Workshop Reader), number 1743 in LNCS, Springer-Verlag Press, 1999, pp. 26.
    45. 45)
      • 45. Schulze, S., Kuhlemann, M., Rosenmüller, M.: ‘Towards a refactoring guideline using code clone classification’. Proc. Second Workshop on Refactoring Tools (WRT), Nashville, Tennessee, USA, October 2008, pp. 6:16:4.
    46. 46)
      • 46. Higo, Y., Ueda, Y., Kusumoto, S., Inoue, K.: ‘Simultaneous modification support based on code clone analysis’. Proc. 14th Asia Pacific Software Engineering Conf. (APSEC), Nagoya, Aichi, Japan, December 2007, pp. 262269.
    47. 47)
      • 47. Hou, D., Jablonski, P., Jacob, F.: ‘CnP: towards an environment for the proactive management of copy-and-paste programming’. Proc. 17th IEEE Int. Conf. Program Comprehension (ICPC), Vancouver, BC, Canada, May 2009, pp. 238242.

Related content

This is a required field
Please enter a valid email address