swing to swt and back patterns for api migration by
play

Swing to SWT and Back: Patterns for API Migration by Wrapping - PowerPoint PPT Presentation

Swing to SWT and Back: Patterns for API Migration by Wrapping Thiago Tonelli Bartolomei Ralf L ammel Krzysztof Czarnecki University of Waterloo University of Koblenz-Landau September 15, 2010 Outline Outline 1 - API Migration 2 - Study


  1. Swing to SWT and Back: Patterns for API Migration by Wrapping Thiago Tonelli Bartolomei Ralf L¨ ammel Krzysztof Czarnecki University of Waterloo University of Koblenz-Landau September 15, 2010

  2. Outline

  3. Outline 1 - API Migration 2 - Study Design 3 - Study Results 4 - Conclusion and Future Work 3

  4. 1 - API Migration

  5. API Migration Source Uses Application API 5

  6. API Migration Source Uses Application API Target API 6

  7. API Migration Source Uses Application API Rewrite Modified Application Uses Target API 7

  8. API Migration Source Uses Application API Adapt Implements Rewrite Modified Wrapper Application Wraps Uses Target API 8

  9. Related Work

  10. API Migration Source Uses Application API Rewrite Modified Application Uses Target API 10

  11. API Migration Source Uses Application API Procedural Chow,Notkin [ICSM96] Rewrite Padioleau et al. [EuroSys08] Modified Application Uses Target API 11

  12. API Migration Source Uses Application API Procedural Chow,Notkin [ICSM96] Rewrite Padioleau et al. [EuroSys08] Simple OO la n et al. [ ] Modified Nita,Notkin [IC 0] Application Uses Target API 12

  13. API Migration Source Uses Application API Procedural Chow,Notkin [ICSM96] Rewrite Padioleau et al. [EuroSys08] Simple OO la n et al. [ ] Modified Nita,Notkin [IC 0] Application Upgrade el, iwan [ICSE0 ] Perkins [PASTE0 ] Uses Target API 13

  14. API Migration Source Uses Application API Adapt Implements Wrapper Wraps Target API 14

  15. API Migration Source Uses Application API Adapt Implements Pro cedural to OO r I Wrapper Wraps Target API 15

  16. API Migration Source Uses Application API Adapt Implements Procedural to OO r I To Services a a l Wrapper Wraps Target API 16

  17. API Migration Source Uses Application API Adapt Implements Procedural to OO r I To Services a a l Wrapper Upgrade l i l I Wraps Target API 17

  18. API Migration Source Uses Application API Adapt Implements Wrapper Wraps Target API 18

  19. Limitations (Motivations)

  20. Limitations (Motivations) Simple APIs 20

  21. Limitations (Motivations) Simple APIs No Deep Inheritance Hierarchies 20

  22. Limitations (Motivations) Simple APIs No Deep Inheritance Hierarchies Simple Mappings 20

  23. 2 - Study Design

  24. Research Questions

  25. Research Questions 1. What are the design challenges faced by developers when implementing wrapping layers around OO APIs? 23

  26. Research Questions 1. What are the design challenges faced by developers when implementing wrapping layers around OO APIs? 2. What are the solutions employed in practice? 23

  27. Subjects

  28. Subjects S wingWT SWTSwing 31 Kloc 65 Kloc 25

  29. Subjects Swing v1.4, 234 Kloc Wraps SwingWT SWTSwing 31 Kloc 65 Kloc Wraps SWT v3.2.2, 90 Kloc 26

  30. Subjects Swing v1.4, 234 Kloc Wraps SwingWT SWTSwing XOM2JDOM 31 Kloc 65 Kloc 7 Kloc Wraps SWT v3.2.2, 90 Kloc 27

  31. Subjects Swing XOM v1.4, 234 Kloc v1.2.1, 19 Kloc Wraps SwingWT SWTSwing XOM2JDOM 31 Kloc 65 Kloc 7 Kloc Wraps Wraps SWT JDOM v3.2.2, 90 Kloc v1.1, 9 Kloc 28

  32. Methodology

  33. Methodology 1. Uncover design challenges 30

  34. Methodology 1. Uncover design challenges Source Code Original Developers Type Correspondences 30

  35. Methodology 1. Uncover design challenges Source Code Original Developers Type Correspondences 2. Understand solutions 30

  36. Methodology 1. Uncover design challenges Source Code Original Developers Type Correspondences 2. Understand solutions Source Code Code Queries Design Patterns 30

  37. Methodology 1. Uncover design challenges Source Code Original Developers Type Correspondences 2. Understand solutions Source Code Code Queries Design Patterns 3. Measure presence of design patterns 30

  38. Methodology 1. Uncover design challenges Source Code Original Developers Type Correspondences 2. Understand solutions Source Code Code Queries Design Patterns 3. Measure presence of design patterns Metrics 30

  39. 3 - Study Results

  40. API Wrapping Challenges & Design Patterns

  41. API Wrapping Challenges and Design Patterns Challenge Design Pattern Non-trivial Mapping Multiplicities Layered Adapter Stateful Adapter Inversion of Control Inverse Delegation Correspondence of Object Identities Wrapping Identity Map Varying Creation and Wiring Protocols Delayed Instantiation Varying Type Hierarchies 33

  42. ADAPTER Pattern

  43. Java Vectors to ArrayLists

  44. Vector to ArrayList V ector Application 36

  45. Vector to ArrayList V ector Application i cla Vector i Vector i void add Object i void setSize int 37

  46. Vector to ArrayList V ector Application ro 38

  47. Vector to ArrayList V ector Application ro i cla Vector i Vector i void add Object i void setSize int 39

  48. Vector to ArrayList V ector Application Arra ro i cla Vector i Vector i void add Object i void setSize int 40

  49. Vector to ArrayList V ector Application Arra ro i cla Vector ArrayList ptee i Vector i void add Object i void setSize int 41

  50. Vector to ArrayList V ector Application Arra ro i cla Vector ArrayList ptee i Vector a ptee ArrayList i void add Object a ptee add o i void setSize int le a ptee size a ptee add le a ptee size a ptee o ve 42

  51. Sample GUI Application

  52. Sample GUI Application SWT Swing 44

  53. SWT GUI

  54. SWT GUI 46

  55. SWT GUI Shell 47

  56. SWT GUI Display Shell 48

  57. SWT GUI Display Shell List data 49

  58. SWT GUI Display Shell List data 50

  59. SWT GUI Display Shell List data 51

  60. SWT GUI Display Shell List data Sel i s 52

  61. SWT GUI Display Shell List data Sel i s 53

  62. Swing GUI

  63. Swing GUI 55

  64. Swing GUI JFrame Container 56

  65. Swing GUI JFrame Container JScrollPane 57

  66. Swing GUI JFrame a JScrollPane data 58

  67. Swing GUI JFrame a JScrollPane data 59

  68. Swing GUI JFrame a JScrollPane data n 60

  69. Swing GUI JFrame Container JScrollPane ListModel data n onListener 61

  70. Swing GUI JFrame Container JScrollPane JList ListModel data JCheckBox JButton ActionListener 62

  71. Swing GUI JFrame Container JScrollPane JList ListModel data JCheckBox JButton ActionListener 63

  72. Mapping SWT to Swing

  73. SWT to Swing a Display ai Shell l a Li st st List data data Sel i s i s 65

  74. SWT to Swing Display Shell 66

  75. SWT to Swing JFrame Display Container Shell 67

  76. SWT to Swing JFrame Display Container Shell 68

  77. SWT to Swing JFrame Display Container Shell isDisposed() 69

  78. SWT to Swing a Display ai Shell Li st 70

  79. SWT to Swing a Display ai Shell l a Li st st List data 71

  80. SWT to Swing a Display ai Shell l a Li st st List data 72

  81. SWT to Swing a Display ai Shell l a Li st st List data 73

  82. SWT to Swing a Display ai Shell l a Li st st List data 74

  83. SWT to Swing a Display ai Shell l a Li st st List data 75

  84. SWT to Swing a Display ai Shell l a Li st st List data 76

  85. SWT to Swing a Display ai Shell l a Li st st List data 77

  86. SWT to Swing a Display ai Shell l a Li st st List data 78

  87. Non-trivial Mapping Multiplicities

  88. Target Multiplicities Name Example Display → ∅ No Target Vector → ArrayList Single Target Button → JButton | JCheckBox Alternative Targets List → JList, ListModel Composite Targets 80

  89. Target Multiplicities Name Example Display → ∅ No Target Vector → ArrayList Single Target Button → JButton | JCheckBox Alternative Targets List → JList, ListModel Composite Targets Alternative and Composite List → ( JList, ListModel ) | ( JList, ListModel, JScrollPane ) 80

  90. Layered Adapter

  91. Layered Adapter SimpleJListAdapter ScrollableJListAdapter 82

  92. Layered Adapter SimpleJListAdapter ScrollableJListAdapter Alternative and Composite List → ( JList, ListModel ) | ( JList, ListModel, JScrollPane ) 82

  93. Stateful Adapter

  94. Stateful Adapter 84

  95. SWT to Swing a Display ai Shell l a Li st st List data 85

  96. SWT to Swing a Display ai Shell l a Li st st List data Sel i s 86

  97. SWT to Swing a Display ai Shell l a Li st st List data Sel i s i s 87

  98. SWT to Swing a Display ai Shell l a Li st st List data Sel i s i s 88

  99. Inversion of Control

  100. Inverse Delegation

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend