© 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.