Venkat Subramaniam Building DSLs In Groovy

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    Venkat Subramaniam Building DSLs In Groovy - Presentation Transcript

    1. BUILDING DSLS IN GROOVY speaker.identity { name 'Venkat Subramaniam' company 'Agile Developer, Inc.' credentials 'Programmer', 'Author', 'Trainer' blog 'http://agiledeveloper.com/blog' email 'venkats@agiledeveloper.com' }
    2. Abstract Groovy's dynamic and meta programming capabilities make it a good candidate for implementing DSLs on the JVM. In this presentation we will take a look at a number of examples of DSLs implemented in Groovy. We will discuss the significance of these DSLs, present other ideas for DSLs use case, and take an look at ways to implement them. 2
    3. Domain Specific Language What’s DSL? A language targeted at a particular type of problem Syntax focuses on intended domain/problem Unlike a general purpose language, you can’t use it for all kinds of stuff (or don’t want to) Limited in scope and capability Hence, they’re small and simple 3
    4. Characteristics of a DSL What are some of the qualities of a DSL? Context Driven Extremely context sensitive Fluent Interfaces Provides for a humane, easy to understand interface 4
    5. Example of Context Routed to context object lst 5
    6. Example of Fluency 6
    7. Examples of Groovy DSLs 7
    8. Examples of Groovy DSLs Gant is Ant without XML Built on top of Ant Pure Groovy syntax to express builds 8
    9. Examples of Groovy DSLs easyb is a Behavior Driven Design tool to express executable documentation of stories and specs Uses Groovy DSLs and is highly expressive Here’s story extracted from above “code”/DSL 9
    10. Examples of Groovy DSLs Groovy’s XML Builder makes building XML tolerable 10
    11. Groovy Tricks to Build DSL Take advantage of closures and delegates 11
    12. Groovy Tricks to Build DSL Take advantage of dynamic methods process.groovy scores.dsl 12
    13. Groovy Tricks to Build DSL Make Use of Categories Type conversions ------------------------ 2 => int .days => int .ago => Calendar .at => Date 13
    14. Groovy Tricks to Build DSL Make Use of ExpandoMetaClass 14
    15. Groovy Tricks to Build DSL Make Use of ExpandoMetaClass 15
    16. References http://groovy.codehaus.org http://docs.codehaus.org/display/GROOVY/Writing +Domain-Specific+Languages http://docs.codehaus.org/display/GROOVY/Gant http://www.easyb.org “Programming Groovy: Dynamic Productivity for the Java Developer,” by Venkat Subramaniam, Pragmatic Bookshelf, 2008. You can download examples and slides from http://www.agiledeveloper.com - download 16
    17. Thank You! Please fill in your session evaluations You can download examples and slides from http://www.agiledeveloper.com - download 17

    + deimosdeimos, 2 years ago

    custom

    1275 views, 3 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1275
      • 1275 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 41
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories