Reader small image

You're reading from  Groovy for Domain-Specific Languages, Second Edition

Product typeBook
Published inSep 2015
Reading LevelIntermediate
Publisher
ISBN-139781849695404
Edition1st Edition
Languages
Right arrow
Author (1)
Fergal Dearle
Fergal Dearle
author image
Fergal Dearle

Fergal is a seasoned software development professional with 23 years of experience in software product development across a wide variety of technologies. He is currently principal consultant with his own software development consulting company, Dearle Technologies Ltd., engaged in design, development, and architecture for new software products for client companies. In the past Fergal has worked in lead architect and developer roles for Candle Corporation on the OMEGAMON product which is now part of IBMs Tivoli product suite as development manager for the Unix implementations of Lotus 1-2-3. In the early 1990s Fergal lead the team at Glockenspiel that developed CommonView, the first object-oriented UI framework for Microsoft Windows. The team was awarded one of the first ever Jolt Productivity Awards by Dr Dobbs Journal.
Read more about Fergal Dearle

Right arrow

Removing the boilerplate


Any DSL that we develop with Groovy is referred to as an embedded DSL. In other words, it uses language features from the host language in order to build a new mini dialect that achieves a particular goal. As programmers, we can appreciate the elegance of how a closure can define a mini dialect that is embedded within our code. We are used to all of the boilerplate that goes with using a Java library.

By boilerplate, we mean all of the setup code that is needed to establish the context in which our code is running. This could be connecting to a database, establishing a connection to a remote EJB object via a JNDI lookup, and so on. It also includes all of the other code, which is superfluous to the problem at hand but is imposed by the languages and environments that we use. The requirement in Java to write all of our code within a class is a case in point. Comparing the Groovy "Hello, World" program with its Java equivalents, we can see that all but a single line...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Groovy for Domain-Specific Languages, Second Edition
Published in: Sep 2015Publisher: ISBN-13: 9781849695404

Author (1)

author image
Fergal Dearle

Fergal is a seasoned software development professional with 23 years of experience in software product development across a wide variety of technologies. He is currently principal consultant with his own software development consulting company, Dearle Technologies Ltd., engaged in design, development, and architecture for new software products for client companies. In the past Fergal has worked in lead architect and developer roles for Candle Corporation on the OMEGAMON product which is now part of IBMs Tivoli product suite as development manager for the Unix implementations of Lotus 1-2-3. In the early 1990s Fergal lead the team at Glockenspiel that developed CommonView, the first object-oriented UI framework for Microsoft Windows. The team was awarded one of the first ever Jolt Productivity Awards by Dr Dobbs Journal.
Read more about Fergal Dearle