SlideShare una empresa de Scribd logo
1 de 36
Descargar para leer sin conexión
What’s new in Groovy & Grails Support?
DSL Support in Groovy-Eclipse
Andrew Eisenberg, SpringSource Tools Team




                                            © 2011 SpringSource, A division of VMware. All rights reserved
What’s new in Groovy & Grails Support?

Part 1




                                 © 2011 SpringSource, A division of VMware. All rights reserved
New Groovy-Eclipse Support in 2.5.0

  DSL Descriptors (discussed later)
  Groovy 1.8
  Parameter guessing content assist
  Script outline view
  Distinguish read vs. write access in search
  Conditional breakpoints in Groovy files (STS only)




                                                        3
New Grails tooling support in STS 2.7.0.M1

  Service field content assist
  Groovy search results in GSPs




                                             4
Gradle support in STS

Part 1.5




                        © 2011 SpringSource, A division of VMware. All rights reserved
First cut at Gradle support now available in STS

  Demoed this morning in the Gradle talk
  Yay!




                                                   6
DSL Support in Groovy-Eclipse

Part 2




                                © 2011 SpringSource, A division of VMware. All rights reserved
The Problem




              8
A DSL for distance calculations




                  3.m + 2.yd + 2.mi - 1.km
       In the Groovy editor:




                                  Uh oh!


      Can we do better???
                                             9
The Solution:
DSL Descriptors (DSLDs)




                          10
DSL Descriptors

  Teach the IDE about DSLs through scripting




                               CONFIDENTIAL     11
DSL Descriptors

  In English:
  •  “Any subtype of Number should have the following properties: m, yd, mi, km”
  In DSLD:
  •  “Any subtype of Number”:
      currentType( subType( Number ) )!
  •  “…the following properties…”:
       [ “m”, “yd”, “cm”, “mi”, “km” ].each {!
            property name:it, type:"Distance”!
       }!




               3.m + 2.yd + 2.mi - 1.km

                                                                                   12
Let’s see that

  Ex 1: Distances




                     13
Anatomy of a DSLD file




                         14
DSLD and the Inferencing Engine
  Hooks into Groovy-Eclipse’s type inferencing engine
 •  Visit each expression AST node
 •  Determine type using previous expression
 •  Move to next expression
  DSLD operates on Groovy AST Expression nodes
 •  Exposes Groovy AST nodes and uses Groovy API
  In the background, while typing (reconciling)
              org.codehaus.groovy.ast.expr.Expression!




                                                         15
Pointcuts and Contribution blocks
  Pointcuts:
  •  Where to do it.
  •  What is the current expression?
  •  Declaring type?                             class Other {!
  •  Enclosing class?                               def x!
                                                 }!
  Contribution blocks:                          class Foo {!
  •  What to do                                     def method() {!
  •  “Add” method                                      new Other().x!
  •  “Add” property                                 }!
                                                 }!
       •  (not at runtime, in the editor only)




                                                                        16
What goes in a Contribution Block?

  property : “adds” a property                  (…).accept {!
 •  arguments                                       property name: “myName”!
   •  name: “blarb”                                 method name: “getMyName”!
                                                 }!
   •  type: “java.lang.String”
   •  declaringType :”com.foo.Frumble”
   •  isStatic: false
   •  doc: “Some html”
   •  provider: “My DSL”
  method : “adds” a method
 •  all arguments above, and
   •  params: [firstName:“java.lang.String”, lastName:“java.lang.String”]
   •  useNamedArgs: true


  name is required, others optional

                                                                            17
Pointcuts

  currentType() : Matches on the current declaring type
  enclosingClass() : Matches on the enclosing class
  currentType(“com.bar.Foo”)
  methods(“run”)
  annotatedBy(“org.junit.runner.RunWith”)
  enclosingClass(
  annotatedBy(“org.junit.runner.RunWith”) ) &
 currentType(methods(“run”) )




                                                           18
Where does this pointcut match? What does it add?
(enclosingClass(annotatedBy(“org.junit.runner.RunWith”)) & 

currentType(methods(“run”))).accept { property name:”blarb” }!

                                       Looking for an expression that:
@RunWith(Sumthin) !
class Foo {!
   def someTest() {!                         enclosed by
                                             @RunWith
      print “Hello”!
      def x = new MyRunner()!
      x.blarb!                                          has run method
   }!
                                                blarb
}!
 class MyRunner { def run() {…} }!




                                                                    19
Wait…isn’t this Aspect-Oriented Programming?

  Pointcut
  •  Intentionally borrowed from AOP
  AspectJ: pointcuts and advice
  •  operates on Java instructions at runtime
                                                               class Foo {!
  DSLD: pointcuts and contribution blocks                       def x = {!
  •  operates on AST                                               def i = 0!
   org.codehaus.groovy.ast.expr.*!
  Join Point Model                                                      i++!
                                                                    }!
  •  Join points (e.g., instructions, expressions)
                                                               }!
  •  Mechanism for quantifying join points (e.g., pointcuts)
  •  Means of affect at a join point (e.g., advice,
   contribution blocks)




                                                                                20
Other things to help with DSLDs




                                  21
New DSLD Wizard

  File  New  Groovy DSL Descriptor




                                        22
DSLD Preferences Page




                        23
Groovy Event Console

  Keep this open while implementing DSLDs:
 •  Shows exceptions
 •  Pointcuts
 •  Matches




  Find the Console here:




                                              24
Groovy AST Viewer

  Exploration of AST of current Groovy file




                                               25
Examples




           26
Basic Script
Ex 2: Using the DSLD wizard




                              27
Meta DSL
Ex 3: DSLD script for editing DSLDs




                                      28
AST Transforms
Ex 3: Standard AST Transforms




                                29
SwingBuilder
Ex 4: Long script, but simple to understand




                                              30
Grails Constraints DSL
Ex 5: encapsulate Grails domain knowledge in a script




                                                        31
Criteria Queries
Ex 6: simple script, large effect




                                    32
Griffon
Ex 7: from last night




                        33
What’s next?




               34
DSLD is not complete

  Guided by user feedback
  Collaboration with library developers
 •  Grails, Gaelyk, Griffon, etc.
  Release standard DSLDs (AST Transforms, Builders, etc.)
 •  With Groovy-Eclipse?
 •  With Groovy core?
  More pointcuts
 •  What do users need that isn’t implemented?
 •  regex(), instanceof(), superType(), enclosingEnum(), etc.
  What about IntelliJ’s GDSL?




                                                                35
Thanks!

  More information:
  •  Google: groovy eclipse dsld
  Full documentation on Codehaus.org:
  •  http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse
  Install from update site:
  •  http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/
  Mailing list:
  •  eclipse-plugin-users@codehaus.org
  Or chat with me whenever




                                                                                  36

Más contenido relacionado

La actualidad más candente

The Ring programming language version 1.5.4 book - Part 15 of 185
The Ring programming language version 1.5.4 book - Part 15 of 185The Ring programming language version 1.5.4 book - Part 15 of 185
The Ring programming language version 1.5.4 book - Part 15 of 185Mahmoud Samir Fayed
 
01 cocos2d past, present and future
01   cocos2d past, present and future01   cocos2d past, present and future
01 cocos2d past, present and future乐费 胡
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaKazuhiro Sera
 
Beyond JVM - YOW Melbourne 2013
Beyond JVM - YOW Melbourne 2013Beyond JVM - YOW Melbourne 2013
Beyond JVM - YOW Melbourne 2013Charles Nutter
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneAndres Almiray
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediZeroTurnaround
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9Marcus Lagergren
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoTaro L. Saito
 
Lagergren jvmls-2014-final
Lagergren jvmls-2014-finalLagergren jvmls-2014-final
Lagergren jvmls-2014-finalMarcus Lagergren
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Charles Nutter
 
Microsoft, java and you!
Microsoft, java and you!Microsoft, java and you!
Microsoft, java and you!George Adams
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?DATAVERSITY
 

La actualidad más candente (14)

The Ring programming language version 1.5.4 book - Part 15 of 185
The Ring programming language version 1.5.4 book - Part 15 of 185The Ring programming language version 1.5.4 book - Part 15 of 185
The Ring programming language version 1.5.4 book - Part 15 of 185
 
01 cocos2d past, present and future
01   cocos2d past, present and future01   cocos2d past, present and future
01 cocos2d past, present and future
 
Scalable Open Source
Scalable Open SourceScalable Open Source
Scalable Open Source
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Beyond JVM - YOW Melbourne 2013
Beyond JVM - YOW Melbourne 2013Beyond JVM - YOW Melbourne 2013
Beyond JVM - YOW Melbourne 2013
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
 
Lagergren jvmls-2014-final
Lagergren jvmls-2014-finalLagergren jvmls-2014-final
Lagergren jvmls-2014-final
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
 
Microsoft, java and you!
Microsoft, java and you!Microsoft, java and you!
Microsoft, java and you!
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?
 

Similar a Better DSL Support for Groovy-Eclipse

GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume LaforgeGR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume LaforgeGR8Conf
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Eugene Lazutkin
 
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...AboutYouGmbH
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slidesEugene Lazutkin
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoRodolfo Carvalho
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovypaulbowler
 
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...David Beazley (Dabeaz LLC)
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdbWei-Bo Chen
 
Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Aman King
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Javaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersJavaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersAndres Almiray
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGlobalLogic Ukraine
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!Alessandro Giorgetti
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0Michael Vorburger
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Vitaly Baum
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring ClojurescriptLuke Donnet
 

Similar a Better DSL Support for Groovy-Eclipse (20)

GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume LaforgeGR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)
 
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slides
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
Pulsar
PulsarPulsar
Pulsar
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
 
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdb
 
Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Javaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersJavaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 Groovybuilders
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
cadec-2017-golang
cadec-2017-golangcadec-2017-golang
cadec-2017-golang
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 

Último

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Better DSL Support for Groovy-Eclipse

  • 1. What’s new in Groovy & Grails Support? DSL Support in Groovy-Eclipse Andrew Eisenberg, SpringSource Tools Team © 2011 SpringSource, A division of VMware. All rights reserved
  • 2. What’s new in Groovy & Grails Support? Part 1 © 2011 SpringSource, A division of VMware. All rights reserved
  • 3. New Groovy-Eclipse Support in 2.5.0   DSL Descriptors (discussed later)   Groovy 1.8   Parameter guessing content assist   Script outline view   Distinguish read vs. write access in search   Conditional breakpoints in Groovy files (STS only) 3
  • 4. New Grails tooling support in STS 2.7.0.M1   Service field content assist   Groovy search results in GSPs 4
  • 5. Gradle support in STS Part 1.5 © 2011 SpringSource, A division of VMware. All rights reserved
  • 6. First cut at Gradle support now available in STS   Demoed this morning in the Gradle talk   Yay! 6
  • 7. DSL Support in Groovy-Eclipse Part 2 © 2011 SpringSource, A division of VMware. All rights reserved
  • 9. A DSL for distance calculations 3.m + 2.yd + 2.mi - 1.km In the Groovy editor: Uh oh! Can we do better??? 9
  • 11. DSL Descriptors   Teach the IDE about DSLs through scripting CONFIDENTIAL 11
  • 12. DSL Descriptors   In English: •  “Any subtype of Number should have the following properties: m, yd, mi, km”   In DSLD: •  “Any subtype of Number”: currentType( subType( Number ) )! •  “…the following properties…”: [ “m”, “yd”, “cm”, “mi”, “km” ].each {! property name:it, type:"Distance”! }! 3.m + 2.yd + 2.mi - 1.km 12
  • 13. Let’s see that   Ex 1: Distances 13
  • 14. Anatomy of a DSLD file 14
  • 15. DSLD and the Inferencing Engine   Hooks into Groovy-Eclipse’s type inferencing engine •  Visit each expression AST node •  Determine type using previous expression •  Move to next expression   DSLD operates on Groovy AST Expression nodes •  Exposes Groovy AST nodes and uses Groovy API   In the background, while typing (reconciling) org.codehaus.groovy.ast.expr.Expression! 15
  • 16. Pointcuts and Contribution blocks   Pointcuts: •  Where to do it. •  What is the current expression? •  Declaring type? class Other {! •  Enclosing class? def x! }!   Contribution blocks: class Foo {! •  What to do def method() {! •  “Add” method new Other().x! •  “Add” property }! }! •  (not at runtime, in the editor only) 16
  • 17. What goes in a Contribution Block?   property : “adds” a property (…).accept {! •  arguments property name: “myName”! •  name: “blarb” method name: “getMyName”! }! •  type: “java.lang.String” •  declaringType :”com.foo.Frumble” •  isStatic: false •  doc: “Some html” •  provider: “My DSL”   method : “adds” a method •  all arguments above, and •  params: [firstName:“java.lang.String”, lastName:“java.lang.String”] •  useNamedArgs: true   name is required, others optional 17
  • 18. Pointcuts   currentType() : Matches on the current declaring type   enclosingClass() : Matches on the enclosing class   currentType(“com.bar.Foo”)   methods(“run”)   annotatedBy(“org.junit.runner.RunWith”)   enclosingClass( annotatedBy(“org.junit.runner.RunWith”) ) & currentType(methods(“run”) ) 18
  • 19. Where does this pointcut match? What does it add? (enclosingClass(annotatedBy(“org.junit.runner.RunWith”)) & 
 currentType(methods(“run”))).accept { property name:”blarb” }! Looking for an expression that: @RunWith(Sumthin) ! class Foo {! def someTest() {! enclosed by @RunWith print “Hello”! def x = new MyRunner()! x.blarb! has run method }! blarb }! class MyRunner { def run() {…} }! 19
  • 20. Wait…isn’t this Aspect-Oriented Programming?   Pointcut •  Intentionally borrowed from AOP   AspectJ: pointcuts and advice •  operates on Java instructions at runtime class Foo {!   DSLD: pointcuts and contribution blocks def x = {! •  operates on AST def i = 0! org.codehaus.groovy.ast.expr.*!   Join Point Model i++! }! •  Join points (e.g., instructions, expressions) }! •  Mechanism for quantifying join points (e.g., pointcuts) •  Means of affect at a join point (e.g., advice, contribution blocks) 20
  • 21. Other things to help with DSLDs 21
  • 22. New DSLD Wizard   File  New  Groovy DSL Descriptor 22
  • 24. Groovy Event Console   Keep this open while implementing DSLDs: •  Shows exceptions •  Pointcuts •  Matches   Find the Console here: 24
  • 25. Groovy AST Viewer   Exploration of AST of current Groovy file 25
  • 26. Examples 26
  • 27. Basic Script Ex 2: Using the DSLD wizard 27
  • 28. Meta DSL Ex 3: DSLD script for editing DSLDs 28
  • 29. AST Transforms Ex 3: Standard AST Transforms 29
  • 30. SwingBuilder Ex 4: Long script, but simple to understand 30
  • 31. Grails Constraints DSL Ex 5: encapsulate Grails domain knowledge in a script 31
  • 32. Criteria Queries Ex 6: simple script, large effect 32
  • 33. Griffon Ex 7: from last night 33
  • 35. DSLD is not complete   Guided by user feedback   Collaboration with library developers •  Grails, Gaelyk, Griffon, etc.   Release standard DSLDs (AST Transforms, Builders, etc.) •  With Groovy-Eclipse? •  With Groovy core?   More pointcuts •  What do users need that isn’t implemented? •  regex(), instanceof(), superType(), enclosingEnum(), etc.   What about IntelliJ’s GDSL? 35
  • 36. Thanks!   More information: •  Google: groovy eclipse dsld   Full documentation on Codehaus.org: •  http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse   Install from update site: •  http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/   Mailing list: •  eclipse-plugin-users@codehaus.org   Or chat with me whenever 36