Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Languages and Human-Centric Computing September 9, 2004 Managing Duplicated Code with Linked Editing Michael Toomim, Andrew Begel and Susan L. Graham.

Similar presentations


Presentation on theme: "Visual Languages and Human-Centric Computing September 9, 2004 Managing Duplicated Code with Linked Editing Michael Toomim, Andrew Begel and Susan L. Graham."— Presentation transcript:

1 Visual Languages and Human-Centric Computing September 9, 2004 Managing Duplicated Code with Linked Editing Michael Toomim, Andrew Begel and Susan L. Graham Harmonia Research Group University of California at Berkeley

2 2 Duplicated Code is Bad

3 3 Extreme Programming Explained – Kent Beck “ The [simplest] system must contain no duplicate code ”

4 4 “ #1 in the stink parade is – Martin Fowler Refactoring duplicated code. ”

5 5 – Andrew Hunt and David Thomas “ DRY: Don’t Repeat Yourself ” The Pragmatic Programmer

6 6 Duplicated Code is Bad Causes verbosity/bloat, viscous edits, inconsistency, difficult maintainability But it will always exist Linked Editing makes it easy to work with

7 7 Abstraction. How do they manage it? The solution to duplication.

8 8 50 Years of Abstraction Functions, macros, objects, templates, aspects, generative programs, traits… –Language abstractions since Fortran Tools to help programmers find and refactor duplication –16 duplication finding algorithms published in last 14 years –Refactoring supported in mainstream IDE’s

9 9 Duplication is Everywhere [1] Baker (1995) 19% duplicated 1 X Window System: [2] Antoniol (2002) 20% duplicated 2 Linux Kernel: [3] Kamiya (2002) 25% duplicated 3 Sun Java JDK: [4] Ducasse (1999) 60% duplicated 4 Private payroll server:

10 10 Why We Duplicate Code Abstractions have usability problems –Difficult to create –Can make code worse –Can be impossible to express Programmers have no other alternative

11 11 Solution: Linked Editing Editor provides enhanced interaction: –Visualization, navigation, simultaneous editing of duplication Addresses the problems of duplication without the costs of abstraction Implemented in editor called Codelink

12 12 User Study 13 subjects (novice to expert) –Programming tasks with both Codelink and functional abstraction Measurements: –Time to abstract or link duplicated code –Benefits of the abstraction or link during programming tasks (rated by subjects)

13 13 Results: Creating a Link 13:06Mean abstraction time:13:06 minutes 22Mean link time:00:22 seconds ! Linking code took… 2.7% …of the abstraction time

14 14 Working with Linked Code Much Better Moderately Better Slightly Better Same Slightly Worse Maintainability Understandability Changeability Speed Effort Rated benefits of abstraction and Codelink over duplicated code

15 15 Linked Editing Worked Provided benefits comparable to abstraction …but required very little programming time

16 16 Future Research Directions Improved difference analysis Integrate with refactoring systems –Find duplicated code automatically –Refactor linked code automatically Linked Editing of other digital documents –Spreadsheets, web sites, music scores, these PowerPoint slides…

17 17 Contributions Linked Editing: –Manages duplicated code effectively –Easy to learn and use –Applicable in many domains

18 18 Michael Toomim: toomim@cs.berkeley.edu


Download ppt "Visual Languages and Human-Centric Computing September 9, 2004 Managing Duplicated Code with Linked Editing Michael Toomim, Andrew Begel and Susan L. Graham."

Similar presentations


Ads by Google