O'Reilly logo

Groovy for Domain-Specific Languages by Fergal Dearle

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

Chapter 8. Implementing a Rules DSL

In this chapter, we will look at how we can use Groovy to build a DSL that is capable of implementing business rules for an application. The example we will use is a system for implementing rewards and bonuses of various kinds as part of a promotions system for an online broadband media provider.

Our provider hosts a service that allows users to view videos and play games online. The provider needs to be able to deploy offers to his users rapidly and with the minimum amount of development time. We will come up with a Groovy-based DSL that expresses rewards in such a way that as they can be rapidly developed and deployed in a language that can also be understood by business stakeholders.

This DSL relies on a new ...

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