SlideShare a Scribd company logo
1 of 36
Download to read offline
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

More Related Content

What's hot

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
 

What's hot (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 to 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 to 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
 

Recently uploaded

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Recently uploaded (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

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