Venkat Subramaniam Building DSLs In Groovy

50 %
50 %
Information about Venkat Subramaniam Building DSLs In Groovy

Published on March 16, 2008

Author: deimos

Source: slideshare.net

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' }

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

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

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

Example of Context Routed to context object lst 5

Example of Fluency 6

Examples of Groovy DSLs 7

Examples of Groovy DSLs Gant is Ant without XML Built on top of Ant Pure Groovy syntax to express builds 8

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

Examples of Groovy DSLs Groovy’s XML Builder makes building XML tolerable 10

Groovy Tricks to Build DSL Take advantage of closures and delegates 11

Groovy Tricks to Build DSL Take advantage of dynamic methods process.groovy scores.dsl 12

Groovy Tricks to Build DSL Make Use of Categories Type conversions ------------------------ 2 => int .days => int .ago => Calendar .at => Date 13

Groovy Tricks to Build DSL Make Use of ExpandoMetaClass 14

Groovy Tricks to Build DSL Make Use of ExpandoMetaClass 15

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

Thank You! Please fill in your session evaluations You can download examples and slides from http://www.agiledeveloper.com - download 17

Add a comment

Related pages

Venkat Subramaniam: Into the Groove - DZone Java

Dr. Venkat Subramaniam is a well known ... Building internal DSLs is real ... Do you have a favorite technique when coding DSLs in Groovy ? Venkat: ...
Read more

Skills Matter

Building DSLs: Marriage of High Essence and Groovy Metaprogramming Featuring Venkat Subramaniam. DSLs or Domain Specific Languages focus on a domain or a ...
Read more

DSL in Groovy - By Venkat Subramaniam - April 18 - 20 ...

DSL in Groovy. Saturday, 3:15 PM ... Examples of DSLs in Groovy Creating DSLs in Groovy. Venkat Subramaniam. About Venkat Subramaniam Founder of Agile ...
Read more

The Pragmatic Bookshelf | Programming Groovy

... Venkat Subramaniam, isbn ... Programming Groovy will help you learn the necessary fundamentals of programming in Groovy. ... Creating DSLs in Groovy;
Read more

Is Groovy a Better Choice Than Java for Creating Internal ...

Venkat Subramaniam explains why "Essence over ceremony" and "Metaprogramming" features in a dynamic language like Groovy help in developing ...
Read more

Venkat Subramaniam - Biography - No Fluff Just Stuff

Dr. Venkat Subramaniam is an ... What’s a better way to learn about a library than actually building an ... the ability to create internal DSLs, ...
Read more

The Pragmatic Bookshelf | Programming Groovy 2

... Programming Groovy 2: ... Venkat Subramaniam, isbn ... Creating DSLs is easier now, and Groovy’s already-powerful metaprogramming facilities ...
Read more

Building DSLs: Marriage of High Essence and Groovy ...

Venkat Subramaniam: DSLs or Domain Specific Languages focus on a domain or a particular ... Building DSLs: Marriage of High Essence and Groovy Metaprogramming.
Read more

Programming Groovy 2: Dynamic Productivity for the Java ...

Programming Groovy 2: Dynamic Productivity for the Java Developer (Pragmatic Programmers) [Venkat Subramaniam] on Amazon.com. *FREE* shipping on qualifying ...
Read more