Cloning in DSLs: Experiments with OCL

  • Robert Tairas
  • Jordi Cabot
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6940)


Code cloning (i.e., similar code fragments) in general purpose languages has been a major focus of the research community. For domain specific languages (DSLs), cloning related to domain-specific graphical languages has also been considered. This paper focuses on domain-specific textual languages in an effort to evaluate cloning in these DSLs where instances of such DSLs allow for less code to express domain-specific features, but potentially more frequently used code constructs. We suggest potential application scenarios of using clone detection for the maintenance of DSL code. We introduce a clone detection mechanism using a Model Driven Engineering (MDE) based approach to evaluate the extent of cloning in an initial DSL (i.e., the Object Constraint Language (OCL)). The evaluation reveals the existence of cloning in OCL, which suggests the relevance and potential applications of clone detection and analysis in DSLs.


Code clones clone detection domain-specific languages ATL Transformation Language Object Constraint Language 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baxter, I., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone detection using abstract syntax trees. In: International Conference on Software Maintenance, pp. 368–377 (1998)Google Scholar
  2. 2.
    Bellon, S., Koschke, R., Antoniol, G., Krinke, J., Merlo, E.: Comparison and evaluation of clone detection tools. IEEE Transactions on Software Engineering 33(9), 577–591 (2007)CrossRefGoogle Scholar
  3. 3.
    Chimiak-Opoka, J.: OCLLib, OCLUnit, OCLDoc: Pragmatic Extensions for the Object Constraint Language. In: Schürr, A., Selic, B. (eds.) MODELS 2009. LNCS, vol. 5795, pp. 665–669. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  4. 4.
    Deissenboeck, F., Hummel, B., Juergens, E., Pfaehler, M., Schaetz, B.: Model clone detection in practice. In: International Workshop on Software Clones, pp. 57–64 (2010)Google Scholar
  5. 5.
    van Deursen, A., Klint, P.: Little languages: Little maintenance. Journal of Software Maintenance: Research and Practice 10(2), 75–92 (1998)CrossRefGoogle Scholar
  6. 6.
    Duala-Ekoko, E., Robillard, M.: Clone region descriptors: Representing and tracking duplication in source code. ACM Transactions of Software Engineering and Methodology 20(1), 1–31 (2010)CrossRefGoogle Scholar
  7. 7.
    Frias, L., Queralt, A., Olivé, A.: Eu-rent car rentals specification. Tech. Rep. LSI-03-59-R, Technical University of Catalonia - Departament de Llenguatges i Sistemes Informatics (2003)Google Scholar
  8. 8.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison-Wesley, Boston (1995)Google Scholar
  9. 9.
    Gruska, N., Wasylkowski, A., Zeller, A.: Learning from 6,000 projects: Lightweight cross-project anomaly detection. In: International Symposium on Software Testing and Analysis, pp. 119–130 (2010)Google Scholar
  10. 10.
    Jiang, L., Misherghi, G., Su, Z., Glondu, S.: DECKARD: Scalable and accurate tree-based detection of code clones. In: International Conference on Software Engineering, pp. 96–105 (2007)Google Scholar
  11. 11.
    Johnson, J.H.: Substring matching for clone detection and change tracking. In: International Conference on Software Maintenance, pp. 120–126 (1994)Google Scholar
  12. 12.
    Jouault, F., Allilaire, F., Bézivin, J., Kurtev, I.: ATL: A model transformation tool. Science of Computer Programming 72(1-2), 31–39 (2008)MathSciNetMATHCrossRefGoogle Scholar
  13. 13.
    Jouault, F., Bézivin, J., Kurtev, I.: TCS: A DSL for the specification of textual concrete syntaxes in model engineering. In: Jarzabek, S., Schmidt, D.C., Veldhuizen, T.L. (eds.) International Conference on Generative Programming and Component Engineering, pp. 249–254 (2006)Google Scholar
  14. 14.
    Kamiya, T., Kusumoto, S., Inoue, K.: CCFinder: A multilinguistic token-based code clone detection system for large scale source code. IEEE Transactions on Software Engineering 28(7), 654–670 (2002)CrossRefGoogle Scholar
  15. 15.
    Kim, H., Jung, Y., Kim, S., Yi, K.: MeCC: Memory comparison-based clone detector. In: Taylor, R.N., Gall, H., Medvidovic, N. (eds.) International Conference on Software Engineering, pp. 301–310 (2011)Google Scholar
  16. 16.
    Kim, M., Sazawal, V., Notkin, D., Murphy, G.: An empirical study of code clone genealogies. In: European Software Engineering Conference held Jointly with the ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 187–196 (2005)Google Scholar
  17. 17.
    Lämmel, R., Pek, E.: Vivisection of a non-executable, domain-specific language - understanding (the usage of) the P3P language. In: IEEE International Conference on Program Comprehension, pp. 104–113 (2010)Google Scholar
  18. 18.
    Li, H., Thompson, S.: Clone detection and removal for Erlang/OTP within a refactoring environment. In: Workshop on Partial Evaluation and Program Manipulation, pp. 169–178 (2009)Google Scholar
  19. 19.
    Li, Z., Lu, S., Myagmar, S., Zhou, Y.: CP-Miner: A tool for finding copy-paste and related bugs in operating system code. In: Symposium on Operating Systems Design and Implementation, pp. 289–302 (2004)Google Scholar
  20. 20.
    Pham, N.H., Nguyen, H.A., Nguyen, T.T., Al-Kofahi, J.M., Nguyen, T.N.: Complete and accurate clone detection in graph-based models. In: International Conference on Software Engineering, pp. 276–286 (2009)Google Scholar
  21. 21.
    Roy, C., Cordy, J., Koschke, R.: Comparison and evaluation of code clone detection techniques and tools: A qualitative approach. Science of Computer Programming 74(7), 470–495 (2009)MathSciNetMATHCrossRefGoogle Scholar
  22. 22.
    Schmidt, D.: Guest editor’s introduction: Model-driven engineering. IEEE Computer 39(2), 25–31 (2006)CrossRefGoogle Scholar
  23. 23.
    Tisi, M., Jouault, F., Fraternali, P., Ceri, S., Bézivin, J.: On the Use of Higher-Order Model Transformations. In: Paige, R.F., Hartman, A., Rensink, A. (eds.) ECMDA-FA 2009. LNCS, vol. 5562, pp. 18–33. Springer, Heidelberg (2009)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Robert Tairas
    • 1
  • Jordi Cabot
    • 1
  1. 1.AtlanMod, INRIA & École des Mines de NantesFrance

Personalised recommendations