Groovy for Domain-specific Languages - Second Edition

(nextflipdebug2) #1
Chapter 12

[ 351 ]

The DSL abstracts out a lot of the complexity for the kids. A normal application with
a mobile frontend and a JSON backend would have a lot of framework code to be
written for it to work, particularly in the area of data binding.


With this DSL, the kids can just declare their state variables in the DSL and
the values of these variables surface with the same names in the UI as part of
MustacheTemplates. The data binding is all handled by the code generated in the
DSL. I'm hoping that in the coming terms it will be possible for them to use the skills
that they have acquired to build their own game engines with the DSL. I'm looking
forward to evolving this DSL in the future.


Summary


The game engine DSL we built in this chapter was clearly designed with teaching
Groovy in mind. However, I also have to admit to a certain amount of contrivance in
how it was built. I had also been looking for a good example DSL to use as the final
example in this book and I hope this one hit the mark on both counts. The integration
problems we needed to solve to get this simple DSL up and running will, I think, be
similar to the ones you will face in your own projects.


We have made use of and built on a lot of the concepts in the book. I hope you have
had some fun along the way and learned a lot of new things. The journey is not over,
however. The next steps are up to you. Happy DSL building!

Free download pdf