Groovy for Domain-Specific Languages Paperback – 1 Jun 2010
|New from||Used from|
- Choose from over 13,000 locations across the UK
- Prime members get unlimited deliveries at no additional cost
- Find your preferred location and add it to your address book
- Dispatch to this address when you check out
Customers who viewed this item also viewed
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
About the Author
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.
Top customer reviews
After reading the book I have to agree that if you intend to create a DSL, which we basically do unintentionally all the time, then Groovy can fulfil these requirements with ease and simplicity.
The book is a easy to read book with clear text, syntax and examples without being too thick and not seem a like a javadoc of information overload. It is rather quick to read through due to the nice flow. The layout do make it a nice reference for myself in the future as it is laid out clearly and contains a large variety of working examples.
The book starts of with first explaining the concepts of what DSL is, what it means in terms of computer science history and how we already use them.
It then goes on to explain in clear but complete detail what Groovy is and does. Actually these chapters are a good introduction to Groovy book in themselves.
Dearle then procedes to explain the main technologies built on top or as part of Groovy such as the web framework: Grails, the Groovy Ant builder scripting tool: Gant, Groovy & Grails ORM database mapper: Gorm, BDD frameworks and similar technologies. This it does in enough detail so that you have a good idea what they do and can experiment with yourself afterwards.
The last half of the book Dearle then brings Groovy and the related technologies back into the DSL fold and explains why and how Groovy is excellent for DSL writing. E.g: Groovy's dynamic nature, closures, or the multitude of "Builders" which basically are DSLs outright.
These chapters of the book has a large set of basically Cook Book examples of Groovy DSL writing, builders and finishes with how to integrate Groovy with Spring, XML, Ant and existing Java applications.
I was already aware of Groovy's suitability as a DSL language, but I am now even more convinced of its power, ease and fit as a or rather the DSL.
(Note: I was given a free copy of this book, which saved me money as I would have bought it anyway)
Most helpful customer reviews on Amazon.com
Unfortunately the book doesn't go too far. I was expecting to finish it as a super DSL ninja, but I feel more like a karate kid instead. This is the downside of having unexperienced people as the target audience. Some of the most powerful Groovy features, such as AST manipulation were left ouf of the scope of the book.
The biggest problem of this book is the formatting (I am reading the kindle version). There is no indentation for code blocks. This means that any code with more than a few lines is extremely difficult to understand. I am working around that reading the book on my mac with the source files open next to it. Finding the appropriate source files for each code block is not a pleasant task though. There are still many minor typos and formatting problems.
The first chapter is a decent enough introduction, it serves well to setup the rest of the book. It's a nice introduction to the concepts of DSL & explains why Groovy was chosen as the language of choice.
The second chapter introduces Groovy at a basic level, one change from the previous edition that I'm happy was done, was to split the language concepts in depth into a standalone chapter. In the previous edition, the 2nd chapter was a bit of a behemoth.
The third chapter introduces some basic Groovy DSL that you may or may not have heard of. This gives a nice peek into Gradle & Spock & helped me correlate how they are, in fact, DSLs.
The fourth & fifth chapter introduce, in this order, Groovy's concepts (you may skip this if you aren't a total beginner with Groovy), and Closures in Groovy (you could skip this as well, unless you come from a background where closures are new, in that case, don't skip it!)
It's important to note that this book isn't to learn Groovy, (I'd recommend Groovy in Action, 2nd ed from Manning), the basics that you'd need are covered, but no more, and more concepts are introduced as you need them in your DSL. I'm judging it as a gateway to DSLs in Groovy & not as a gateway to Groovy the language. Your mileage may vary, of course.
Chapter 6 is where we dive into our first Groovy DSL, a Twitter client. I'm a little conflicted by the example, which is well done, but I'd personally have chosen something like a Banking example, where you could showcase different domain rules & you'd have a lot of scenarios with tons of boilerplate code in Java, which could be broken down into a Groovy DSL.
Chapters 7 introduce us to some patterns & advanced techniques (or Power Features, as suggested by the chapters title) that we can leverage in our DSLs. This is where I started to sort of disagree with the book. I would have preferred that a single Domain be used as the basis for our example application/DSL, wherein we build it up & make it more feature-rich, by adding the concepts into that single DSL as these concepts are introduced to us.
Don't get me wrong, the examples are clear & do a great job of explaining the concept, e.g. Chapter 10, Building a Builder, has a great example of using these patterns to build a database seed builder (something I've tried to do in Java, only to have it devolve into an unholy mess)
Chapter 8 again does a good job of explaining (what is a tough topic to digest for me) Abstract Syntax Trees (ASTs), I thought it was a neat, well-thought out chapter, with a nice enough example implementation of a state machine at the end.
Chapter 9 shows how Groovy DSLs Spock & Grails implement features & techniques we saw earlier, this is where the book starts to win my attention back. It was nice to see how the techniques we read about earlier are used in real-world, full-fledged DSLs
Chapter 11 & 12 are where it really shines again, first with an example in 11 for a rules based DSL (which should have been our example application from the beginning, in my view) & then with a full-fledged game app, complete with a backing MongoDB & a web based front-end. Again, the examples are well done, the explanation is really great.
Conclusion: If you have the first edition, you could give the 2nd ed a skip. A good book, but the constant switching of contexts lost me from time-to-time. If you're looking to understand how DSLs are implemented (& want to move beyond Java) this is a nice starting point.
Writing DSLs is an important part of project delivery where there's a need to mimic domain structures and concepts within the programming environment, at times when traditional OO modelling is not enough.
This book covers theory and practice of the subject very well - recommended reading for those who want to venture into DSL programming.
Look for similar items by category