330 likes | 416 Views
ECE 750 Topic 8. Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory July 29, 2004 Presented by Shimin Li ECE750 University of waterloo. Paper Overview. Contents: Overview. Roughly five parts:
E N D
ECE 750 Topic 8 Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory July 29, 2004 Presented by Shimin Li ECE750University of waterloo
Contents: Overview Roughly five parts: • Introduction • Overview of Refactorings • Examples of Evolving Applications • Lessons Learned from experiments • Related work and Conclusion
Contents: Detail • Introductio • Automate design level changes of source code • Preserve behavior
Contents: Detail • Overview of Refactorings • Definition of refactoring • Enabling conditions for refactorings • Ensure refactorings preserve behavior • Classification of object-oriented refactorings • Schema refactorings • Pattern refectorings • Language-specific refactorings
Contents: Detail • Examples of Evolving Applications • Why these examples have been chosen • Evolving CIM Works • Version 2 to version 4 • Nine steps, 81 refactorings, 486 lines of code modified • Evolving CMU’s AUIS • Version 6.3 to version 8 • Five steps, approximately 800 refactorings, 14K lines of code modified
Contents: Detail • Lessons Learned from experiments • Refactoring benefits • Refactoring limitations • Future research • Implication for Java
Related Work • Bergstein: Object-preserving class transformations • Lieberherr: Object-extending class transformations • In the Demeter OO software environment • Opdyke: Refactoring definition • Refactorings were inspired by • Banerjee and Kim: Schema evolutions • Johnson and Foote: Design principles • UIUC Choices operating system • L. Tokuda: Refactorings implementation for C++ • D. Roberts: Refactorings implementation for Smalltalk and design criteria for transformation tools • Pree: Hot spot meta patterns
Future Work • Granularity of transformation • Larger grain refactorings? • Program families • How to transform a file used by multiple programs • How to cope with different pre-processed versions of a single C++ file • Integration with other tools • e.g. RationalRose, IDE
Contributions and Novelties • Implemented a set of refactorings • Experimental studies • Showed refactorings can scale and useful on large, real-world applications • Revealed the benefits, limitations and research problems
What I like • Refactoring • Manipulate code in a safe environment • Recreate s situation where evolution is possible • Help to understand existing code • The paper • Clear and concise • Helpful diagrams • Two meaningful examples
What I don’t like • Refactoring • It’s hard to detect if a program needs to be refactored • Refactorings depends on a specific language and compiler • May slow down the execution • The Paper • Lack of explanation of refactorings and their enabling conditions
Question 1 What is refactoring?
Answer 1 Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. – Martin Fowler
Question 2 How does refactorings preserve behavior?
Answer 2 Identify and satisfy a list of enabling conditions for each refactorings(i.e. pre-conditions).
Question 3 Explain the benefits of refactoring.
Answer 3 • Automating design change • Reduce testing • Simpler design • Validation assistance • Ease of exploration • Re-use existing software
Question 4 Explain the problems that the current refactoring technique is facing.
Answer 4 • Refactoring is risky(source code changing may introduce subtle bugs) • Refactorings are dependent on a specific language and compiler(preprocessor directives) • Program families • Source codes have to be accessible • Conservative enabling conditions(if it is too conservative, the transformation might be useless) • Automated checking of enabling conditions
Question 5 What are the prerequisites for a programmer to refactor a program properly?
Answer 5 • The programmer has to know what the program does and how it is structureed • Know what he wants to change and how it can be completed • Know what a particular refactoring does and what are the enabling conditions
Question 6 What problems do program families cause in refactoring?
Answer 6 When transforming a file used by more than one program, it is desirable for the transformation system to check enabling conditions for all programs in which use that file. Otherwise, a file might be transformed safely for one program while causing another program which uses the same file to break.
Question 7 What features of Java make its refactorings have easier implementations than C++?
Answer 7 • NO preprocessor • Not use makefile • Code placement is simplified since methods are stores in a file belongs to the class • No free-floating procedures
Question 8 Discuss the possible practical improvement of refactorings.
Answer 8 • Specify refactorings in a language-independent manner • Apply refactorings at higher levels of abstraction • Integrate refactoring with other tools • Automatically determine where and what refactorings should be applied • Solve program families problem
Question 9 Discuss the connections between AOP and Refactoring.
Answer 9 • AOP is a tool for expressing code in a structured form • Refactoring is a tool changing the structure of existing code, hopefully to improve it • In some case may achieve a better refactoring using AOP • AOP can be used on either existing or new code • Refactoring only can be used on existing code • AOP might reduce the chance of refactoring?
Question 10 How can we determine where and why refactorings should be applied?
Answer 10 • Identify bad smells • Using Logic Meta Programming • Other method? • Future automatic tool