eclipse code recommenders @ majug 2011

191
Eclipse Code Recommenders IDE 2.0: Leveraging the Wisdom of the So:ware Engineering Crowds tw: @MarcelBruch g+: +Marcel Bruch Java User Group Mannheim

Upload: marcel-bruch

Post on 09-Jun-2015

1.864 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Eclipse Code Recommenders @ MAJUG 2011

Eclipse Code Recommenders

IDE  2.0:  Leveraging  the  Wisdomof  the  So:ware  Engineering  Crowdstw:  @MarcelBruchg+:  +Marcel  Bruch

Java  U

ser  Group  M

annhei

m

Page 2: Eclipse Code Recommenders @ MAJUG 2011

2

Page 3: Eclipse Code Recommenders @ MAJUG 2011

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

CodeAll Frameworks

Eclipse  Code  Recommenders            Code

3

Page 4: Eclipse Code Recommenders @ MAJUG 2011

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

Page 5: Eclipse Code Recommenders @ MAJUG 2011

@Overrideprotected Control createDialogArea(final Composite parent) { Composite container = (Composite) super.createDialogArea(parent); swtTextWidget = new Text(container, SWT.BORDER); swtTextWidget.| return container;}

Code  Comple+on…

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

5

Page 6: Eclipse Code Recommenders @ MAJUG 2011
Page 7: Eclipse Code Recommenders @ MAJUG 2011

All  164  Methods  of  Text  ?

Page 8: Eclipse Code Recommenders @ MAJUG 2011

JBuSon?  381  Methods.

Page 9: Eclipse Code Recommenders @ MAJUG 2011

@Override protected Control createDialogArea(final Composite parent) { final Composite container = (Composite) super.createDialogArea(parent); swtTextWidget = new Text(container, SWT.BORDER); swtTextWidget.| return container; }

Code  Comple+on…

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

8

Page 10: Eclipse Code Recommenders @ MAJUG 2011

Intelligent  Code  Comple+on

…  or  just  the  three  missing  ones?  

9

Page 11: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

Page 12: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

Framework

Page 13: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

Framework

Example  ApplicaKon  1

Example  ApplicaKon  n...

Page 14: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

extract  facts  about  how  the  framework  is  reused

...«extends:A»

«overrides:A.d»«calls:B.c»

«extends:A»«overrides:A.b»

«calls:B.c»…

Framework

Example  ApplicaKon  1

Example  ApplicaKon  n...

Page 15: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

extract  facts  about  how  the  framework  is  reused

...«extends:A»

«overrides:A.d»«calls:B.c»

«extends:A»«overrides:A.b»

«calls:B.c»…

Framework

Example  ApplicaKon  1

Example  ApplicaKon  n...

Page 16: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

10

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»…

Framework

Example  ApplicaKon  1

Example  ApplicaKon  n...

Page 17: Eclipse Code Recommenders @ MAJUG 2011

From  code  to  models...

11

class Example extends Page { Text t; @Override void createContents() { t = new Text(); t.setText(..); .. }}

in:Page.createContents()

in:Page.performOk()

Text.<init>()

Text.getText()

Text.setFont()

...

Text.setText()

1 0 1 1

1 1

0 0

0 0 0 0… … … … … …

……

Page 18: Eclipse Code Recommenders @ MAJUG 2011

From  code  to  models...

12

class Example extends Page { Text t; @Override void performOk() { t.getText(); ..

}}

in:Page.createContents()

in:Page.performOk()

Text.<init>()

Text.getText()

Text.setFont()

...

Text.setText()

1 0 1 1

1 1

0 0

0 0 0 0… … … … … …

……

Page 19: Eclipse Code Recommenders @ MAJUG 2011

From  models  to  recommenda+ons...

13

class MyPage extends Page { Text t; @Override void createContents() { t = new Text(); t.|<^space> }}

1 …1 ?? ?0in:Page.createContents()

in:Page.performOk()

Text.<init>()

Text.getText()

Text.setFont()

...

Text.setText()

Page 20: Eclipse Code Recommenders @ MAJUG 2011

From  models  to  recommenda+ons...

14

1 …1 ?? ?0

in:Page.createContents()

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 …101 00 0 …1

Page 21: Eclipse Code Recommenders @ MAJUG 2011

From  models  to  recommenda+ons...

14

1 …1 ?? ?0

in:Page.createContents()

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 …101 00 0 …1

Page 22: Eclipse Code Recommenders @ MAJUG 2011

From  models  to  recommenda+ons...

14

1 …1 ?? ?0

in:Page.createContents()

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 …101 00 0 …1

⅔ ⅓

Page 23: Eclipse Code Recommenders @ MAJUG 2011

From  models  to  recommenda+ons...

14

1 …1 ?? ?0

in:Page.createContents()

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 …101 00 0 …1

⅔ ⅓ 0

Page 24: Eclipse Code Recommenders @ MAJUG 2011

CALL-­‐CHAIN  COMPLETION“Welcome  to  the  forest...”

Page 25: Eclipse Code Recommenders @ MAJUG 2011

How  to  obtain  an  instance  of...

public class MyView extends ViewPart { public void updateMessage(final String newMessage) {

// How do I get an instance of IStatusLineManager? final IStatusLineManager manager = | manager.setMessage(newMessage); }

There is no trivial solution anymore.Again, what should code completion return?

Page 26: Eclipse Code Recommenders @ MAJUG 2011

What  we  need...

17

public void updateMessage(final String newMessage) {

// How do I get an instance of final IStatusLineManager manager = this .getViewSite() .getActionBars() .getStatusLineManager();

manager.setMessage(newMessage);}

!"#$%&'(

)!"#$*"(#

)+,-./0&'1

)*(&(213"/#4&/&5#'

5#(*(&(213"/#4&/&5#'67

5#(+,-./8&'167

5#(!"#$*"(#67

Page 27: Eclipse Code Recommenders @ MAJUG 2011

!"#$%&'(

)#*"+#

,#+(&-./#

01/1'

234(#-5"1-

201-('"67(1'

28+91-:&'5

2;1'<6#-+=;"->1$

2?#/#+91-%'1*">#'

2;1'<6#-+=%&.#

?=#//

2;1'<6#-+=%&'(

2@#A:"->"-.?#'*"+#2;1'<6#-+=%&'(?"(#

2B&.#

201-C.7'&91-3/#B#-(

2!"#$?"(#

2B&.#)&(&

%1"-(

2D#-7D&-&.#'

2?#'*"+#E1+&(1'

2%&'(?#'*"+#

2;1'<6#-+=

28>&F(&6/#

2?#/#+91-

2;1'<6#-+=;"->1$

2G&*".&91-H"5(1'A

2;1'<"-.?#(

234(#-5"1-I'&+<#'

2!"#$,#J#'#-+#

2!"#$%&'(

23>"(1',#J#'#-+#

23>"(1'%&'(

,#."1-

01BF15"(#

D#-7

E"5(#-#'

E&A17(

2D3

)"5F/&A

?+'1//:&'

01-('1/

2?#'*"+#E1+&(1'

2D#-7D&-&.#'

2?(&(75E"-#D&-&.#'

28+91-

2I11/:&'D&-&.#'

2?#/#+91-?#'*"+#

Page 28: Eclipse Code Recommenders @ MAJUG 2011

However,  someEmes  you  get...

Here,  implicit  user  feedbacks  (“clicks”)  will  help  to  find  the  right  (read  “the  most  commonly  used”)  paths.

In  deve

lopme

nt...

Page 29: Eclipse Code Recommenders @ MAJUG 2011

Tools  Outline

20

x=

Page 30: Eclipse Code Recommenders @ MAJUG 2011

Tools  Outline

Intelligent  Code  CompleEon

20

x=

Page 31: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Intelligent  Code  CompleEon

20

x=

Page 32: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Extended  DocumentaEon

Intelligent  Code  CompleEon

20

x=

Page 33: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Extended  DocumentaEon

Intelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

20

x=

Page 34: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Extended  DocumentaEon

Intelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Stacktrace  Search  Engine

What  caused  that  stacktrace?

20

x=

Page 35: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Extended  DocumentaEon

Intelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Stacktrace  Search  Engine

What  caused  that  stacktrace?

20

x=

Page 36: Eclipse Code Recommenders @ MAJUG 2011

Smart  Bug  DetecEon

What  have  I  missed?

Tools  Outline

Extended  DocumentaEon

Intelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Stacktrace  Search  Engine

What  caused  that  stacktrace?

20

x=

Page 37: Eclipse Code Recommenders @ MAJUG 2011

SMART  BUG  DETECTION  –  DRIVEN  BY  REAL  USAGES

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

Page 38: Eclipse Code Recommenders @ MAJUG 2011

What’s  wrong  with  this  code?

“Hello!”

“id”

22

Page 39: Eclipse Code Recommenders @ MAJUG 2011

At  run+me  you  get…

23

Page 40: Eclipse Code Recommenders @ MAJUG 2011

...and  a  lengthy  stacktrace

24

org.eclipse.core.runEme.AsserEonFailedExcepEon:  null  argument:at  org.eclipse.core.runEme.Assert.isNotNull(Assert.java:85)at  org.eclipse.core.runEme.Assert.isNotNull(Assert.java:73)at  org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:174)at  org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:734)at  org.eclipse.jface.wizard.WizardDialog.setWizard(WizardDialog.java:1162)at  org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1221)at  org.eclipse.jface.wizard.WizardDialog.access$4(WizardDialog.java:1218)at  org.eclipse.jface.wizard.WizardDialog$6.run(WizardDialog.java:1207)at  org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)at  org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1205)at  org.eclipse.ui.internal.dialogs.ImportExportPage.treeDoubleClicked(ImportExportPage.java)at  org.eclipse.ui.internal.dialogs.ImportPage$2.doubleClick(ImportPage.java:72)at  org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:824)at  org.eclipse.core.runEme.SafeRunner.run(SafeRunner.java:42)at  org.eclipse.ui.internal.JFaceUEl$1.run(JFaceUEl.java:49)at  org.eclipse.jface.uEl.SafeRunnable.run(SafeRunnable.java:175)at  org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:822)at  org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java)at  org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java)

...

Page 41: Eclipse Code Recommenders @ MAJUG 2011

So what have we missed?25

Page 42: Eclipse Code Recommenders @ MAJUG 2011

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

26

Page 43: Eclipse Code Recommenders @ MAJUG 2011

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

26

Page 44: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

27

Page 45: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

27

Page 46: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

27

Page 47: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

27

Page 48: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

That’s  “strange”

27

Page 49: Eclipse Code Recommenders @ MAJUG 2011

How  to  detect  such  wrong  uses?

28

Page 50: Eclipse Code Recommenders @ MAJUG 2011

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}29

10 .9.5

Page 51: Eclipse Code Recommenders @ MAJUG 2011

Missing  Calls  Detector  in  Eclipse

30In  d

evelop

ment...

Page 52: Eclipse Code Recommenders @ MAJUG 2011

Applied  on  Eclipse  3.5...

31

Page 53: Eclipse Code Recommenders @ MAJUG 2011

USAGE-­‐DRIVEN  JAVADOC“Developers  who  bought  overwrote  this  method  typically  also  overwrote...”

Page 54: Eclipse Code Recommenders @ MAJUG 2011

In  good  documenta+on  we  trust...

33

/** * 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(); }

Page 55: Eclipse Code Recommenders @ MAJUG 2011

In  good  documenta+on  we  trust...

33

/** * 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(); }

Page 56: Eclipse Code Recommenders @ MAJUG 2011

In  good  documenta+on  we  trust...

33

/** * 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?

Page 57: Eclipse Code Recommenders @ MAJUG 2011

In  good  documenta+on  we  trust...

33

/** * 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?

good

Page 58: Eclipse Code Recommenders @ MAJUG 2011

Genera+ng  high-­‐quality  API  documenta+on

34

Page 59: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 60: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 61: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 62: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 63: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 64: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 65: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

34

Page 66: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

35

high-­‐quality

Page 67: Eclipse Code Recommenders @ MAJUG 2011

/** * 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; }

Genera+ng  high-­‐quality  API  documenta+on

35

high-­‐quality

Page 68: Eclipse Code Recommenders @ MAJUG 2011

What  people  say  about  JAutodoc...

36

Page 69: Eclipse Code Recommenders @ MAJUG 2011

What  people  say  about  JAutodoc...

36

User: Anonymous Rating: 9 2009-08-02 11:32:37

Wow exactly what I needed!Wow exactly what I needed!Wow exactly what I needed!

Page 70: Eclipse Code Recommenders @ MAJUG 2011

What  people  say  about  JAutodoc...

36

User: Anonymous Rating: 9 2009-08-02 11:32:37

Wow exactly what I needed!Wow exactly what I needed!Wow exactly what I needed!

User: Anonymous Rating: 9 2009-02-13 19:58:32

Thank you... this plugin rocks!Thank you... this plugin rocks!Thank you... this plugin rocks!

Page 71: Eclipse Code Recommenders @ MAJUG 2011

What  people  say  about  JAutodoc...

36

User: Anonymous Rating: 9 2009-08-02 11:32:37

Wow exactly what I needed!Wow exactly what I needed!Wow exactly what I needed!

User: Anonymous Rating: 9 2009-02-13 19:58:32

Thank you... this plugin rocks!Thank you... this plugin rocks!Thank you... this plugin rocks!

User: Anonymous Rating: 9 2009-02-13 19:58:32

Works perfectly. Smarter than I expected!Works perfectly. Smarter than I expected!Works perfectly. Smarter than I expected!

Page 72: Eclipse Code Recommenders @ MAJUG 2011

What  people  say  about  JAutodoc...

36

User: Anonymous Rating: 9 2009-08-02 11:32:37

Wow exactly what I needed!Wow exactly what I needed!Wow exactly what I needed!

User: Anonymous Rating: 9 2009-02-13 19:58:32

Thank you... this plugin rocks!Thank you... this plugin rocks!Thank you... this plugin rocks!

User: Anonymous Rating: 9 2009-02-13 19:58:32

Works perfectly. Smarter than I expected!Works perfectly. Smarter than I expected!Works perfectly. Smarter than I expected!

WTH?  What  did  you  expect?!

Page 73: Eclipse Code Recommenders @ MAJUG 2011

How  Recommenders  is  coming  to  rescue...

37

Page 74: Eclipse Code Recommenders @ MAJUG 2011

Some  facts  about  thedocumentaEon  of  overridable  methods

38

Overridable

Overridden

0 700 1400 2100

623

2.074

Page 75: Eclipse Code Recommenders @ MAJUG 2011

What  clients  do  with  your  API...

39

Overridden

Documented *

0 325 650

155

623

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

Page 76: Eclipse Code Recommenders @ MAJUG 2011

What  clients  do  with  your  API...

39

Overridden

Documented *

0 325 650

155

623

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

468

Page 77: Eclipse Code Recommenders @ MAJUG 2011

What  documenta+on  would  you  expect  when  subclassing  Dialog?

40

package org.eclipse.recommenders.examples.demo;

import org.eclipse.jface.dialogs.Dialog;import org.eclipse.jface.window.IShellProvider;

public class MyDialog extends Dialog {

protected MyDialog(final IShellProvider parentShell) { super(parentShell); } }

Page 78: Eclipse Code Recommenders @ MAJUG 2011

What  Javadoc  gives  you...

41

org.eclipse.jface.dialogs.Dialog

Page 79: Eclipse Code Recommenders @ MAJUG 2011

What  Javadoc  gives  you...

41

A  dialog  is  a  specialized  window  used  for  narrow-­‐focused  communicaEon  with  the  user.  

org.eclipse.jface.dialogs.Dialog

Page 80: Eclipse Code Recommenders @ MAJUG 2011

What  Javadoc  gives  you...

41

A  dialog  is  a  specialized  window  used  for  narrow-­‐focused  communicaEon  with  the  user.  

Dialogs  are  usually  modal.  Consequently,  it  is  generally  bad  pracEce  to  open  a  dialog  without  a  parent.  A  modal  dialog  without  a  parent  is  not  prevented  from  disappearing  behind  the  applicaEon'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  potenEally  blocking  the  UI.  

org.eclipse.jface.dialogs.Dialog

Page 81: Eclipse Code Recommenders @ MAJUG 2011

What  Javadoc  gives  you...

41

A  dialog  is  a  specialized  window  used  for  narrow-­‐focused  communicaEon  with  the  user.  

Dialogs  are  usually  modal.  Consequently,  it  is  generally  bad  pracEce  to  open  a  dialog  without  a  parent.  A  modal  dialog  without  a  parent  is  not  prevented  from  disappearing  behind  the  applicaEon'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  potenEally  blocking  the  UI.  

But what are the hot-spots of Dialog?

org.eclipse.jface.dialogs.Dialog

Page 82: Eclipse Code Recommenders @ MAJUG 2011

What  code  comple+on  offers...

42

Page 83: Eclipse Code Recommenders @ MAJUG 2011

What  code  comple+on  offers...

42

Which of the 56 methods should we override?

Page 84: Eclipse Code Recommenders @ MAJUG 2011

Recommending  method  overrides...

43

public class MyDialog extends Dialog {

Page 85: Eclipse Code Recommenders @ MAJUG 2011

public class MyWizard extends Wizard {

! @Override public void addPages() { };

Recommending  Self-­‐Calls

44

Page 86: Eclipse Code Recommenders @ MAJUG 2011

public class MyViewerSorter extends ViewerSorter {

Mining  for  Subclassing  pa`erns

45

Page 87: Eclipse Code Recommenders @ MAJUG 2011

public class MyDialog extends Dialog { @Override protected Control createDialogArea(Composite parent) {

Mining  example  code  snippets

46

Page 88: Eclipse Code Recommenders @ MAJUG 2011

Sca`ered  Resources

47

Page 89: Eclipse Code Recommenders @ MAJUG 2011

Extended  Documenta+on  Plaaorm

48

+ Machine Learning

Page 90: Eclipse Code Recommenders @ MAJUG 2011

Extended  Documenta+on  Plaaorm

48

+ Machine Learning

Page 91: Eclipse Code Recommenders @ MAJUG 2011

Extended  Documenta+on

49

Page 92: Eclipse Code Recommenders @ MAJUG 2011

How  it  works  -­‐  in  a  nutshell

50

Page 93: Eclipse Code Recommenders @ MAJUG 2011

CODE-­‐SEARCH  ENGINES  LIFT  OFF“Why  is  Google  Codesearch  not  ‘google  for  code  search’?  ”

Page 94: Eclipse Code Recommenders @ MAJUG 2011

How  many  request  per  minutes  docode  search  engines  have?

52

Page 95: Eclipse Code Recommenders @ MAJUG 2011

53

20Number  for  koders.com  in  2009  according  to    “Analyzing  and  mining  a  code  search  engine  usage  log”

h`p://dx.doi.org/10.1007/s10664-­‐010-­‐9144-­‐6

Page 96: Eclipse Code Recommenders @ MAJUG 2011

Naviga+ng  the  API  jungle…

54

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

Page 97: Eclipse Code Recommenders @ MAJUG 2011

Naviga+ng  the  API  jungle…

How  to  solveString  -­‐>  ASTParser  -­‐>  CompilaKonUnit?

54

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

Page 98: Eclipse Code Recommenders @ MAJUG 2011

When  asking  Google  code  search...

55

Page 99: Eclipse Code Recommenders @ MAJUG 2011

When  asking  Google  code  search...

55

Page 100: Eclipse Code Recommenders @ MAJUG 2011

When  asking  Google  code  search...

55

Page 101: Eclipse Code Recommenders @ MAJUG 2011

When  asking  Google  code  search...

55

Page 102: Eclipse Code Recommenders @ MAJUG 2011

Why?

56

Page 103: Eclipse Code Recommenders @ MAJUG 2011

Why?

Text-basedretrieval!

56

Page 104: Eclipse Code Recommenders @ MAJUG 2011

Why?

Text-basedretrieval!

56

Inexpressive query language!

Page 105: Eclipse Code Recommenders @ MAJUG 2011

Why?

Text-basedretrieval!

Ignores prior knowledge!

56

Inexpressive query language!

Page 106: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Page 107: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Page 108: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Query

Page 109: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Query

Page 110: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Query

Page 111: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Query

Page 112: Eclipse Code Recommenders @ MAJUG 2011

Example  code  search  engine

public class MyJavaEditor extends EditorPart {

private CompilationUnit createCompilationUnit(String source) {

// how can I create and configure an ASTParser? ASTParser parser = null; parser.setSource(source.toCharArray());

// ASTParser --> CompilationUnit: how? CompilationUnit cu = null; return cu; }

57

Query

Page 113: Eclipse Code Recommenders @ MAJUG 2011

Sample  search  query

58

Extracted from MyJavaEditor.createCompilationUnit():

--- data ---extends: org.eclipse.ui.EditorPartuses: org.eclipse.jdt.core.CompilationUnituses: org.eclipse.jdt.core.ASTParsercalls: org.eclipse.jdt.core.ASTParser.setSource(char[])

--- requested ---def: org.eclipse.jdt.core.CompilationUnit (def=null)def: org.eclipse.jdt.core.ASTParser (def=null)

In  deve

lopme

nt...

Page 114: Eclipse Code Recommenders @ MAJUG 2011

LEVERAGING  USER  FEEDBACK  TOIMPROVE  CODE  SEARCH  ENGINES

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

Page 115: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  user  feedback

60

Page 116: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  user  feedback

60

Page 117: Eclipse Code Recommenders @ MAJUG 2011

Refine  the  ranking  based  on  feedback

61

Page 118: Eclipse Code Recommenders @ MAJUG 2011

Refine  the  ranking  based  on  feedback

61

Page 119: Eclipse Code Recommenders @ MAJUG 2011

Learning  how  to  rank

62

Page 120: Eclipse Code Recommenders @ MAJUG 2011

Ranking  the  examples

63

Page 121: Eclipse Code Recommenders @ MAJUG 2011

Ranking  the  examples

63

document

Page 122: Eclipse Code Recommenders @ MAJUG 2011

Ranking  the  examples

63

documentquery

Page 123: Eclipse Code Recommenders @ MAJUG 2011

Ranking  the  examples

63

feature-­‐score  i[0..1]

documentquery

Page 124: Eclipse Code Recommenders @ MAJUG 2011

Ranking  the  examples

63

weight  (-­‐∞..+∞)

feature-­‐score  i[0..1]

documentquery

Page 125: Eclipse Code Recommenders @ MAJUG 2011

Upda+ng  the  feature  weights...

64

Page 126: Eclipse Code Recommenders @ MAJUG 2011

Upda+ng  the  feature  weights...

64

Page 127: Eclipse Code Recommenders @ MAJUG 2011

Upda+ng  the  feature  weights...

64

10.000  ∗

Page 128: Eclipse Code Recommenders @ MAJUG 2011

Benefits  of  automated  tweaking

65

baselineclick-­‐through

#  queries

#  kend

all’s  ι

Page 129: Eclipse Code Recommenders @ MAJUG 2011

Interac+ons  diagram

66

ServerClient

1

«triggers»Developer

3 Code Snippet Ranking2 Search Invocation

«triggers»Developer

SearchIndex

RankingFunction

IncompleteSource Code Query

5 Feedback Processing

4 Code Snippet Presentation Code Examples

«updates»

Weights LearningFunction

5 Feedback ProcessingCode

Summarization

Cli kth h

CodeHighlighter

FunctionClickthroughdata

Page 130: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

67

Open  SourceRepositories

CompanyRepositories

Page 131: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

67

Open  SourceRepositories

CompanyRepositories

Page 132: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

67

Open  SourceRepositories

CompanyRepositories

Page 133: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

67

Open  SourceRepositories

CompanyRepositories

Page 134: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

67

Filesystem  

Open  SourceRepositories

CompanyRepositories

Page 135: Eclipse Code Recommenders @ MAJUG 2011

WHAT  CAUSED  THAT  STACKTRACE?“People  that  bought  had  this  NullPointerExcepKon,  made  this  mistake:...”

Page 136: Eclipse Code Recommenders @ MAJUG 2011

So  far  we  have…

69

Page 137: Eclipse Code Recommenders @ MAJUG 2011

So  far  we  have…

69

Intelligent  Code  CompleEon

Page 138: Eclipse Code Recommenders @ MAJUG 2011

So  far  we  have…

69

Extended  DocumentaEonIntelligent  Code  CompleEon

Page 139: Eclipse Code Recommenders @ MAJUG 2011

So  far  we  have…

69

Extended  DocumentaEonIntelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Page 140: Eclipse Code Recommenders @ MAJUG 2011

So  far  we  have…

69

Smart  Bug  DetecEon

What  have  I  missed?

Extended  DocumentaEonIntelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Page 141: Eclipse Code Recommenders @ MAJUG 2011

But  what  if  you  get  this?

70

Page 142: Eclipse Code Recommenders @ MAJUG 2011

Debugging  –  the  old  way

71

Page 143: Eclipse Code Recommenders @ MAJUG 2011

Debugging  –  the  old  way

71

Page 144: Eclipse Code Recommenders @ MAJUG 2011

Debugging  –  the  old  way

72

Page 145: Eclipse Code Recommenders @ MAJUG 2011

But  more  ojen  we  get…

73

Page 146: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

Page 147: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

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)

Page 148: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

excepEon  type

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)

Page 149: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

excepEon  type message

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)

Page 150: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

excepEon  type message

stackframes

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)

Page 151: Eclipse Code Recommenders @ MAJUG 2011

How  can  we  fix  that?  Don’t  stacktraces  share  some  commonali+es?

74

excepEon  type message

stackframes other  informaEon

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)

Page 152: Eclipse Code Recommenders @ MAJUG 2011

How  about  stacktraces.org?

75

Page 153: Eclipse Code Recommenders @ MAJUG 2011

Knowledge  sources

76

Eclipse Forums

Mailing  ListsWebplasorm

htp://stacktraces.org

Page 154: Eclipse Code Recommenders @ MAJUG 2011

Applica+on  scenarios  for  your    company

77

Community-­‐driven  (forums,  mailinglists,...)

CompanyKnowledgebase

Page 155: Eclipse Code Recommenders @ MAJUG 2011

SNIPMATCH“Templates  meet  Social  -­‐  reloaded!”

Page 156: Eclipse Code Recommenders @ MAJUG 2011

Eclipse  Java  Editor  Templates

Page 157: Eclipse Code Recommenders @ MAJUG 2011

Eclipse  Java  Editor  Templates

42x  Java  Templates.

Page 158: Eclipse Code Recommenders @ MAJUG 2011

Eclipse  Java  Editor  Templates

42x  Java  Templates.35x  SWT  Templates.

Page 159: Eclipse Code Recommenders @ MAJUG 2011

Eclipse  Java  Editor  Templates

42x  Java  Templates.35x  SWT  Templates.

7  Years.

Page 160: Eclipse Code Recommenders @ MAJUG 2011

The  rise  of  code  snippet  repositories

and  many  more...

Page 161: Eclipse Code Recommenders @ MAJUG 2011

Searching  snippets  in  your  IDE...

Page 162: Eclipse Code Recommenders @ MAJUG 2011

ECLIPSE  CODE  RECOMMENDERS“IDE  2.0?  Leveraging  the  wisdom  of  the  (Eclipse)  community…”

Page 163: Eclipse Code Recommenders @ MAJUG 2011

From  IDE  1.0  to  IDE  2.0

83

Page 164: Eclipse Code Recommenders @ MAJUG 2011

From  IDE  1.0  to  IDE  2.0

83

Page 165: Eclipse Code Recommenders @ MAJUG 2011

Build  directly  from  version  control-­‐  or  p2/m2  repository...

84

P2

Page 166: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

85

Page 167: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

project environment

85

Page 168: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

project environment

context

85

Page 169: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

object usage

project environment

context

85

Page 170: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

object usage

selectedproposals

project environment

context

85

Page 171: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

object usage

selectedproposals

project environment

context

clickfeedback

85

Page 172: Eclipse Code Recommenders @ MAJUG 2011

Leveraging  your  IDE’s  build  environment

object usage

selectedproposals

project environment

context

Stacktraces

clickfeedback

85

Page 173: Eclipse Code Recommenders @ MAJUG 2011

Crowd-­‐sourcing...

86

Page 174: Eclipse Code Recommenders @ MAJUG 2011

BUT  HOW  ABOUT  PRIVACY?“Yours  is  ours  and  mine  is  mine...”

Page 175: Eclipse Code Recommenders @ MAJUG 2011

Usage  data  sharing  example

88

import com.mycompany.*;import org.eclipse.*;

public class MyCompanyDialog extends Dialog implements ICompanyService {

MyCompanyController controller = new MyCompanyController();

@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Button sync = new Button(container, SWT.CHECK); sync.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (sync.getSelection()) { controller.synchronize(); // lot of more things done with controller } } }); return container; }

@Override public void myCompanyServiceMethod() { controller.setup(); }}

Page 176: Eclipse Code Recommenders @ MAJUG 2011

Usage  data  sharing  example

88

import com.mycompany.*;import org.eclipse.*;

public class MyCompanyDialog extends Dialog implements ICompanyService {

MyCompanyController controller = new MyCompanyController();

@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Button sync = new Button(container, SWT.CHECK); sync.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (sync.getSelection()) { controller.synchronize(); // lot of more things done with controller } } }); return container; }

@Override public void myCompanyServiceMethod() { controller.setup(); }}

Page 177: Eclipse Code Recommenders @ MAJUG 2011

Informa+on  cleared  by  privacy  selngs

89

import com.mycompany.*;import org.eclipse.*;

public class MyCompanyDialog extends Dialog implements ICompanyService {

MyCompanyController controller = new MyCompanyController();

@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Button sync = new Button(container, SWT.CHECK); sync.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (sync.getSelection()) { controller.synchronize(); // lot of more things done with controller } } }); return container; }

@Override public void myCompanyServiceMethod() { controller.setup(); }}

Page 178: Eclipse Code Recommenders @ MAJUG 2011

Effec+ve  usage  data  shared

90

import com.mycompany.*;import org.eclipse.*;

public class MyCompanyDialog extends Dialog implements ICompanyService {

MyCompanyController controller = new MyCompanyController();

@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Button sync = new Button(container, SWT.CHECK); sync.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (sync.getSelection()) { controller.synchronize();

} } }); return container; }

@Override public void myCompanyServiceMethod() { controller.setup(); }}

Page 179: Eclipse Code Recommenders @ MAJUG 2011

Effec+ve  usage  data  shared

90

import com.mycompany.*;import org.eclipse.*;

public class MyCompanyDialog extends Dialog implements ICompanyService {

MyCompanyController controller = new MyCompanyController();

@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); Button sync = new Button(container, SWT.CHECK); sync.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (sync.getSelection()) { controller.synchronize();

} } }); return container; }

@Override public void myCompanyServiceMethod() { controller.setup(); }}

Only  the  informaKon  how  you  used  Eclipse  is  shared.

Page 180: Eclipse Code Recommenders @ MAJUG 2011

RECOMMENDERS  FOR  ANDROID“Support  your  own  framework.  Live  walk-­‐through...”

Page 181: Eclipse Code Recommenders @ MAJUG 2011

92

ListAcEvity

TextViews

LinearLayout

Page 182: Eclipse Code Recommenders @ MAJUG 2011

TEAM  SERVER  FOR  ANDROID“Support  your  own  framework.  Live  walk-­‐through...”

Page 183: Eclipse Code Recommenders @ MAJUG 2011

Code  Recommenders  team  server

PowerBook G4

PowerBook G4PowerBook G4

server

devel  #1

devel  #2 devel  #3

In  deve

lopme

nt...

Page 184: Eclipse Code Recommenders @ MAJUG 2011

Demo  setup

PowerBook G4

PowerBook G4

Eclipse  “blue” Eclipse  “red”

developer  ws

examples  ws

Page 185: Eclipse Code Recommenders @ MAJUG 2011

Summary

Smart  Bug  DetecEon

What  have  I  missed?

Usage-­‐Driven  JavadocsIntelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Stacktrace  Search  Engine

What  caused  that  stacktrace?

96

x=

Page 186: Eclipse Code Recommenders @ MAJUG 2011

A  developer’s  day...

97

Edit Code

Testing

Comprehend Task

Handling Interruptions Comprehending

Code

Reading API Doc

Navigate Dependencies

Searching Code

Switching Applications

Source:  Eclipse  Mylyn  Developer  Techtalk  2011,  IEEE  TSE,  Vol.  32,  No.  12,  2006

Page 187: Eclipse Code Recommenders @ MAJUG 2011

Where  does  IDE  2.0  improve  the  process?

98

Edit Code Testing

Comprehend Task

Handling Interruptions

Page 188: Eclipse Code Recommenders @ MAJUG 2011

99

Contributors  so  far…Jan  Kassens,    Peter  Schroeder,  Daniel  Glöckner,  Maik  Görtz,  Johannes  Lerch,  Johannes  Born,  Mohsen  Parisay,  Andreas  Sewe,  SebasKan  Ahlfeld,  SebasKan  Kasten,  Daniel  Staesche,  David  Kalnischkies,   SebasKan   Wörner,   Boyan   Yurukov,   Jan   Stolzenburg,   Nico   Wombacher,   Dirk  Kröhan,   Florianrian   Jakob,   Julius  Rückert,   Steffen  Remus,   Christopher  Mann,  Stefan  Henss,  Andreas  Kaluza,   Nikolay   Shindov,  Michael   Novotny,   KrisKn  Arand,   Sinem  Emeröz,  Michael  Kutschke,   SebasKan   Proksch,   Tomasz   Kalbarczyk,   Marko   MarKn,   Sheip   Dargutev,   David  Schuld,   Jens   Krause,   KrisKjan   Madunic,   Daniel   Brandtner,   Roman   GeSo,   ChrisKan   Kilb,  Johannes   Kastl,  Dennis   Sänger,   Annie   Liu,  Markus  Migenda,   Tjark  Vandommele,   SebasKan  Denel,  Florian  Nöll,  Gary  Fritz,  Dennis  Siebert,  Peter  Sinzig,  Laura  Altmüller,  Paul  Schatygin,  Jan-­‐Michael  Heller,  Minh  Hoang  Nguyen,  Sascha  Nordquist,  Paul  Emmanuel  Faidherbe,  ...

Page 189: Eclipse Code Recommenders @ MAJUG 2011

Q  &  A

100

Page 190: Eclipse Code Recommenders @ MAJUG 2011

Q  &  A

Smart  Bug  DetecEon

What  have  I  missed?

Usage-­‐Driven  JavadocsIntelligent  Code  CompleEon

Code  Example  Recommender

How  do  I  get  an  instance  of…?

Stacktrace  Search  Engine

What  caused  that  stacktrace?

101

Page 191: Eclipse Code Recommenders @ MAJUG 2011

It’s  there.

htp://eclipse.org/recommenders/Follow  me  on  twiter:  @MarcelBruch

google+:  +Marcel  Bruch 102