Wissenstransfer 2.0: 

Liest du noch, oder programmierst du schon?
The knowledge transfer company
• Project Lead of Eclipse Code Recommenders
• Eclipse Committer since 2010
• Plug-in Developer for 10 years (Eclipse 2.1)
...
Codetrails at a Glance
• The company behind Eclipse Code Recommenders
• Eclipse RCP Experts & Consultants
• Software Tool ...
About Eclipse Code Recommenders
4
2006 2009 2011
2012 2013 2014
Research
begins
CR
published
CR goes
Eclipse
CR 1.0 

Part...
Awards & Traction
5
2012
• >3.000.000 downloads
Top 20
• Talks at 50+ Democamps, Eclipse Days,
and Java User Groups all ov...
PROBLEM
Problem #1: Knowledge Drain
7
Problem #1: Knowledge Drain
8
Problem #1: Knowledge Drain
9
Software
Problem #2: Continuous Learning
10
A typical developer day
11
Comprehend Task
3 %
Handling Interruptions
20 %
Navigate Code
14 %
Study Code
19 %
Searching We...
How we search
12
What developers look for
13
Question + Answer + Code Example = ✓
A typical developer day
14
Comprehend Task
3 %
Handling Interruptions
20 %
Navigate Code
14 %
Study Code
19 %
Searching We...
If we don’t google…
15
1 of 387 ?
17
Code Completion
Frequency : 100 completions / day
Duration (⌀) : 27 seconds / completion
Sum : 45 minutes / day
9% of t...
Problem
18
Comprehend Task
3 %
Handling Interruptions
20 %
Searching Code
12 %
Navigate Code
14 %
Reading Code
19 %
Readin...
Problem
19
Comprehend Task
3 %
Handling Interruptions
20 %
Searching Code
12 %
Navigate Code
14 %
Reading Code
19 %
Readin...
SOLUTION
„Leveraging the power of the crowds“
Behind every answered question…
21
… there is some code
22
Use the code
23
INTELLIGENT CODE COMPLETION
„Other developers frequently bought used the following methods…“
@Override!
protected Control createDialogArea(final Composite parent) {!
Composite container = (Composite) super.createDia...
All 164 Methods of Text ?
Intelligent Code Completion
What your team really needs to know…
27
Snippet Completion (1)
28
HOW IT WORKS
„Finding the hidden gems in your code“
class Example extends Page {!
Text t;!
!
@Override!
void createContents() {!
t = new Text();!
t.setText(..);!
...!
}!
...!...
31
class Example extends Page {!
Text t;!
...!
!
@Override!
void performOk() {!
t.getText();!
...!
}!
!
}
in:Page.performO...
32
class MyPage extends Page {!
!
Text t;!
@Override!
void createContents() {!
t = new Text();!
t.|<^space>!
}!
...!
}
1 …...
33
1 …1 ?? ?0
in:Page.performOk()
Text.<init>()
Text.getText()
Text.setFont()
...
Text.setText()
01 10 0 …
1 10 0 0 0
… … ...
CALL-CHAIN COMPLETION
“Welcome to the jungle...”
public class MyView extends ViewPart {!
!
public void updateMessage(final String newMessage) {!
!
// How do I get an insta...
What we need...
36
ViewPart
IViewSite
IAc-onBars
IStatusLineManager
getStatusLineManager()
getAc-onbars()
getViewSite()
pu...
SUBWORDS COMPLETION
“BecausePureCamelCaseMatching****s!”
Use speaking names...?
38
When letters become just guidelines...
39I Like?
Source: http://vimeo.com/19369928
EXTENDING API DOCUMENTATION
“Developers who bought overwrote this method typically also overwrote...”
In good documentation we trust...
41
good
/**!
* Rollsback the transaction if any and clears different lists to!
* start w...
Generating high-quality API documentation
42
/**!
* The number of questions.!
*/!
private int numberOfQuestions;!
!
!
/**!...
What people say about JAutodoc...
43
User: Anonymous Rating: 9 2009-08-02 11:32:37
Wow exactly what I needed!
User: Anonym...
How Recommenders is coming to rescue...
44
What documentation would you expect when
subclassing Dialog?
45
package org.eclipse.recommenders.examples.demo;!
!
import ...
What Javadoc gives you...
46
A dialog is a specialized window used for narrow-
focused communication with the user.
!
Dial...
What code completion offers...
47
Which of the 56 methods
should we override?
Recommending method overrides...
48
!
public class MyDialog extends Dialog {!
!
Recommending self-calls
49
public class MyWizard extends Wizard {!
!
! @Override!
public void addPages() {!
!
};
Mining for subclassing patterns
50
!
public class MyViewerSorter extends ViewerComparator {
Mined example code snippets…
51
!
public class MyDialog extends Dialog {!
!
@Override!
protected Control createDialogArea(...
SNIPMATCH
„Stop searching Stackoverflow for code snippets“
Why do you use code templates?
53
Safe time typing
54
<ctrl+space>
<ctrl+space>
{
<ctrl+space>
<ctrl+space>
}
Learning from snippets
55
Eclipse Java Templates
56
42x Java Templates.
35x SWT Templates.
Learning from snippets
57
The rise of code snippet repositories
58
and many more...
Snipmatch
59
Recom
m
enders 2.1
AND IF THERE IS NO CODE TO ANALYZE?
„From code analysis to crowd sourcing“
Being for Software Developers
How 39 million click events make your IDE a smarter place
62
63
The amazon success factors
64
65
How about applying the very same
principles to software development?
So, instead of using the web browser…
66
68
!
!
!
Disclaimer
!
Data sharing is
involved!
!
Not Eclipse anymore!
Crowdsourced Code Completion
Developers that bought used a StringBuilder, typically…
69
A fairly trivial example…
70
Instead saying…
71
What if we‘d just count calls...?
72
Codetrails Connect Community Edition,

Install from http://www.codetrails.com/connect
!
void ctor() {	
!
	 	 List l = new A…	
}	
Crowdsourced Constructor Completion
73
What is the mostly likely completion a
d...
74
1 out of 302
!
void ctor() {	
!
	 	 List l = new A…	
}	
Use (costly) subtype checks
75
Codetrails Completion Tweaks for Eclipse,

Insta...
Crowdsourcing constructor completions...?
76
It learns from you. From the very 1st moment.
Codetrails Connect Community Ed...
public class MyDialog extends Dialog {	
!
|	
!
!
Crowdsourcing override completions...?
77
!
void quickfix() {	
!
	 	 List l = new A	
}	
How about fixing quick-fix?
78
Not fixed yet. But could be easily - when you st...
39.000.000 clicks for a smarter IDE
79
Read more (October 2013)

http://www.codetrails.com/blog/powered-33-million-code-co...
56.424 crowdsourced completion events
80
org.eclipse.*
11 %org.apache.*
4 %
com.google.*
9 %
com.vaadin.*
5 %
com.codetrai...
Trend: Events sent by the community
81
Visit the Codetrails Connect live dashboard:

http://download.codetrails.com/connec...
How well does it work?
82
What do you expect?
How well does it work?
83
Numberofproposalsmade
1
2
3
4
5
6
7
Position in code completion window
-1 0 1 2 3 4 5 6
993
475
...
Successfully concluded sessions
84
Codetrails
78,8
JDT
67,9
JDT standalone vs. Codetrails
Developers find what they need 11...
What get’s shared?
85
What is shared?
86
{!
„type“: „StringBuilder“,!
„completion“: „append(String)“!
}
Sharing Preferences
87
Still scared of crowdsourcing?
88
Do you also suffer from Anatidaephobia?
„Big Brother is watching you“

http://anniemacho...
89
ANATIDAEPHOBIA IS THE FEAR

THAT SOMEWHERE IN THE WORLD,
THERE IS A DUCK WATCHING YOU.
90
https://vaadin.com/blog/-/blogs/crowdsourcing-vaadin-with-codetrails-connect
91
Snippets going social
5 0
Enriching Javadoc
92
Eclipse Code Recommenders Livedoc 0.8 Incubator

Install from http://eclipse.org/recommenders/incubat...
Javadocs with mined snippets
93http://download.codetrails.com/livedoc/published/latest/org/eclipse/jface/org.eclipse.jface...
94
Breaking News:!
Words carry meaning!
As leading scientists found out, words....
Rethinking Recommendation
for Code Comp...
A simple observation
95
You wouldn‘t expect a call to #dispose()

in #createSomething(), right?
What you expect is...
96
How many words do you have for ‟create” ?
97
So, it works for #createSomething too!
98
Almost no difference!
99
Precision
0
25
50
75
100
Recall
0 10 20 30 40 50 60 70 80 90 100
Classic
Verbs
Interpolated Preci...
What get‘s shared?
100
{!
„method“: „create“!
„type“: „Composite“,!
„completion“: „setLayout(...)“!
}
Let‘s back up here for a second!
101
We get (almost) language agnostic!
102
Read More
103
Installation
104
WRAP UP
„Closing notes“
All that only happens if you share…
106
107
Yes, there is a duck somewhere.
108But it probably doesn’t care what you are doing.
THANK YOU
@MarcelBruch
+MarcelBruch
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
Upcoming SlideShare
Loading in...5
×

JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0

335

Published on

Published in: Software, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
335
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0

  1. 1. Wissenstransfer 2.0: 
 Liest du noch, oder programmierst du schon? The knowledge transfer company
  2. 2. • Project Lead of Eclipse Code Recommenders • Eclipse Committer since 2010 • Plug-in Developer for 10 years (Eclipse 2.1) • Member of the Eclipse Architecture Council • Co-Lead of Java User Group Darmstadt • Speaker at JUGs, EclipseCon, JAX, JavaOne… • PhD in Computer Science • CEO of Codetrails ! • Passion to improve developers day-to-day work with intelligent and practical tools - mostly using Data Mining on Big (Software Engineering) Data. About Me 2 @MarcelBruch +MarcelBruch
  3. 3. Codetrails at a Glance • The company behind Eclipse Code Recommenders • Eclipse RCP Experts & Consultants • Software Tool Developers • Data Mining Specialists • Research Spin-off Darmstadt University of Technology 3 supported by
  4. 4. About Eclipse Code Recommenders 4 2006 2009 2011 2012 2013 2014 Research begins CR published CR goes Eclipse CR 1.0 
 Part of IDE CR 2.0 CR 2.1
  5. 5. Awards & Traction 5 2012 • >3.000.000 downloads Top 20 • Talks at 50+ Democamps, Eclipse Days, and Java User Groups all over Europe. • Talks at 10+ intl. and local conferences. • articles every 4 months, • lots of general coverage
  6. 6. PROBLEM
  7. 7. Problem #1: Knowledge Drain 7
  8. 8. Problem #1: Knowledge Drain 8
  9. 9. Problem #1: Knowledge Drain 9 Software
  10. 10. Problem #2: Continuous Learning 10
  11. 11. A typical developer day 11 Comprehend Task 3 % Handling Interruptions 20 % Navigate Code 14 % Study Code 19 % Searching Web 12 % Reading Docs 6 % Write Code 27 % 51% of their time, developers invest in searching and understanding code
  12. 12. How we search 12
  13. 13. What developers look for 13 Question + Answer + Code Example = ✓
  14. 14. A typical developer day 14 Comprehend Task 3 % Handling Interruptions 20 % Navigate Code 14 % Study Code 19 % Searching Web 12 % Reading Docs 6 % Write Code 27 % Even when writing code we search…
  15. 15. If we don’t google… 15
  16. 16. 1 of 387 ?
  17. 17. 17 Code Completion Frequency : 100 completions / day Duration (⌀) : 27 seconds / completion Sum : 45 minutes / day 9% of their time developers spent searching in their code completion
  18. 18. Problem 18 Comprehend Task 3 % Handling Interruptions 20 % Searching Code 12 % Navigate Code 14 % Reading Code 19 % Reading Docs 6 % Edit Code 27 %
  19. 19. Problem 19 Comprehend Task 3 % Handling Interruptions 20 % Searching Code 12 % Navigate Code 14 % Reading Code 19 % Reading Docs 6 % Edit Code 27 % • 51% of their time, developers spent searching the web and existing code for help • In addition, even when programming, they spent 9% searching in their code completion • In total, 60% is about finding the right information to solve a programming task
  20. 20. SOLUTION „Leveraging the power of the crowds“
  21. 21. Behind every answered question… 21
  22. 22. … there is some code 22
  23. 23. Use the code 23
  24. 24. INTELLIGENT CODE COMPLETION „Other developers frequently bought used the following methods…“
  25. 25. @Override! protected Control createDialogArea(final Composite parent) {! Composite container = (Composite) super.createDialogArea(parent);! ! swtTextWidget = new Text(container, SWT.BORDER);! swtTextWidget.|! return container;! } Code Completion… What does the developer need, i.e., which methods should the code completion present to the user? 25
  26. 26. All 164 Methods of Text ?
  27. 27. Intelligent Code Completion What your team really needs to know… 27
  28. 28. Snippet Completion (1) 28
  29. 29. HOW IT WORKS „Finding the hidden gems in your code“
  30. 30. class Example extends Page {! Text t;! ! @Override! void createContents() {! t = new Text();! t.setText(..);! ...! }! ...! } in:Page.performOk() Text.<init>() Text.getText() Text.setFont() ... Text.setText() … … … … … … … 0 0 0 … 30 1 1 1 From code to models... in:Page.createContents()
  31. 31. 31 class Example extends Page {! Text t;! ...! ! @Override! void performOk() {! t.getText();! ...! }! ! } in:Page.performOk() Text.<init>() Text.getText() Text.setFont() ... Text.setText() 1 0 1 1 1 1 0 0 0 0 0 0 … … … … … … … … … From code to models... in:Page.createContents()
  32. 32. 32 class MyPage extends Page {! ! Text t;! @Override! void createContents() {! t = new Text();! t.|<^space>! }! ...! } 1 …1 ?? ?0 From models to recommendations... in:Page.performOk() Text.<init>() Text.getText() Text.setFont() ... Text.setText() in:Page.createContents()
  33. 33. 33 1 …1 ?? ?0 in:Page.performOk() Text.<init>() Text.getText() Text.setFont() ... Text.setText() 01 10 0 … 1 10 0 0 0 … … … … … … … … 1 0 1 1 1 0 …1 01 00 0 …1 ⅔ ⅓ 0 From models to recommendations... in:Page.createContents()
  34. 34. CALL-CHAIN COMPLETION “Welcome to the jungle...”
  35. 35. public class MyView extends ViewPart {! ! public void updateMessage(final String newMessage) {! ! // How do I get an instance of IStatusLineManager?! final IStatusLineManager manager = |! ! } How to obtain an instance of... There is no trivial solution. Again, what should code completion return? 35
  36. 36. What we need... 36 ViewPart IViewSite IAc-onBars IStatusLineManager getStatusLineManager() getAc-onbars() getViewSite() public void updateMessage(final String newMessage) {! ! // How do I get an instance of ! ! final IStatusLineManager manager = ! this! .getViewSite()! .getActionBars()! .getStatusLineManager();! ! manager.setMessage(newMessage);! }
  37. 37. SUBWORDS COMPLETION “BecausePureCamelCaseMatching****s!”
  38. 38. Use speaking names...? 38
  39. 39. When letters become just guidelines... 39I Like? Source: http://vimeo.com/19369928
  40. 40. EXTENDING API DOCUMENTATION “Developers who bought overwrote this method typically also overwrote...”
  41. 41. In good documentation we trust... 41 good /**! * Rollsback the transaction if any and clears different lists to! * start with an empty resource again.! * Note that the super.doUnload is not called because that clears! * the list resulting in all kinds of undesirable inverseremoves.! */! @Override! protected void doUnload() {! super.doUnload();! }! ! No? Are you sure?
  42. 42. Generating high-quality API documentation 42 /**! * The number of questions.! */! private int numberOfQuestions;! ! ! /**! * Sets the number of questions.! * ! * @param numberOfQuestions the number of questions! * @throws IllegalArgumentException the illegal argument exception! */! public void setNumberOfQuestions(int numberOfQuestions) ! throws IllegalArgumentException {! if (numberOfQuestions < 0) {! throw new IllegalArgumentException("numberOfQuestions < 0");! }! this.numberOfQuestions = numberOfQuestions;! }
  43. 43. What people say about JAutodoc... 43 User: Anonymous Rating: 9 2009-08-02 11:32:37 Wow exactly what I needed! User: Anonymous Rating: 9 2009-02-13 19:58:32 Thank you... this plugin rocks! User: Anonymous Rating: 9 2009-02-13 19:58:32 Works perfectly. Smarter than I expected! WTH? What did you expect?!
  44. 44. How Recommenders is coming to rescue... 44
  45. 45. What documentation would you expect when subclassing Dialog? 45 package org.eclipse.recommenders.examples.demo;! ! import org.eclipse.jface.*;! ! public class MyDialog extends Dialog {! ! protected MyDialog(final IShellProvider parentShell) {! super(parentShell);! } ! }! !
  46. 46. What Javadoc gives you... 46 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 cus to the first dialog potentially blocking the UI. But what are the hot-spots of Dialog? org.eclipse.jface.dialogs.Dialog
  47. 47. What code completion offers... 47 Which of the 56 methods should we override?
  48. 48. Recommending method overrides... 48 ! public class MyDialog extends Dialog {! !
  49. 49. Recommending self-calls 49 public class MyWizard extends Wizard {! ! ! @Override! public void addPages() {! ! };
  50. 50. Mining for subclassing patterns 50 ! public class MyViewerSorter extends ViewerComparator {
  51. 51. Mined example code snippets… 51 ! public class MyDialog extends Dialog {! ! @Override! protected Control createDialogArea(Composite parent) {! !
  52. 52. SNIPMATCH „Stop searching Stackoverflow for code snippets“
  53. 53. Why do you use code templates? 53
  54. 54. Safe time typing 54 <ctrl+space> <ctrl+space> { <ctrl+space> <ctrl+space> }
  55. 55. Learning from snippets 55
  56. 56. Eclipse Java Templates 56 42x Java Templates. 35x SWT Templates.
  57. 57. Learning from snippets 57
  58. 58. The rise of code snippet repositories 58 and many more...
  59. 59. Snipmatch 59 Recom m enders 2.1
  60. 60. AND IF THERE IS NO CODE TO ANALYZE? „From code analysis to crowd sourcing“
  61. 61. Being for Software Developers How 39 million click events make your IDE a smarter place
  62. 62. 62
  63. 63. 63
  64. 64. The amazon success factors 64
  65. 65. 65 How about applying the very same principles to software development?
  66. 66. So, instead of using the web browser… 66
  67. 67. 68 ! ! ! Disclaimer ! Data sharing is involved! ! Not Eclipse anymore!
  68. 68. Crowdsourced Code Completion Developers that bought used a StringBuilder, typically… 69
  69. 69. A fairly trivial example… 70
  70. 70. Instead saying… 71
  71. 71. What if we‘d just count calls...? 72 Codetrails Connect Community Edition,
 Install from http://www.codetrails.com/connect
  72. 72. ! void ctor() { ! List l = new A… } Crowdsourced Constructor Completion 73 What is the mostly likely completion a developer looks for in this particular situation ?
  73. 73. 74 1 out of 302
  74. 74. ! void ctor() { ! List l = new A… } Use (costly) subtype checks 75 Codetrails Completion Tweaks for Eclipse,
 Install from http://download.codetrails.com/updates/connect/
  75. 75. Crowdsourcing constructor completions...? 76 It learns from you. From the very 1st moment. Codetrails Connect Community Edition,
 Install from http://download.codetrails.com/updates/connect/
  76. 76. public class MyDialog extends Dialog { ! | ! ! Crowdsourcing override completions...? 77
  77. 77. ! void quickfix() { ! List l = new A } How about fixing quick-fix? 78 Not fixed yet. But could be easily - when you start sharing your knowledge…
  78. 78. 39.000.000 clicks for a smarter IDE 79 Read more (October 2013)
 http://www.codetrails.com/blog/powered-33-million-code-completions-codetrails-connect-12 Method Overrides 1.579.303 Constructor Calls 8.915.540 Method Calls 38.254.438 48.749.281 Bootstrapped with
 30++ GB Java Bytecode. Powered by Maven Central and EclipseSource Yoxos.
  79. 79. 56.424 crowdsourced completion events 80 org.eclipse.* 11 %org.apache.* 4 % com.google.* 9 % com.vaadin.* 5 % com.codetrails.* 3 % others 14 % javax.* 3 % java.[n]io.* 6 % java.util.* 25 % java.lang.* 21 % From December 22 to March 12
  80. 80. Trend: Events sent by the community 81 Visit the Codetrails Connect live dashboard:
 http://download.codetrails.com/connect/dashboard/
  81. 81. How well does it work? 82 What do you expect?
  82. 82. How well does it work? 83 Numberofproposalsmade 1 2 3 4 5 6 7 Position in code completion window -1 0 1 2 3 4 5 6 993 475 304 214 189 123 1.094 833 327 238 197 114 87 145 56 40 38 96 61 23 22 21 77 52 19 21 20 10 963 591 373 243 285 151 157 Hit Miss not found
  83. 83. Successfully concluded sessions 84 Codetrails 78,8 JDT 67,9 JDT standalone vs. Codetrails Developers find what they need 11% more often with smart code completion. Number of documentation lookups saved in 3 months: 3.000!
  84. 84. What get’s shared? 85
  85. 85. What is shared? 86 {! „type“: „StringBuilder“,! „completion“: „append(String)“! }
  86. 86. Sharing Preferences 87
  87. 87. Still scared of crowdsourcing? 88 Do you also suffer from Anatidaephobia? „Big Brother is watching you“
 http://anniemachon.ch/annie_machon/2013/11/cryptofestival-london-30th-november.html
  88. 88. 89 ANATIDAEPHOBIA IS THE FEAR
 THAT SOMEWHERE IN THE WORLD, THERE IS A DUCK WATCHING YOU.
  89. 89. 90 https://vaadin.com/blog/-/blogs/crowdsourcing-vaadin-with-codetrails-connect
  90. 90. 91 Snippets going social 5 0
  91. 91. Enriching Javadoc 92 Eclipse Code Recommenders Livedoc 0.8 Incubator
 Install from http://eclipse.org/recommenders/incubators
  92. 92. Javadocs with mined snippets 93http://download.codetrails.com/livedoc/published/latest/org/eclipse/jface/org.eclipse.jface/3.8.102/
  93. 93. 94 Breaking News:! Words carry meaning! As leading scientists found out, words.... Rethinking Recommendation for Code Completion
  94. 94. A simple observation 95 You wouldn‘t expect a call to #dispose()
 in #createSomething(), right?
  95. 95. What you expect is... 96
  96. 96. How many words do you have for ‟create” ? 97
  97. 97. So, it works for #createSomething too! 98
  98. 98. Almost no difference! 99 Precision 0 25 50 75 100 Recall 0 10 20 30 40 50 60 70 80 90 100 Classic Verbs Interpolated Precision Recall Curves over 136.761 samples on JRE
  99. 99. What get‘s shared? 100 {! „method“: „create“! „type“: „Composite“,! „completion“: „setLayout(...)“! }
  100. 100. Let‘s back up here for a second! 101
  101. 101. We get (almost) language agnostic! 102
  102. 102. Read More 103
  103. 103. Installation 104
  104. 104. WRAP UP „Closing notes“
  105. 105. All that only happens if you share… 106
  106. 106. 107 Yes, there is a duck somewhere.
  107. 107. 108But it probably doesn’t care what you are doing.
  108. 108. THANK YOU @MarcelBruch +MarcelBruch
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×