Model Driven Software Development
                       with Eclipse



                            Sven Efftinge

      ...
MDA
Model Driven Architecture
MDSD IS NOT MDA!
TOP5
     DON’TS
IN CODE GENERATION
UML for
CODE GENERATION?
CODE GENERATION
USED TO CONSTRAIN
DEVELOPERS
SLOW GENERATION /
BAD INTEGRATION
OVER-REUSE
OVER-ENGINEERING
• Domain Specific Language Development Framework
• Based on:
 • Eclipse
 • Eclipse Modeling Framework (EMF)
 • Antlr parser...
•   Domain mming Language Development Framework
     Progra Specific
•   Based on:
    • Eclipse
    • Eclipse Modeling Fra...
•   Domain mming Language Development Framework
     Progra Specific
•   Based on:
•   Domain mming Language Development Framework
     Progra Specific
•   Based on:
    • Eclipse
•   Domain mming Language Development Framework
     Progra Specific
•   Based on:
    • Eclipse
    • Eclipse Modeling Fra...
•   Domain mming Language Development Framework
     Progra Specific
•   Based on:
    • Eclipse
    • Eclipse Modeling Fra...
• History
• History
 • 2005 : Prototype @ openArchitectureWare
• History
 • 2005 : Prototype @ openArchitectureWare
 • 2007 : Xtext goes Eclipse TMF
• History
 • 2005 : Prototype @ openArchitectureWare
 • 2007 : Xtext goes Eclipse TMF
 • 01/2008 : itemis forms developmen...
• History
 • 2005 : Prototype @ openArchitectureWare
 • 2007 : Xtext goes Eclipse TMF
 • 01/2008 : itemis forms developmen...
• History
 • 2005 : Prototype @ openArchitectureWare
 • 2007 : Xtext goes Eclipse TMF
 • 01/2008 : itemis forms developmen...
in numbers
9 active committers
~1.000.000
lines of code
~2.000 unit tests
~400 newsgroup
messages per month
~200 Followers for
    @Xtext
-6.750
Hudson build points
182 project years
182 project years
 says Ohloh.net
Some



       users
Deutsche Börse
 Systems AG
Fraunhofer IWES
BMW Car IT
APG Affichage
@SuppressWarnings("serial")
@Entity
 Entity
@Table(name = "BUCHUNGSKREISE_F")
               BUCHUNGSKREISE_F
public class...
@SuppressWarnings("serial")
@Entity
 Entity
@Table(name = "BUCHUNGSKREISE_F")
               BUCHUNGSKREISE_F
public class...
External DSL with Xtext

entity BuchungskreiseF
 (id=bkrId sequenceName=BKR_SEQ) {

    String kontoNr   (notNull, length=...
External DSL with Xtext

entity BuchungskreiseF
 (id=bkrId sequenceName=BKR_SEQ) {

    String kontoNr

    Long rgNrBkrId...
External DSL with Xtext
                               BUCHUNGSKREISE_F

entity BuchungskreiseF
 (id=bkrId sequenceName=BK...
entity BuchungskreiseF
  (id=bkrId sequenceName=BKR_SEQ)
{
}
entity BuchungskreiseF
               (id=bkrId sequenceName=BKR_SEQ)
             {
             }



                   ...
entity BuchungskreiseF
               (id=bkrId sequenceName=BKR_SEQ)
             {
             }



                   ...
Getting Started with Xtext
Working with
Codegeneration


Editor
Codegeneration


Editor




   AST
Editor




            AST
                                 TeX Xpa
                               T ma  p
               ...
Editor




                      AST
                                                 TeX Xpa
                            ...
Accessing models from Java
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");

// create ...
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");

// create ...
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");

// create ...
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");

// create ...
Accessing models from Java
// create a URI that points to the model file
URI uri = URI.createURI("foo.mydsl");

// create ...
Integration with EMF
Integration with EMF
                                              eclipse

                              Any EMF-based   ...
Integration with EMF
                                                eclipse

                                Any EMF-base...
Integration with EMF
                                                eclipse

                                Any EMF-base...
Integration with EMF
                                                eclipse

                                Any EMF-base...
Integration with EMF
                                                eclipse

                                Any EMF-base...
Integration with EMF
                                                 eclipse

                                 Any EMF-ba...
Integration with EMF
                                                 eclipse

                                 Any EMF-ba...
Integration with EMF
                                                  eclipse

                                 Any EMF-b...
Integration with EMF
                                                  eclipse

                                 Any EMF-b...
Customizing




              licensed by http://www.wordle.net/
Customizing




              licensed by http://www.wordle.net/
Customizing




              licensed by http://www.wordle.net/
Customizing




              licensed by http://www.wordle.net/
Customizing




              licensed by http://www.wordle.net/
Customizing
         MyCustomLabelProvider




                     licensed by http://www.wordle.net/
Dependency Injection with
     Google Guice
Dependency Injection with
     Google Guice
Dependency Injection with
      Google Guice




No dependency to concrete implementation
Dependency Injection with
      Google Guice




No dependency to concrete implementation
No explicit construction
Dependency Injection with
      Google Guice




No dependency to concrete implementation
No explicit construction
Easy te...
Dependency Injection with
      Google Guice




No dependency to concrete implementation
No explicit construction
Easy te...
Advanced Editor
   Features
Navigation and Validation
Navigation and Validation
Find declaration
    in index
Default builder indexes
   whole class path
Incremental builder
Incremental builder
Incremental generation
Incremental generation
Textual
      &
Graphical
    Combined
Navigation
Navigation
Inplace editing
Inplace editing
Referring
      to
            Types
Referring
              to
                         Types
• EMF Model for Java types and their members
Referring
              to
                         Types
• EMF Model for Java types and their members
• @Runtime: java.la...
Referring
              to
                         Types
• EMF Model for Java types and their members
• @Runtime: java.la...
Java classes
Java classes
Imports
for Java types
Imports
for Java types
Instant feedback
Content Assist
... with respect to imports
Navigation to Java source code
Advanced matching of proposals
Questions?
     www.xtext.org   Twitter: @Xtext
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
MDSD with Eclipse @ JUG Hamburg
Upcoming SlideShare
Loading in...5
×

MDSD with Eclipse @ JUG Hamburg

6,465

Published on

Published in: Technology

MDSD with Eclipse @ JUG Hamburg

  1. 1. Model Driven Software Development with Eclipse Sven Efftinge Sebastian Zarnekow
  2. 2. MDA Model Driven Architecture
  3. 3. MDSD IS NOT MDA!
  4. 4. TOP5 DON’TS IN CODE GENERATION
  5. 5. UML for CODE GENERATION?
  6. 6. CODE GENERATION USED TO CONSTRAIN DEVELOPERS
  7. 7. SLOW GENERATION / BAD INTEGRATION
  8. 8. OVER-REUSE
  9. 9. OVER-ENGINEERING
  10. 10. • Domain Specific Language Development Framework • Based on: • Eclipse • Eclipse Modeling Framework (EMF) • Antlr parser generator
  11. 11. • Domain mming Language Development Framework Progra Specific • Based on: • Eclipse • Eclipse Modeling Framework (EMF) • Antlr parser generator
  12. 12. • Domain mming Language Development Framework Progra Specific • Based on:
  13. 13. • Domain mming Language Development Framework Progra Specific • Based on: • Eclipse
  14. 14. • Domain mming Language Development Framework Progra Specific • Based on: • Eclipse • Eclipse Modeling Framework (EMF)
  15. 15. • Domain mming Language Development Framework Progra Specific • Based on: • Eclipse • Eclipse Modeling Framework (EMF) • Antlr parser generator
  16. 16. • History
  17. 17. • History • 2005 : Prototype @ openArchitectureWare
  18. 18. • History • 2005 : Prototype @ openArchitectureWare • 2007 : Xtext goes Eclipse TMF
  19. 19. • History • 2005 : Prototype @ openArchitectureWare • 2007 : Xtext goes Eclipse TMF • 01/2008 : itemis forms development team
  20. 20. • History • 2005 : Prototype @ openArchitectureWare • 2007 : Xtext goes Eclipse TMF • 01/2008 : itemis forms development team • 06/2009 : TMF Xtext 0.7.0 @ Eclipse Galileo
  21. 21. • History • 2005 : Prototype @ openArchitectureWare • 2007 : Xtext goes Eclipse TMF • 01/2008 : itemis forms development team • 06/2009 : TMF Xtext 0.7.0 @ Eclipse Galileo • 09/2009 : Galileo SR1 with Xtext 0.7.2
  22. 22. in numbers
  23. 23. 9 active committers
  24. 24. ~1.000.000 lines of code
  25. 25. ~2.000 unit tests
  26. 26. ~400 newsgroup messages per month
  27. 27. ~200 Followers for @Xtext
  28. 28. -6.750 Hudson build points
  29. 29. 182 project years
  30. 30. 182 project years says Ohloh.net
  31. 31. Some users
  32. 32. Deutsche Börse Systems AG
  33. 33. Fraunhofer IWES
  34. 34. BMW Car IT
  35. 35. APG Affichage
  36. 36. @SuppressWarnings("serial") @Entity Entity @Table(name = "BUCHUNGSKREISE_F") BUCHUNGSKREISE_F public class BuchungskreiseF extends AbstractEntity implements Serializable { @SuppressWarnings("unused") @Id Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "bkrIdSeq") @SequenceGenerator(name = "bkrIdSeq", sequenceName = "BKR_SEQ", allocationSize = 1) BKR_SEQ @Column(name = "BKR_ID", nullable = false BKR_ID false) private Long bkrId bkrId; public Long getBkrId() { return bkrId; } public void setBkrId(final Long bkrId) { this.bkrId = bkrId; } @Column(name = "KONTO_NR", nullable = false length = 45 KONTO_NR false, 45) private String kontoNr; kontoNr public String getKontoNr() { return kontoNr; } public void setKontoNr(final String kontoNr) { String oldValue = this.kontoNr; this.kontoNr = kontoNr; firePropertyChangeEvent("kontoNr", oldValue, this.kontoNr); }
  37. 37. @SuppressWarnings("serial") @Entity Entity @Table(name = "BUCHUNGSKREISE_F") BUCHUNGSKREISE_F public class BuchungskreiseF extends AbstractEntity implements Serializable { @SuppressWarnings("unused") @Id Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "bkrIdSeq") @SequenceGenerator(name = "bkrIdSeq", sequenceName = "BKR_SEQ", allocationSize = 1) BKR_SEQ @Column(name = "BKR_ID", nullable = false BKR_ID false) private Long bkrId bkrId; public Long getBkrId() { return bkrId; } public void setBkrId(final Long bkrId) { this.bkrId = bkrId; } @Column(name = "KONTO_NR", nullable = false length = 45 KONTO_NR false, 45) private String kontoNr; kontoNr public String getKontoNr() { return kontoNr; } public void setKontoNr(final String kontoNr) { String oldValue = this.kontoNr; this.kontoNr = kontoNr; firePropertyChangeEvent("kontoNr", oldValue, this.kontoNr); }
  38. 38. External DSL with Xtext entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { String kontoNr (notNull, length=45) Long rgNrBkrIdentifikator (notNull, length=1) String referenzcodeKontoNr (notNull, length=45) }
  39. 39. External DSL with Xtext entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { String kontoNr Long rgNrBkrIdentifikator String referenzcodeKontoNr }
  40. 40. External DSL with Xtext BUCHUNGSKREISE_F entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { String kontoNr RG_NR_BKR_IDENTIFIKATOR Long rgNrBkrIdentifikator String referenzcodeKontoNr }
  41. 41. entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { }
  42. 42. entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { } TABLE BUCHUNGSKREISE_F ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 Database Schema
  43. 43. entity BuchungskreiseF (id=bkrId sequenceName=BKR_SEQ) { } TABLESimilar to BUCHUNGSKREISE_F Ruby On Rails ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 ID NAME PROP1 DATE ATTR1 Database Schema
  44. 44. Getting Started with Xtext
  45. 45. Working with
  46. 46. Codegeneration Editor
  47. 47. Codegeneration Editor AST
  48. 48. Editor AST TeX Xpa T ma p TeXeXpa p n nd m l p Te m a p n ad m pln lad te pl ad te at te e Generator Codegeneration
  49. 49. Editor AST TeX Xpa T ma p TeXeXpa p n nd m l p Te m a p n ad m pln lad te pl ad te at te e Generator Codegeneration E Ex xe Ex A c r Ex Ae etcu uta Aecrtcuifata bl A rti uifata ctbl e rt fata ctb e ifa c b le ct t le
  50. 50. Accessing models from Java
  51. 51. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl");
  52. 52. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl"); // create a resource Resource resource = new ResourceSetImpl().getResource(uri,true);
  53. 53. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl"); // create a resource Resource resource = new ResourceSetImpl().getResource(uri,true); // get root model element from resource Model model = (Model) resource.getContents().get(0);
  54. 54. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl"); // create a resource Resource resource = new ResourceSetImpl().getResource(uri,true); // get root model element from resource Model model = (Model) resource.getContents().get(0); // print name of first element System.out.println(model.getElements().get(0).getName());
  55. 55. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl"); // create a resource Resource resource = new ResourceSetImpl().getResource(uri,true); // get root model element from resource Model model = (Model) resource.getContents().get(0); // print name of first element System.out.println(model.getElements().get(0).getName()); // change name of first element to "Bar" model.getElements().get(0).setName("Bar");
  56. 56. Accessing models from Java // create a URI that points to the model file URI uri = URI.createURI("foo.mydsl"); // create a resource Resource resource = new ResourceSetImpl().getResource(uri,true); // get root model element from resource Model model = (Model) resource.getContents().get(0); // print name of first element System.out.println(model.getElements().get(0).getName()); // change name of first element to "Bar" model.getElements().get(0).setName("Bar"); // save resource resource.save(null);
  57. 57. Integration with EMF
  58. 58. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component
  59. 59. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMIResource Resource
  60. 60. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMIResource Resource
  61. 61. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource
  62. 62. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource
  63. 63. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource XtextResource
  64. 64. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource XtextResource
  65. 65. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource XtextResource Text
  66. 66. Integration with EMF eclipse Any EMF-based modeling Code Generator GMF Editor P R O J E C T Component <<abstract>> XMI XMIResource Resource XtextResource Text Parser Linker Serializer ValueConverter ScopeProvider Formatter
  67. 67. Customizing licensed by http://www.wordle.net/
  68. 68. Customizing licensed by http://www.wordle.net/
  69. 69. Customizing licensed by http://www.wordle.net/
  70. 70. Customizing licensed by http://www.wordle.net/
  71. 71. Customizing licensed by http://www.wordle.net/
  72. 72. Customizing MyCustomLabelProvider licensed by http://www.wordle.net/
  73. 73. Dependency Injection with Google Guice
  74. 74. Dependency Injection with Google Guice
  75. 75. Dependency Injection with Google Guice No dependency to concrete implementation
  76. 76. Dependency Injection with Google Guice No dependency to concrete implementation No explicit construction
  77. 77. Dependency Injection with Google Guice No dependency to concrete implementation No explicit construction Easy testing
  78. 78. Dependency Injection with Google Guice No dependency to concrete implementation No explicit construction Easy testing Easy composition
  79. 79. Advanced Editor Features
  80. 80. Navigation and Validation
  81. 81. Navigation and Validation
  82. 82. Find declaration in index
  83. 83. Default builder indexes whole class path
  84. 84. Incremental builder
  85. 85. Incremental builder
  86. 86. Incremental generation
  87. 87. Incremental generation
  88. 88. Textual & Graphical Combined
  89. 89. Navigation
  90. 90. Navigation
  91. 91. Inplace editing
  92. 92. Inplace editing
  93. 93. Referring to Types
  94. 94. Referring to Types • EMF Model for Java types and their members
  95. 95. Referring to Types • EMF Model for Java types and their members • @Runtime: java.lang.reflect
  96. 96. Referring to Types • EMF Model for Java types and their members • @Runtime: java.lang.reflect • @Eclipse: org.eclipse.jdt.core
  97. 97. Java classes
  98. 98. Java classes
  99. 99. Imports for Java types
  100. 100. Imports for Java types
  101. 101. Instant feedback
  102. 102. Content Assist
  103. 103. ... with respect to imports
  104. 104. Navigation to Java source code
  105. 105. Advanced matching of proposals
  106. 106. Questions? www.xtext.org Twitter: @Xtext
  1. A particular slide catching your eye?

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

×