oopsla ds

33
Managing the Copy-and-Paste Programming Practice in Modern IDEs By Patricia Jablonski Clarkson University OOPSLA Doctoral Symposium October 22, 2007

Upload: patricia-deshane

Post on 06-Jul-2015

256 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: OOPSLA DS

Managing the Copy-and-Paste Programming Practice in Modern IDEs

By

Patricia Jablonski

Clarkson University

OOPSLA Doctoral Symposium

October 22, 2007

Page 2: OOPSLA DS

Managing Copy-and-Paste

Problem

Copy and paste code

Change some variables

But don’t change all instances

So, have an error

Page 3: OOPSLA DS
Page 4: OOPSLA DS
Page 5: OOPSLA DS
Page 6: OOPSLA DS
Page 7: OOPSLA DS
Page 8: OOPSLA DS
Page 9: OOPSLA DS
Page 10: OOPSLA DS
Page 11: OOPSLA DS
Page 12: OOPSLA DS
Page 13: OOPSLA DS
Page 14: OOPSLA DS
Page 15: OOPSLA DS

ERROR!!

Page 16: OOPSLA DS
Page 17: OOPSLA DS
Page 18: OOPSLA DS
Page 19: OOPSLA DS
Page 20: OOPSLA DS
Page 21: OOPSLA DS
Page 22: OOPSLA DS
Page 23: OOPSLA DS
Page 24: OOPSLA DS
Page 25: OOPSLA DS
Page 26: OOPSLA DS

for(i = 1; i < size; i++){ if(array[i] < low) { low = array[i]; }}

Page 27: OOPSLA DS

for(i = 1; i < size; i++){ if(array[i] < low) { low = array[i]; }}

Page 28: OOPSLA DS

for(i = 1; i < size; i++){ if(array[i] < low) { low = array[i]; }}

Page 29: OOPSLA DS

for(i = 1; i < size; i++){ if(array[i] < low) { low = array[i]; }}

Page 30: OOPSLA DS

for(i = 1; i < size; i++){ if(array[i] < low) { low = array[i]; }}

Page 31: OOPSLA DS

Copy-and-Paste Error Detection and Prevention

CnP: Copy-and-Paste Tool

Tracks & highlights copy-pasted statements

Detects & prevents inconsistencies based on inferences of the programmer’s intention

Identifier renaming inconsistencies CReN: Consistent Renaming Tool

Lexical/naming pattern inconsistencies

Type inconsistencies

Page 32: OOPSLA DS

Related Work

Clone detection and removal

Clone tracking tools Codelink, CloneTracker

Error detection tools CP-Miner, DECKARD-based tool

Renaming tools Find & Replace, Rename Refactoring, Linked

Renaming

Page 33: OOPSLA DS

Conclusion

Discussion

How would you evaluate our tool?

How would you improve the tool? Additional features Visualization of clones Programmer’s intention

Questions/Comments