Upload
marcel-bruch
View
1.704
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
Eclipse Code Recommenders
“IDE 2.0” Collective Intelligence in Software DevelopmentLeveraging the Wisdom of the Crowds
Marcel Bruch
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
INTELLIGENT CODE COMPLETION“Other developers frequently bought used the following methods…”
Code Completion…
What does the developer need, i.e., which methods should the code completion present to the user?
All 164 Methods of Text ?
JButton? 381 Methods.
Code Completion…
What does the developer need, i.e., which methods should the code completion present to the user?
Intelligent Code Completion
… or just the three missing ones?
Eclipse Code Recommenders
Why just one when you can have templates…
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>…
How it works – in a nutshell…
How it works – in a nutshell…
Observation Recommendations
USAGE-DRIVEN JAVADOCS“What do Developers Ultimately buy override after extending this class?”
Some Facts About TheDocumentation of Overridable Methods
623
2074overridable
overridden
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
What documentation would you expect when subclassing a Dialog?
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?
What Code Completion offers…
Which of the 56 methods should we override?
What You Need…
Method-level Subclassing Directives
This way, or that way? Subclassing Patterns for ViewerSorter
How it works? Clustering in a nutshell
http://upload.wikimedia.org/wikipedia/en/2/29/Bernoulli-Mixture-Model.gif
SMART BUG DETECTION – DRIVEN BY REAL USAGES
“The good ones in the potty, the bad ones in… the problem view.”
What’s wrong with this code?
At runtime your error log shows…
An error has occurred. See error log for more details. org.eclipse.core.runtime.AssertionFailedException
null argument:
At runtime your error log shows…
So what have we missed?
If all of your colleagues do it – why don’t you?
How it works – a conceptual view
That’s “strange”
How it works – a conceptual view
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
Find your bugs… during development!
Find your bugs… during development!
CODE SEARCH ENGINES – LIFT OFF!“Why is Google Codesearch not ‘google for code search’? ”
Navigating the API jungle…
How do I get an IStatusLineManager?
When asking Google Codesearch
No IDEintegration
Manual query creation
Text-basedretrieval
Ignores prior knowledge
Code Example Recommender
Query
Code Example Recommender
Code Example Recommender
LEVERAGING USER FEEDBACK TO IMPROVE CODE SEARCH ENGINES
“Why is Google Codesearch not ‘google for code search’? ”
Leveraging User Feedback
42
...
...
...
...
Refine the ranking based on feedback
Leveraging User Feedback
44
1
3
2
2
3
1
Support Vector MachineSkipped
SVMRank
WHAT CAUSEDTHAT STACKTRACE?
Stackoverflow.com – Reloaded!
So far we have…
Usage-Driven JavadocsIntelligent Code Completion
Code Example Recommender Smart Bug Dectection
But what if you get this?
Debugging – the old way
Debugging – the old way
But more often we get…
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)
Having a central exception repository
How about stacktraces.org?
LAST.FM 4 ECLIPSE“IDE 2.0? Leveraging the wisdom of the (Eclipse) community…”
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>…
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>…
Leveraging your IDE’s build environment
framework indication
object usage
selected proposals
project environment
context
WRAP UP“I’ve seen much but why do you call it IDE 2.0 ?”
From IDE 1.0 to IDE 2.0
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…
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
…
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/
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
Q & A
Summary
Usage-Driven JavadocsIntelligent Code Completion
Code Example Recommender Smart Bug Dectection
Affiliation
Prof. Dr. Mira MeziniSoftware Technology GroupFachbereich InformatikTechnische Universität Darmstadt