ACM Home Page
Please provide us with feedback. Feedback
Challenges of refactoring C programs
Full text PdfPdf (688 KB)
Source International Conference on Software Engineering archive
Proceedings of the International Workshop on Principles of Software Evolution table of contents
Orlando, Florida
SESSION: Session 1 (full technical papers): evolution in source code table of contents
Pages: 6 - 14  
Year of Publication: 2002
ISBN:1-58113-545-9
Authors
Alejandra Garrido  University of Illinois at Urbana-Champaign, Urbana, IL
Ralph Johnson  University of Illinois at Urbana-Champaign, Urbana, IL
Sponsor
SIGSOFT: ACM Special Interest Group on Software Engineering
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 14,   Downloads (12 Months): 77,   Citation Count: 3
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/512035.512039
What is a DOI?

ABSTRACT

Refactoring has become a well-known technique for transforming code in a way that preserves behavior. Refactorings may be applied manually, although manual code manipulation is error prone and cumbersome, so maintainers need tools to make automatic refactorings. There is currently extensive literature on refactoring object-oriented programs and some very good tools for refactoring Smalltalk and Java code. Although there is more code written in C or C++ than in any other language, refactoring tools for C with full support for preprocessor directives have not yet appeared.The C programming language, especially the preprocessor directives that coexist with it, complicates refactorings in different ways as directives are not legal C code and may violate otherwise correct refactorings.Refactoring C poses two major research challenges. On the one hand, as preprocessor directives may violate correctness, new precondition and execution rules must be defined for existing refactorings to preserve behavior. On the other hand, the automated execution of refactorings requires specialized program analysis tools to represent and manipulate preprocessor directives. After studying the area we have found some results to overcome these challenges and make a correct tool for the C language attainable.This paper first discusses the difficulties in refactoring C code with preprocessor directives. It then defines preconditions and execution rules to maintain correctness of refactoring in the presence of macros and conditional directives. Moreover, new refactorings are proposed for macro definitions and conditionals. Lastly, the paper suggests enhancements to program analysis and program representation tools to correctly manipulate preprocessor directives.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
DMS Software Reengineering Toolkit. http://www.semdesigns.com/Products/DMS/DMSToolkit.html
 
3
Ernst, M., Badros, G. and Notkin, D. An Empirical Analysis of C Preprocessor Use. Revision of Technical Report UW-CSE-97-04-06. Dept. of Computer Science and Engineering. Univ. of Washington, Seattle, 1999.
 
4
 
5
 
6
Fowler, M. Crossing Refactoring's Rubicon. http://www.martinfowler.com/articles/refactoringRubicon.html
 
7
Garrido, A. Software Refactoring Applied to C Programming Language. MS Thesis. University of Illinois at Urbana-Champaign, 2000.
8
 
9
IntelliJ IDEA: Java IDE with refactoring support. http://www.intellij.com/idea/
 
10
jFactor home page. http://www.instantiations.com/jfactor/
 
11
 
12
Moose Refactoring Engine. http://scgwiki.iam.unibe.ch:8080/SCG/19
 
13
Ó Cinnéide, M. Automated Application of Design Patterns: a Refactoring Approach. PhD thesis, University of Dublin, Trinity College, 2001.
 
14
 
15
Roberts, D. Eliminating Analysis in Refactoring. PhD Thesis, University of Illinois at Urbana-Champaign, 1999.
 
16
 
17
 
18
 
19
Xref- Technologies - refactoring development tools. http://xref-tech.com/xrefactory/


Collaborative Colleagues:
Alejandra Garrido: colleagues
Ralph Johnson: colleagues