skip to main content
10.1145/1062455.1062537acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
Article

Beyond templates: a study of clones in the STL and some general implications

Published: 15 May 2005 Publication History

Abstract

Templates (or generics) help us write compact, generic code, which aids both reuse and maintenance. The STL is a powerful example of how templates help achieve these goals. Still, our study of the STL revealed substantial, and in our opinion, counter-productive repetitions (so-called clones) across groups of similar class or function templates. Clones occurred, as variations across these similar program structures were irregular and could not be unified by suitable template parameters in a natural way. We encountered similar problems in other class libraries as well as in application programs, written in a range of programming languages. In the paper, we present quantitative and qualitative results from our study. We argue that the difficulties we encountered affect programs in general. We present a solution that can treat such template-unfriendly cases of redundancies at the meta-level, complementing and extending the power of language features, such as templates, in areas of generic programming.

References

[1]
Baker, B. S., "On finding duplication and near-duplication in large software systems," Proc. 2nd Working Conference on Reverse Engineering, 1995, pages 86--95.
[2]
Balazinska, M., Merlo, E., Dagenais, M., Lagüe, B., and Kontogiannis, K.A., "Partial redesign of Java software systems based on clone analysis," Proc. 6th IEEE Working Conference on Reverse Eng., 1999, pp. 326--336.
[3]
Balazinska, M., Merlo, E., Dagenais, Lagüe, B., and Kontogiannis, K.A., "Advanced Clone-Analysis to Support Object-Oriented System Refactoring," Proc. Seventh Working Conference on Reverse Engineering (WCRE '00) pp. 98--107.
[4]
Bassett, P., Framing software reuse - lessons from real world, Yourdon Press, Prentice Hall, 1997.
[5]
Batory, D., Singhai, V., Sirkin, M. and Thomas, J. "Scalable software libraries," ACM SIGSOFT'93: Symp. on the Foundations of Software Engineering, Los Angeles, Dec. 1993, pp.191--199.
[6]
Baxter, I., Yahin, A., Moura, L., and Anna, M. S., "Clone detection using abstract syntax trees," Proc. Intl. Conference on Software Maintenance (ICSM '98), pp. 368--377.
[7]
Biggerstaff, T. "The library scaling problem and the limits of concrete component reuse," 3rd Int'l. Conf. on Software Reuse, ICSR'94, 1994, pp. 102--109.
[8]
Bracha G. et al. "JSR 14: Add Generic Types to the Java™ Programming Language," Java Community Process, http://www.jcp.org/en/jsr/detail?id=14
[9]
Brooks, P.B The Mythical Man-Month, Addison Wesley, 1995.
[10]
Brown, T.J., Spence, I., Kilpatric, P., and Crookes, D., "Adaptable Components for Software Product Line Engineering", LNCS, vol 2379, Chastek, G. (Ed.), Springer-Verlag Berlin Heidelberg, 2002, pp. 154--175.
[11]
Case Studies on XVCL Website, http://fxvcl.sourceforge.net/CaseStudy.htm
[12]
Cordy, J. R., "Comprehending Reality: Practical Challenges to Software Maintenance Automation," Proc. 11th IEEE Intl. Workshop on Program Comprehension, (IWPC 2003), pp. 196--206.
[13]
Czarnecki, K. and Eisenecker, U., Generative Programming: Methods, Tools, and Applications, Addison-Wesley, 2000.
[14]
Ducasse, S, Rieger, M., and Demeyer, S., "A language independent approach for detecting duplicated code," Proc. Intl. Conference on Software Maintenance (ICSM '99), pp. 109--118.
[15]
Ernst, M., Badros, G., and Notkin, D. "An Empirical Analysis of C Preprocessor Use," IEEE Transactions on Software Engineering, Dec. 2002, pp. 1146--1170.
[16]
Fowler M. Refactoring - improving the design of existing code, Addison-Wesley, 1999.
[17]
Garcia, R. et al., "A Comparative Study of Language Support for Generic Programming," Proc. 18th ACM SIGPLAN Conf. on Object-oriented Programming, Systems, Languages, and Applications, 2003, pp. 115--134.
[18]
Home page of SGI STL, http://www.sgi.com/tech/stl/
[19]
Jarzabek, S. and Shubiao, L., "Eliminating Redundancies with a "Composition with Adaptation" Meta-programming Technique," Proc. ESEC-FSE'03, European Software Engineering Conference and ACM SIGSOFT Symposium on the Foundations of Software Engineering, ACM Press, pp. 237--246.
[20]
Johnson, J. H., "Substring Matching for Clone Detection and Change Tracking," Proc. Intl. Conference on Software Maintenance (ICSM '94), pp. 120--126.
[21]
Kamiya, T., Kusumoto, S, and Inoue, K., "CCFinder: A multi-linguistic token-based code clone detection system for large scale source code," IEEE Trans. Software Engineering, vol. 28 no. 7, July 2002, pp. 654--670.
[22]
Karhinen, A., Ran, A. and Tallgren, T. "Configuring designs for reuse," Proc. International Conference on Software Engineering, ICSE'97, Boston, MA., 1997, pp. 701--710.
[23]
Kennedy, A. and Syme, D., "Design and implementation of generics for the .Net Common Language Runtime," Proc. ACM SIGPLAN '01 Conf. on Programming Languages Design and Implementation (PLDI -01), New York, June 2001, pp 1--12.
[24]
Musser, D. R. and Saini A., STL Tutorial and Reference Guide, Addison-Wesley, Reading, MA, 1996.
[25]
Opdyke, W., Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign, 1992.
[26]
Parnas, D., "Software aging," Proc. 16th International Conference on Software Engineering (ICSE 1994), pages 279--287.
[27]
Thompson, S., "Higher Order + Polymorphic = Reusable", unpublished manuscript available from the Computing Laboratory, University of Kent. http://www.cs.ukc.ac.uk/pubs/1997
[28]
"XML-based Variant Configuration Language," XVCL Website, http://fxvcl.sourceforge.net
[29]
Zhang, H. and Jarzabek, S. "An XVCL approach to handling variants: A KWIC product line example," Proc. 10th Asia-Pacific Software Engineering Conference (APSEC'03), IEEE CS Press., pp 116--125.
[30]
Zhang, H. and Jarzabek, S., "An XVCL-based Approach to Software Product Line Development", Proc. 15th International Conference on Software Engineering and Knowledge Engineering (SEKE'03), San Francisco, USA, 1-3 July, 2003.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '05: Proceedings of the 27th international conference on Software engineering
May 2005
754 pages
ISBN:1581139632
DOI:10.1145/1062455
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: 15 May 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. clones
  2. meta-programming
  3. software maintenance

Qualifiers

  • Article

Conference

ICSE05
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)7
  • Downloads (Last 6 weeks)3
Reflects downloads up to 24 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media