skip to main content
research-article

Systematic editing: generating program transformations from an example

Published:04 June 2011Publication History
Skip Abstract Section

Abstract

Software modifications are often systematic ---they consist of similar, but not identical, program changes to multiple contexts. Existing tools for systematic program transformation are limited because they require programmers to manually prescribe edits or only suggest a location to edit with a related example. This paper presents the design and implementation of a program transformation tool called SYDIT. Given an example edit, SYDIT generates a context-aware, abstract edit script, and then applies the edit script to new program locations. To correctly encode a relative position of the edits in a new location, the derived edit script includes unchanged statements on which the edits are control and data dependent. Furthermore, to make the edit script applicable to a new context using different identifier names, the derived edit script abstracts variable, method, and type names. The evaluation uses 56 systematic edit pairs from five large software projects as an oracle. SYDIT has high coverage and accuracy. For 82% of the edits (46/56), SYDIT matches the context and applies an edit, producing code that is 96% similar to the oracle. Overall, SYDIT mimics human programmers correctly on 70% (39/56) of the edits. Generation of edit scripts seeks to improve programmer productivity by relieving developers from tedious, error-prone, manual code updates. It also has the potential to guide automated program repair by creating program transformations applicable to similar contexts.

References

  1. J. Andersen. Semantic Patch Inference. Ph.D. Dissertation, University of Copenhagen, Copenhagen, Nov. 2009. Adviser-Julia L. Lawall.Google ScholarGoogle Scholar
  2. J. Andersen and J. L. Lawall. Generic patch inference. In ASE '08: Proceedings of the 2008 23rd IEEE/ACM International Conference on Automated Software Engineering, pages 337--346, Washington, DC, USA, 2008. IEEE Computer Society. ISBN 978-1-4244-2187-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. T. Apiwattanapong, A. Orso, and M. J. Harrold. A differencing algorithm for object-oriented programs. In ASE '04: Proceedings of the 19th IEEE International Conference on Automated Software Engineering, pages 2--13, Washington, DC, USA, 2004. IEEE Computer Society. ISBN 0-7695-2131-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Boshernitsan, S. L. Graham, and M. A. Hearst. Aligning development tools with the way programmers think about code changes. In CHI '07: Proceedings of the SIGCHI conference on Human factors in computing systems, pages 567--576, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-593-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. R. Cordy. The txl source transformation language. Science of Computer Programming, 61(3):190--210, 2006. ISSN 0167-6423. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, Oct. 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. E. Duala-Ekoko and M. P. Robillard. Tracking code clones in evolving software. In ICSE '07: Proceedings of the 29th International Conference on Software Engineering, pages 158--167, Washington, DC, USA, 2007. IEEE Computer Society. ISBN 0-7695-2828-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. Erwig and D. Ren. A rule-based language for programming software updates. In RULE '02: Proceedings of the 2002 ACM SIGPLAN workshop on Rule-based programming, pages 67--78, New York, NY, USA, 2002. ACM. ISBN 1-58113-606-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. B. Fluri, M. Würsch, M. Pinzger, and H. C. Gall. Change distilling--- tree differencing for fine-grained source code change extraction. IEEE Transactions on Software Engineering, 33(11):18, November 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. W. G. Griswold. Program Restructuring as an Aid to Software Maintenance. PhD thesis, University of Washington, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. W. G. Griswold, D. C. Atkinson, and C. McCurdy. Fast, flexible syntactic pattern matching and processing. In WPC '96: Proceedings of the 4th International Workshop on Program Comprehension, page 144, Washington, DC, USA, 1996. IEEE Computer Society. ISBN 0-8186-7283-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Henkel and A. Diwan. Catchup!: Capturing and replaying refactorings to support api evolution. In ICSE '05: Proceedings of the 27th International Conference on Software Engineering, pages 274--283, New York, NY, USA, 2005. ACM. ISBN 1-59593-963-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Horwitz. Identifying the semantic and textual differences between two versions of a program. In PLDI '90: Proceedings of the ACM SIGPLAN 1990 conference on Programming language design and implementation, pages 234--245, New York, NY, USA, 1990. ACM. ISBN 0-89791-364-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. W. Hunt and T. G. Szymanski. A fast algorithm for computing longest common subsequences. Communications of the ACM, 20(5): 350--353, 1977. ISSN 0001-0782. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Kim and D. Notkin.Discovering and representing systematic code changes. In ICSE '09: Proceedings of the 2009 IEEE 31st International Conference on Software Engineering, pages 309--319, Washington, DC, USA, 2009. IEEE Computer Society. ISBN 978-1-4244-3453-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Kim, V. Sazawal, D. Notkin, and G. Murphy. An empirical study of code clone genealogies. In ESEC/FSE-13: Proceedings of the 10th European Software Engineering Conference held jointly with 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pages 187--196, New York, NY, USA, 2005. ACM. ISBN 1-59593-014-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Kim, D. Notkin, and D. Grossman. Automatic inference of structural changes for matching across program versions. In ICSE '07: Proceedings of the 29th International Conference on Software Engineering, pages 333--343, Washington, DC, USA, 2007. IEEE Computer Society. ISBN 0-7695-2828-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. A. Ladd and J. C. Ramming. A*: A language for implementing language processors. IEEE Transactions on Software Engineering, 21 (11):894--901, 1995. ISSN 0098-5589. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. H. Lieberman, editor. Your Wish is My Command: Programming by Example. Morgan Kaufmann Publishers, 2001.Google ScholarGoogle Scholar
  20. A. Matzner, M. Minas, and A. Schulte. Efficient graph matching with application to cognitive automation. In A. Schrr, M. Nagl, and A. Zndorf, editors, Applications of Graph Transformations with Industrial Relevance, volume 5088 of Lecture Notes in Computer Science, pages 297--312. Springer Berlin / Heidelberg, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. T. Mens and T. Tourwe. A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2):126--139, 2004. ISSN 0098-5589. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. R. C. Miller and B. A. Myers. Interactive simultaneous editing of multiple text regions. In Proceedings of the General Track: 2002 USENIX Annual Technical Conference, pages 161--174, Berkeley, CA, USA, 2001. USENIX Association. ISBN 1-880446-09-X. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. H. A. Nguyen, T. T. Nguyen, G. W. Jr., A. T. Nguyen, M. Kim, and T. Nguyen. A graph-based approach to api usage adaptation. In OOPSLA '10: Proceedings of the 2010 ACM SIGPLAN International Conference on Systems, Programming, Languages and Applications, page 10 pages, New York, NY, USA, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. T. T. Nguyen, H. A. Nguyen, N. H. Pham, J. M. Al-Kofahi, and T. N. Nguyen.Clone-aware configuration management.In ASE '09: Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering, pages 123--134, Washington, DC, USA, 2009. IEEE Computer Society. ISBN 978-0-7695-3891-4. doi: http://dx.doi.org/10.1109/ASE.2009.90. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. T. T. Nguyen, H. A. Nguyen, N. H. Pham, J. Al-Kofahi, and T. N. Nguyen. Recurring bug fixes in object-oriented programs. In ICSE '10: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering, pages 315--324, New York, NY, USA, 2010. ACM. ISBN 978-1-60558-719-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. W. F. Opdyke and R. E. Johnson. Refactoring: An aid in designing application frameworks and evolving object-oriented systems. In Proceedings of the Symposium on Object Oriented Programming Emphasizing Practical Applications (SOOPPA), 1990.Google ScholarGoogle Scholar
  27. Y. Padioleau, J. Lawall, R. R. Hansen, and G. Muller. Documenting and automating collateral evolutions in linux device drivers. In Eurosys '08: Proceedings of the 3rd ACM SIGOPS/EuroSys European Conference on Computer Systems 2008, pages 247--260, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-013-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. J. H. Perkins, S. Kim, S. Larsen, S. Amarasinghe, J. Bachrach, M. Carbin, C. Pacheco, F. Sherwood, S. Sidiroglou, G. Sullivan, W.-F. Wong, Y. Zibin, M. D. Ernst, and M. Rinard. Automatically patching errors in deployed software. In SOSP '09: Proceedings of the ACM SIGOPS 22nd symposium on Operating systems principles, pages 87--102, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-752-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. M. Toomim, A. Begel, and S. L. Graham. Managing duplicated code with linked editing. In VLHCC '04: Proceedings of the 2004 IEEE Symposium on Visual Languages - Human Centric Computing, pages 173--180, Washington, DC, USA, 2004. IEEE Computer Society. ISBN 0-7803-8696-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. E. Visser. Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. Domain-Specific Program Generation, 3016:216--238, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  31. W. Weimer, T. Nguyen, C. Le Goues, and S. Forrest. Automatically finding patches using genetic programming. In ICSE '09: Proceedings of the 31st International Conference on Software Engineering, pages 364--374, Washington, DC, USA, 2009. IEEE Computer Society. ISBN 978-1--4244-3453-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. W. Yang. Identifying syntactic differences between two programs. Software -- Practice & Experience, 21(7):739--755, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Systematic editing: generating program transformations from an example

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 6
      PLDI '11
      June 2011
      652 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1993316
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2011
        668 pages
        ISBN:9781450306638
        DOI:10.1145/1993498
        • General Chair:
        • Mary Hall,
        • Program Chair:
        • David Padua

      Copyright © 2011 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 4 June 2011

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!