66
Eclipse Code Recommenders “IDE 2.0” Collective Intelligence in Software Development Leveraging the Wisdom of the Crowds Marcel Bruch

2010 06-24 karlsruher entwicklertag

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 2010 06-24 karlsruher entwicklertag

Eclipse Code Recommenders

“IDE 2.0” Collective Intelligence in Software DevelopmentLeveraging the Wisdom of the Crowds

Marcel Bruch

Page 2: 2010 06-24 karlsruher entwicklertag
Page 3: 2010 06-24 karlsruher entwicklertag

Developers Who Called “new Text()” Method Also Called

What Do Developers Ultimately Override After Extending This Class?

setText()

89%

addListener()

53%

setLayout()

99%

setFont()

35%

100 % overwrotePreferencePage.createContents()

96 % overwrotePreferencePage.performOk()

5 % overwrotePreferencePage.performCancel()

Eclipse Code Recommenders – do what most people do! (where appropriate)

CodeAll Frameworks

Eclipse Code Recommenders

Code

Page 4: 2010 06-24 karlsruher entwicklertag

INTELLIGENT CODE COMPLETION“Other developers frequently bought used the following methods…”

Page 5: 2010 06-24 karlsruher entwicklertag

Code Completion…

What does the developer need, i.e., which methods should the code completion present to the user?

Page 6: 2010 06-24 karlsruher entwicklertag

All 164 Methods of Text ?

Page 7: 2010 06-24 karlsruher entwicklertag

JButton? 381 Methods.

Page 8: 2010 06-24 karlsruher entwicklertag

Code Completion…

What does the developer need, i.e., which methods should the code completion present to the user?

Page 9: 2010 06-24 karlsruher entwicklertag

Intelligent Code Completion

… or just the three missing ones?

Page 10: 2010 06-24 karlsruher entwicklertag

Eclipse Code Recommenders

Page 11: 2010 06-24 karlsruher entwicklertag

Why just one when you can have templates…

Page 12: 2010 06-24 karlsruher entwicklertag

How it works – in a nutshell…

Framework

FrameworkInstantiation 1 … Framework

Instantiation n

Mining

RecommenderModel

If you extend A,you should

call B.c

extract facts about how the framework is reused

<extends:A><overrides:A.d>

<calls:B.c>…

<extends:A><overrides:A.b>

<calls:B.c>…

Page 13: 2010 06-24 karlsruher entwicklertag

How it works – in a nutshell…

Page 14: 2010 06-24 karlsruher entwicklertag

How it works – in a nutshell…

Observation Recommendations

Page 15: 2010 06-24 karlsruher entwicklertag

USAGE-DRIVEN JAVADOCS“What do Developers Ultimately buy override after extending this class?”

Page 16: 2010 06-24 karlsruher entwicklertag

Some Facts About TheDocumentation of Overridable Methods

623

2074overridable

overridden

Page 17: 2010 06-24 karlsruher entwicklertag

What Clients Do With Your API…

overridden

documented*155

623

*: documented as overridable by using phrases like “clients may/should/must override/extend this method”

478

Page 18: 2010 06-24 karlsruher entwicklertag

What documentation would you expect when subclassing a Dialog?

Page 19: 2010 06-24 karlsruher entwicklertag

What Javadoc gives to you…

A dialog is a specialized window used for narrow-focused communication with the user.

Dialogs are usually modal. Consequently, it is generally bad practice to open a dialog without a parent. A modal dialog without a parent is not prevented from disappearing behind the application's other windows, making it very confusing for the user.

If there is more than one modal dialog is open the second one should be parented off of the shell of the first one otherwise it is possible that the OS will give focus to the first dialog potentially blocking the UI.

But what are the hot-spots of Dialog?

Page 20: 2010 06-24 karlsruher entwicklertag

What Code Completion offers…

Which of the 56 methods should we override?

Page 21: 2010 06-24 karlsruher entwicklertag

What You Need…

Page 22: 2010 06-24 karlsruher entwicklertag

Method-level Subclassing Directives

Page 23: 2010 06-24 karlsruher entwicklertag

This way, or that way? Subclassing Patterns for ViewerSorter

Page 24: 2010 06-24 karlsruher entwicklertag

How it works? Clustering in a nutshell

http://upload.wikimedia.org/wikipedia/en/2/29/Bernoulli-Mixture-Model.gif

Page 25: 2010 06-24 karlsruher entwicklertag

SMART BUG DETECTION – DRIVEN BY REAL USAGES

“The good ones in the potty, the bad ones in… the problem view.”

Page 26: 2010 06-24 karlsruher entwicklertag

What’s wrong with this code?

Page 27: 2010 06-24 karlsruher entwicklertag

At runtime your error log shows…

An error has occurred. See error log for more details. org.eclipse.core.runtime.AssertionFailedException

null argument:

Page 28: 2010 06-24 karlsruher entwicklertag

At runtime your error log shows…

So what have we missed?

Page 29: 2010 06-24 karlsruher entwicklertag

If all of your colleagues do it – why don’t you?

Page 30: 2010 06-24 karlsruher entwicklertag

How it works – a conceptual view

That’s “strange”

Page 31: 2010 06-24 karlsruher entwicklertag

How it works – a conceptual view

Page 32: 2010 06-24 karlsruher entwicklertag

Just one formula…

x = {observed method calls on a variable}

E(x) = {exact similar usages for variables of type x in the code base}

A(x) = {almost similar usages, i.e., x+1 method call}

|)(||)(|

|)(|1)(

xAxE

xExsstrangenes

Page 33: 2010 06-24 karlsruher entwicklertag

Find your bugs… during development!

Page 34: 2010 06-24 karlsruher entwicklertag

Find your bugs… during development!

Page 35: 2010 06-24 karlsruher entwicklertag

CODE SEARCH ENGINES – LIFT OFF!“Why is Google Codesearch not ‘google for code search’? ”

Page 36: 2010 06-24 karlsruher entwicklertag

Navigating the API jungle…

How do I get an IStatusLineManager?

Page 37: 2010 06-24 karlsruher entwicklertag

When asking Google Codesearch

No IDEintegration

Manual query creation

Text-basedretrieval

Ignores prior knowledge

Page 38: 2010 06-24 karlsruher entwicklertag

Code Example Recommender

Query

Page 39: 2010 06-24 karlsruher entwicklertag

Code Example Recommender

Page 40: 2010 06-24 karlsruher entwicklertag

Code Example Recommender

Page 41: 2010 06-24 karlsruher entwicklertag

LEVERAGING USER FEEDBACK TO IMPROVE CODE SEARCH ENGINES

“Why is Google Codesearch not ‘google for code search’? ”

Page 42: 2010 06-24 karlsruher entwicklertag

Leveraging User Feedback

42

...

...

...

...

Page 43: 2010 06-24 karlsruher entwicklertag

Refine the ranking based on feedback

Page 44: 2010 06-24 karlsruher entwicklertag

Leveraging User Feedback

44

1

3

2

2

3

1

Support Vector MachineSkipped

SVMRank

Page 45: 2010 06-24 karlsruher entwicklertag

WHAT CAUSEDTHAT STACKTRACE?

Stackoverflow.com – Reloaded!

Page 46: 2010 06-24 karlsruher entwicklertag

So far we have…

Usage-Driven JavadocsIntelligent Code Completion

Code Example Recommender Smart Bug Dectection

Page 47: 2010 06-24 karlsruher entwicklertag

But what if you get this?

Page 48: 2010 06-24 karlsruher entwicklertag

Debugging – the old way

Page 49: 2010 06-24 karlsruher entwicklertag

Debugging – the old way

Page 50: 2010 06-24 karlsruher entwicklertag

But more often we get…

Page 51: 2010 06-24 karlsruher entwicklertag

How can we fix that? Don’t stacktraces share some commonalities?

org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:3884) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) at org.eclipse.swt.widgets.Widget.error(Widget.java:463) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:355) at org.eclipse.swt.widgets.ProgressBar.setSelection(ProgressBar.java:317) at org.eclipselabs.cr.stacktraces.demo.ThreadDemo$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:619)

ExceptionType Feature(evaluates identical exception type) Message Similarity Feature

(counts of similar words)

TraceDiff Similarity Feature(counts similar stackframes per trace)

Page 52: 2010 06-24 karlsruher entwicklertag

Having a central exception repository

Page 53: 2010 06-24 karlsruher entwicklertag

How about stacktraces.org?

Page 54: 2010 06-24 karlsruher entwicklertag

LAST.FM 4 ECLIPSE“IDE 2.0? Leveraging the wisdom of the (Eclipse) community…”

Page 55: 2010 06-24 karlsruher entwicklertag

How It Works Today

Framework

FrameworkInstantiation 1 … Framework

Instantiation n

Mining

RecommenderModel

If you extend A,you should

call B.c

extract facts about how the framework is reused

<extends:A><overrides:A.d>

<calls:B.c>…

<extends:A><overrides:A.b>

<calls:B.c>…

Page 56: 2010 06-24 karlsruher entwicklertag

How it Works Tomorrow

Framework

FrameworkInstantiation 1 … Framework

Instantiation n

Mining

RecommenderModel

If you extend A,you should

call B.c

extract facts about how the framework is reused

<extends:A><overrides:A.d>

<calls:B.c>…

<extends:A><overrides:A.b>

<calls:B.c>…

Page 57: 2010 06-24 karlsruher entwicklertag

Leveraging your IDE’s build environment

framework indication

object usage

selected proposals

project environment

context

Page 58: 2010 06-24 karlsruher entwicklertag

WRAP UP“I’ve seen much but why do you call it IDE 2.0 ?”

Page 59: 2010 06-24 karlsruher entwicklertag

From IDE 1.0 to IDE 2.0

Page 60: 2010 06-24 karlsruher entwicklertag

From Web 2.0 to IDE 2.0

Let’s map the Web 2.0 principles to IDE 2.0 to see how this analogy fits:

1. The Web as Platform…

2. Data as “Intel inside”…

3. Harnessing Collective Intelligence…

4. Rich User Experiences…

5. Lightweight Programming Models…

Page 61: 2010 06-24 karlsruher entwicklertag

Milestones

21.03.2009v0.1 Release

01.07.2010v0.1 Example Code

Recommender

01.12.2010Stacktrace

Recommender

01.09.2010Moving to Eclipse.org

01.02.2011v0.1 Last.FM

01.10.2010v0.1 Bugs

Recommender

Page 62: 2010 06-24 karlsruher entwicklertag

Resources

• Contact

• Marcel Bruch [email protected]

• Project homepage

• http://www.stg.tu-darmstadt.de/research/core/

• Download Release “LISBON” (V.0.2.105)

• http://www.stg.tu-darmstadt.de/research/core/download

• Source Code

• http://eclipselabs.org/p/code-recommenders/

Page 63: 2010 06-24 karlsruher entwicklertag

Credits – innumerable hours have spent…

Daniel Staesche

Jan Stolzenburg

Julius Rückert

Minh Hoang Nguyen

Nico Wombacher

Sebastian Ahlfeld

Gary Fritz

Laura Altmüller

Dirk KröhanChristopher Mann

Florian Jakob

Jan KassensJohannes Born

Kristijan Madunic

Mohsen Parisay

Sinem Emeröz

Tjark VandommeleDennis Siebert

Roman Getto

Florian Nöll

Markus Migenda

Paul Schatygin

Sheip Dargutev

Nikolay Shindov

Peter Schroeder Johannes LerchMaik Görtz

Christian KilbDaniel Brandtner

David Kalnischkies

Jan-Michael Heller

Michael KutschkeMichael Novotny

Sascha Nordquist

Sebastian Denel

Sebastian Kasten

Steffen Remus Sebastian Proksch

Dennis Sänger

Boyan Yurukov

Jens KrauseDavid Schuld

Tomasz Kalbarczyk

Daniel Glöckner

Sebastian Wörner

Peter Sinzig

Johannes Kastl

Veronika Kostadinova

Page 64: 2010 06-24 karlsruher entwicklertag

Q & A

Page 65: 2010 06-24 karlsruher entwicklertag

Summary

Usage-Driven JavadocsIntelligent Code Completion

Code Example Recommender Smart Bug Dectection

Page 66: 2010 06-24 karlsruher entwicklertag

Affiliation

Prof. Dr. Mira MeziniSoftware Technology GroupFachbereich InformatikTechnische Universität Darmstadt