the futur e of programming en vironments past

19
The Future of Programming Environments Andreas Zeller Saarland University Programming Environments Past of programming environments A Tool Set Tools evolve

Upload: others

Post on 26-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

The Future of

Programming Environments

Andreas Zeller

Saarland University

Programming Environments

Past of

programming environments

A Tool Set Tools evolve

Tools integrate Tools work together

Tools work together

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs Changes

Changes

12

Programmers who changed this function

also changed…

13

Eclipse Preferences

Your task – extend Eclipse with a new preference:

14

Preference Code

Preferences are stored in the field fkeys[]:

What else do you need to change?

15

Eclipse Code

27,000files

20,000classes

200,000methods

What else do you need to change?

12,000 non-Java

16

EROSEfunded by IBM Eclipse Innovation Grant

Laser 2006 – Summer School on Software Engineering

CVS Version Archive

2003-02-19 (aweinand): fixed #13332

createGeneralPage()createTextComparePage()fKeys[]initDefaults()buildnotes_compare.htmlPatchMessages.propertiesplugin.properties

18

Mining Associations

#42 fKeys[], initDefaults(), …, plugin.properties, …

#752 fKeys[], initDefaults(), …, plugin.properties, …

#9872 fKeys[], initDefaults(), …, plugin.properties, …

#11386 fKeys[], initDefaults(), …

#20814 fKeys[], initDefaults(), …, plugin.properties, …

#30989 fKeys[], initDefaults(), …, plugin.properties, …

#41999 fKeys[], initDefaults(), …, plugin.properties, …

#47423 fKeys[], initDefaults(), …, plugin.properties, …

19

Mining Associations

#42 fKeys[], initDefaults(), …, plugin.properties, …

#752 fKeys[], initDefaults(), …, plugin.properties, …

#9872 fKeys[], initDefaults(), …, plugin.properties, …

#11386 fKeys[], initDefaults(), …

#20814 fKeys[], initDefaults(), …, plugin.properties, …

#30989 fKeys[], initDefaults(), …, plugin.properties, …

#41999 fKeys[], initDefaults(), …, plugin.properties, …

#47423 fKeys[], initDefaults(), …, plugin.properties, …

{fKeys[], initDefaults()} ⇒ {plugin.properties}

Support 7, Confidence 7/8 = 0.875

20

Classical Data Mining

Classical association mining finds all rules:

• Helpful in understanding general patterns

• Requires high support thresholds

• Takes time to compute (3 days and more)

21

Mining on Demand

Alternative – mine only matching rules:

• Mine only rules related to the situation!!,

i.e. ! ⇒ X

• Mine only rules which have a singleton as consequent, i.e. ! ⇒ {x}

Average runtime of a query: 0.5 seconds

22

Evaluation

• The programmer has changed one entity.Can eROSE suggest related entities?

• Evaluation using last 1,000 transactionsof eight open-source CVS repositories

• Training: all transactions before evaluation

23

Precision vs. RecallWhat EROSE finds What it should find

False positives False negativesCorrect prediction

High precision = returned entities are relevant = few false positivesHigh recall = relevant entities are returned = few false negatives

24

ResultsEntities Files

Recall Precision Top 3 Recall Precision Top 3

Eclipse 0.15 0.26 0.53 0.17 0.26 0.54

GCC 0.28 0.39 0.89 0.44 0.42 0.87

GIMP 0.12 0.25 0.91 0.27 0.26 0.90

JBOSS 0.16 0.38 0.69 0.25 0.37 0.64

JEDIT 0.07 0.16 0.52 0.25 0.22 0.68

KOFFICE 0.08 0.17 0.46 0.24 0.26 0.67

POSTGRES 0.13 0.23 0.59 0.23 0.24 0.68

PYTHON 0.14 0.24 0.51 0.24 0.36 0.60

Average 0.15 0.26 0.64 0.26 0.30 0.70

25

ResultsEntities Files

Recall Precision Top 3 Recall Precision Top 3

Eclipse 0.15 0.26 0.53 0.17 0.26 0.54

GCC 0.28 0.39 0.89 0.44 0.42 0.87

GIMP 0.12 0.25 0.91 0.27 0.26 0.90

JBOSS 0.16 0.38 0.69 0.25 0.37 0.64

JEDIT 0.07 0.16 0.52 0.25 0.22 0.68

KOFFICE 0.08 0.17 0.46 0.24 0.26 0.67

POSTGRE 0.13 0.23 0.59 0.23 0.24 0.68

PYTHON 0.14 0.24 0.51 0.24 0.36 0.60

Average 0.15 0.26 0.64 0.26 0.30 0.70

• eROSE predicts 15% of all changed entities(files: 26%)

• In 64% of all transactions, eROSE’s topmost three suggestions contain a changed entity(files: 70%)

Changes

27

Code Changes

From: Brian Kahne <[email protected]>

To: DDD Bug Report Address <[email protected]>

Subject: Problem with DDD and GDB 4.17

When using DDD with GDB 4.16, the run command

correctly uses any prior command-line arguments, or

the value of "set args". However, when I switched to

GDB 4.17, this no longer worked: If I entered a run

command in the console window, the prior command-

line options would be lost. [...]28

Wie finden wirdie alternative Welt?

Version Di!erences

Old version

Program worksNew version

Program fails

Causes

29

What was Changed

$ diff -r gdb-4.16 gdb-4.17

diff -r gdb-4.16/COPYING gdb-4.17/COPYING

5c5

< 675 Mass Ave, Cambridge, MA 02139, USA

---

> 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

282c282

< Appendix: How to Apply These Terms to Your New Programs

---

> How to Apply These Terms to Your New Programs

…and so on for 178,200 lines (8,721 locations)

General Plan

• Decompose diff into changes per location (= 8,721 individual changes)

• Apply subset of changes, using PATCH

• Reconstruct GDB; build errors mean unresolved test outcome

• Test GDB and return outcome

• Delta debugging narrows down difference

30

31

Isolating Changes

1

10

100

1000

10000

100000

0 50 100 150 200 250 300

Ch

an

ge

s le

ft

Tests executed

Delta Debugging Log

GDB with ddmin algorithm... with dd algorithm

... plus scope information

• Result after 98 tests (= 1 hour)

32

The Failure Cause

diff -r gdb-4.16/gdb/infcmd.c gdb-4.17/gdb/infcmd.c

1239c1278

< "Set arguments to give program being debugged when it is

started.\n

---

> "Set argument list to give program being debugged when

it is started.\n

• Documentation becomes GDB output

• DDD expects Arguments,but GDB outputs Argument list

33

DDChange

Changes

Code Tests

Bugs Changes Bugs Changes

Map bugs to code locations

Eclipse Bugs

Eclipse Imports

import org.eclipse.jdt.internal.compiler.lookup.*;

import org.eclipse.jdt.internal.compiler.*;

import org.eclipse.jdt.internal.compiler.ast.*;

import org.eclipse.jdt.internal.compiler.util.*;

...

import org.eclipse.pde.core.*;

import org.eclipse.jface.wizard.*;

import org.eclipse.ui.*;

14% of all components importing uishow a post-release defect

71% of all components importing compilershow a post-release defect

Joint work with Adrian Schröter • Tom Zimmermann

Eclipse Imports

Correlation with failure

Correlation with success

import org.eclipse.jdt.internal.compiler.lookup.*;

import org.eclipse.jdt.internal.compiler.*;

import org.eclipse.jdt.internal.compiler.ast.*;

import org.eclipse.jdt.internal.compiler.util.*;

...

import org.eclipse.pde.core.*;

import org.eclipse.jface.wizard.*;

import org.eclipse.ui.*;

Eclipse Imports

Correlation with failure

Correlation with success

Compiler code • Internals • Core functionality

GUI code • Standard Java classes • Help texts

Predictingfailure-prone packages

• Relate defect density to imports

• Base: Eclipse bug and version databases (Bugzilla, CVS)

• 36% of all packages had post-release defects

• Prediction using support vector machine

Prediction

~300 P

acka

ges

10%

90%

defect no defect

top 5%

Where do bugs come from?

Is it the Developers?

Does experience matter?

Bug density correlates with

experience!

How about Testing?

Does code coverage predict

bug density?

Yes – the more tests, the more bugs!

History?

I found lots of bugs here. Will there be more?

Yes!

How about Metrics?

Do code metrics predict bug

density?

Yes! (but only with history)

Problem Domains?

Do imports predict bug

density?

Yes! (but only with history)

What makescode buggy

in the first place?

Bugs Changes

• contain full record of project history

• maintained via programming environments

• automatic maintenance and access

• freely accessible in open source projects

Software Archives

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs Changes

Code Profiles

“Which modules should I test most?”

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs ChangesEffort

Code

“How long will it take to fix this bug?”

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs Changes Chatse-mail

Specs Code

“This requirement is risky”

Empirical Studies

• Compares what we believewith what we observe

• Standard practice in modern science

• Recent addition to software engineering

Empirical SE

Measure dataBuild model that explains the data

Use model for predictions

Test predictive power

Predicting Effort

Rosenberg, L. and Hyatt, L. “Developing An Effective Metrics Program”European Space Agency Software Assurance Symposium, Netherlands, March, 1996

Predicting Maintainability

171 − 5.2 ln(V ) − 0.23V (G) − 16.2 ln(L)

+50 sin

(√

2.4C

)

Maintainability =

Size of vocabulary McCabe complexity

code linesPercentage of comment lines

Oman, P. & Hagemeister, J. "Constructing and Testing of Polynomials Predicting Software Maintainability." Journal of Systems and Software 24, 3 (March 1994): 251–266.

Obtaining Data

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Eclipse Bugs

Studies

Rosenberg, L. and Hyatt, L. “Developing An Effective Metrics Program”European Space Agency Software Assurance Symposium, Netherlands, March, 1996

Make thisActionable!

“Road map”!

Assistance

Future environments will

• mine patterns from program + process

• apply rules to make predictions

• provide assistance in all development decisions

• adapt advice to project history

Web 2.0

Usability

Economy

Design

StandardizationRemixability

Convergence

ParticipationWidgets

CollaborationSharing

Pagerank

User Centered

Perpetual Beta

Trust

FOAF

Six Degrees

XFN

Aggregators

VC

Pay Per Click

Modularity

Ruby on Rails

SyndicationSOAP

REST

SEO

IM

XHTML

Accessibility

Semantic

XML

UMTS

Videocasting Podcasting

SVGAtom

Browser

OpenID

Wikis

Simplicity

Joy of Use

AJAX

The Long Tail

Affiliation

CSS

Web Standards

MicroformatsDataDriven

OpenAPIs RSS

Mobility

VideoAudio

Blogs

Social SoftwareRecommendation

Folksonomy

Empirical SE 2.0Web 2.0

Usability

EconomyRemixability

Participation

Collaboration Perpetual Beta

Trust

Wikis

Simplicity

Joy of Use

The Long TailDataDriven

Social SoftwareRecommendation

Challenges

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Program Data

Process Data

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Deductive Reasoning

Inductive Reasoning

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Bugs ChangesEffort Navigation Chatse-mail

Models Specs Code Traces Profiles Tests

Summary