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

stud udents ents eli kfir daniel lemel supervis pervisor
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

: Eli Kfir, Daniel Lemel Stud udents ents : Ran Ettinger Supervis pervisor

  • r

June 27, 2010

slide-2
SLIDE 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

  • rder 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

  • bject model to improve extensibility.

 In our project we have built an advanced

refactoring tool - Separate Query from Modifier (SQfM).

2
slide-3
SLIDE 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
slide-4
SLIDE 4 4

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

slide-5
SLIDE 5

 Implemented a prototype SQfM tool - split method

which returns information and also change an

  • bject’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
slide-6
SLIDE 6

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

6
slide-7
SLIDE 7

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

7
slide-8
SLIDE 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
slide-9
SLIDE 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
slide-10
SLIDE 10

 Incr

creme ementa ntal ap approac ach

  • Each iteration starts with analysis and design, then

writing the code, testing and fixing any bugs found.

 Build

d 1 1 (Week 8)

  • 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

  • Advance the tool and remove some limitations:
  • Redesign the project code.
  • Adjust our code and RTwQ to Eclipse Refactoring
  • standards. (wizard, preview, etc)
  • Implement some preconditions.
  • Internal and external documentation.
  • Empirical evaluation.
10
slide-11
SLIDE 11

The End

11