stud udents ents eli kfir daniel lemel supervis pervisor
play

Stud udents ents : Eli Kfir, Daniel Lemel Supervis pervisor or - PowerPoint PPT Presentation

June 27, 2010 Stud udents ents : Eli Kfir, Daniel Lemel Supervis pervisor or : Ran Ettinger Co Code re refact ctoring ring [from Wikipedi dia] is the process of changing a computer program's source code without modifying its


  1. June 27, 2010 Stud udents ents : Eli Kfir, Daniel Lemel Supervis pervisor or : Ran Ettinger

  2.  Co Code re refact ctoring ring [from Wikipedi dia] ◦ is the process of changing a computer program's source code without modifying its external functional behavior in order to improve some of the nonfunctional attributes of the software. ◦ Advantages include improved code readability and reduced complexity to improve the maintainability of the source code, as well as a more expressive internal architecture or object model to improve extensibility.  In our project we have built an advanced refactoring tool - Separate Query from Modifier (SQfM). 2

  3.  http://www.refactoring.com/catalog/separa teQueryFromModifier.html  http://sourcemaking.com/refactoring/sepa rate-query-from-modifier  http://t2.technion.ac.il/~selikfir 3

  4. public int f(…) { globalVar = …; return …; } public void f(…) { public int f(…) { …; …; globalVar = …; return …; } } 4

  5.  Implemented a prototype SQfM tool - split method which returns information and also change an object’s state into 2 separate methods: ◦ Two algorithms:  Modifier before query.  Query before modifier. ◦ Fit the tool to official refactoring standards. ◦ Implement some pre conditions.  Improve previous semester project code – Replace Temp with Query (with all the above). 5

  6. Replace Return Values with Temp Invoke full Replace Temp with Query Prepare the remaining original statements to be extracted Extract Original Method to Modifier Rearrange the Original Method to be: Call Modifier and Return the Query Inline Original Method 6

  7. Replace Return Values with Temp Invoke Replace Temp with Query without Inline Temp Prepare the remaining original statements to be extracted Extract Original Method to Modifier without Query’s Result Rearrange the Original Method to be: Call Query, Call Modifier and Return Result Inline Original Method 7

  8.  The selection is a method name.  Original method is a query and a modifier.  Query/Modifier name inserted by the user has not already exists.  The Query created by RTwQ has no side effects  Modifier is really modify any object. 8

  9.  Inline method limitations: ◦ While ((a = f(x)) >5 ) {…} – Inline method doesn’t inline f(x) right .  WALA limitations: ◦ Works with the file itself (cannot work with a working copy)  RTwQ limitations: ◦ The method need to be called from Main. ◦ Generate Query with side effect. ◦ Inline temp bugs – poor pre condition of the tool. (Inline the temp even it changes the behavior of the program.  Blocks: ◦ Statement of “for/while…” commands must be in form of a block.  Pre Conditions: ◦ Check only names in current file.  Modifier before Query: ◦ Current implementation cannot successfully deals with this case. 9

  10.  Incr creme ementa ntal ap approac ach o Each iteration starts with analysis and design, then writing the code, testing and fixing any bugs found.  Build d 1 1 (Week 8) o Understand the SQfM algorithm designed for limited programming language, and adjust it to Java. Implement a limited version of the tool.  Build d 2 2 (Week 14 14) ) – do as many things gs as time allows o Advance the tool and remove some limitations: o Redesign the project code. o Adjust our code and RTwQ to Eclipse Refactoring standards. (wizard, preview, etc) o Implement some preconditions. o Internal and external documentation. o Empirical evaluation. 10

  11. The End 11

Recommend


More recommend