O'Reilly logo

Learning Groovy by Adam L. Davis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Adam L. Davis 2016

Adam L. Davis, Learning Groovy, 10.1007/978-1-4842-2117-4_7

7. DSLs

Adam L. Davis

(1)New York, USA

Groovy has many features that make it great for writing DSLs (Domain Specific Languages ):

  • Closures with delegates.

  • Parentheses and dots (.) are optional.

  • Ability to add methods to standard classes using Category and Mixin transformations.

  • The ability to override many operators (plus, minus, etc.).

  • The methodMissing and propertyMissing methods.

Domain Specific Languages can be useful for many purposes, such as allowing domain experts to read and write code, or to clarify the meaning of business logic. They allow business experts to read or write code without having to be programming experts.

Delegate

Within Groovy you can take a block ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required