Managing Clones Using Dynamic Change Tracking and Resolution
Michiel de Wit Andy Zaidman Arie van Deursen
Taking over Copy & Paste Replace copy & paste by “clone-aware” operations: Z. A. Mann, IEEE Computer, 2006
• • • •
Move Copy-identical Copy-and-change Copy-once – [ was: paste ] 2
Our Research Questions 1. Are developers willing to alter existing copy and paste habits? 2. In what way can the relations established by using explicit clone operators be used to enforce consistent editing of clones? 3. Will the new operators help reduce problems related to cloning? 3
The CloneBoard Prototype • Eclipse plug-in intercepting copy and paste • Detects & resolves inconsistent changes to clones – Several resolution strategies – User can select strategy – Plug-in offers strategy ranking
• Supports clone navigation – „Hyperlinking‟ clone instances. – Browsing clones by file/project. – Colored clone bars in editors
4
Evaluting Clone Operators • Evaluating CloneBoard‟s – Adequacy: Does it work as expected? – Usability: Is it easy to use / comprehend? – Effectiviness: Does it help in preventing faults?
• “One-group pretest-posttest” design – Seven participants – 5 question pretest – 5 programming assignments • 2hr, edugame RoboCode • Sufficiently complex; no prior knowledge; fun; easy to learn
– 10 question posttest 5
Pretest 1. Personal background 2. Development experience 3. Attitude towards code quality 4. Attitude towards cloning 5. Expectations for a clone management tool
6
Assignment (2 hours) 1. Exploring your robot 2. Extend enemy‟s presentation 3. Improve targeting routines (nearest, weakest, fittest, …) 4. Get closer to your enemy (circle, unpredictable, …) 5. Actually defeat other robots
http://robocode.sourceforge.net/ 7
Monitoring Copy-Paste
8
Conflict Resolutions Applied
9
Posttest I. II.
Complexity of the assignment Correspondence to coding habits of pre-3
III. Apprciation of CloneBoard‟s user interface IV. Clarity of CloneBoard‟s resolution window V. Frequency of resolution strategies VI. Usefulness of resolution strategies VII. Correspondence to expectations (pretest-5) VIII. CloneBoard Usability IX. Feedback on experiment 10
Resolution Strategy Rating (V/VI)
11
Having worked with CloneBoard ... • Respondents are a little less negative and still believe CloneBoard will save time (c, d) • Repondents dislike the disruptive nature of clone conflict resolution (b, e) • Respondents have weakened their belief that CloneBoard can help with “real” problems (a, f) 5 4 3,7
3,6
3 2,9
3,0
3,3
3,3 2,7
2
2,3
2,6
2,4
2,1
1,9
1
Reduces clone Primarily Will save a lot bugs inconvenient of time
a
b
c
No added value
d
Will use it Does not solve extensively real problems
e
f
Research Questions Revisited • RQ1: Willing to change copy-paste habits? – Adequacy: time saving, added value, could get used to CloneBoard – Usability: usable but pop-up too obtrusive
• RQ2: Can we enforce consistency? – The tool enforces consistent conflict resolution; – Users find enforcement too strict
• RQ3: Will clone operators reduce problems? – Effectiveness: CloneBoard users believe less so 13
Threats to Validity • Construct validity – Experiment affects cloning behavior – Pressure to answer positively
• External validity – – – –
Academic background of subjects Small scale of the case Short duration of the experiment Clone creation versus modification
• Internal validity – CloneBoard may not be bug-free
• Reliability – CloneBoard, RoboCode and all answers are available 14
Contributions • CloneBoard, a downloadable Eclipse plugin for managing copy-paste clones – Clone resolution ranking & selecting – Starting point for further experiments
• Experimental design for evaluating clone management tools • User study with seven developers assessing adequacy, usability, and effectiveness 15
Future Work • Enrich CloneBoard – Less intrusive (user feedback) – Alternative resolution strategies – Clone sharing across developers
• Empirical study on copy-paste behavior in coding • Longitudinal CloneBoard study – Cloning habits of several developers – Longer period (weeks, months) 16
CLONEBOARD in action
http://swerl.tudelft.nl/bin/view/Main/CloneBoard