© 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 ...

Get Learning Groovy now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.