Preface

A few months ago I enjoyed a pleasant dinner with Marjan Bace, Grand Poobah[1] at Manning Publications, the company that printed the book you now hold in your hands.[2] Eventually the conversation turned to Joseph Campbell’s Hero’s Journey as it might apply to nonfiction, technical books. The basic concept is that a Hero is called to Action, encounters various Forces arrayed against Him (or Her); Defeats them; wards off Temptation; is Transformed by the journey; and eventually returns Home Triumphant.[3] Some publishing companies strongly recommend that their books follow that model, with the reader as hero.

1 His actual title is Publisher.

2 In print form, on a tablet, or whatever.

3 In case you don’t want to read the original Campbell, the Wikipedia page at http://en.wikipedia.org/wiki/Monomyth summarizes all 17 (!) stages.

Marjan’s idea, however, was that sometimes it isn’t the reader who is the hero; it’s the technology covered by the book. In the case of Making Java Groovy, I interpret that to mean that Groovy is the hero. Where does that put Java? Not as antagonist, surely; the whole point of this book is that Java is already your ally, and that adding Groovy makes it better. Groovy and Java are like Frodo and Samwise Gamgee, headed into the black depths of Mordor, battling privation and despair, desperately trying to defeat the horrible programming challenges that await them, as well as any orcs, Nazgûl, or clueless managers they might encounter along the way.

That’s a little dark. Plus, I have no idea what the Ring of Power is in this analogy, or why you’d want to destroy it.[4] Instead, I’ll simply say that Groovy and Java work really, really well together, and I’ll spend the rest of the book demonstrating how, when, and why.

4 I do hope that if you’re holding a print copy of the book (that is, dead-treeware), no Ents were involved.

For those of you shifting nervously from side to side, worried that the attempts at “humor” in this preface will be sprayed liberally throughout the book (thus distracting from the actual content), let me assure you that other than in this preface, I promise to confine any attempts at humor to footnotes that can be safely skipped.[5]

5 Like this one: How many developers does it take to change a light bulb? The classic answer is, “None; that’s a hardware problem.” My answer is, “The developer is the person by the light switch saying, ‘Maybe this time the light will go on. Or maybe this time. Reboot again.’”

When I’m teaching my technical training classes,[6] I realize that humor is a high-risk/high-reward tool. Nobody wants to hear a joke when they’re confused. On the other hand, programming can be a dry [7] subject, and some humor can break up the monotony. Hopefully I’ve found the right balance in this book. If not, or if you have any other questions, comments, or heard any good jokes lately, feel free to contact me through the book forum at Manning, or directly through my blog on my website at http://www.kousenit.com.

6 Seriously, Best Training Anywhere. Contact me for a quote, which will inevitably rise once this book is published.

7 I was going to make a DRY—Don’t Repeat Yourself—joke here but eventually decided against it.

The source code for the book is available in my GitHub repository.[8] If you examine it, you’ll find more examples than the ones covered in the book. Books have length limits, but source code repositories don’t, and extra examples can’t hurt. I decided to use the book’s repository as a home for any examples I felt were interesting or relevant, even if I couldn’t justify the extra pages necessary to discuss them.

8 Check it out at https://github.com/kousen/Making-Java-Groovy.

Again, keeping to the principle that the chapters should be as independent as possible, each project has its own Gradle build file.[9] All the examples have tests as well. The short snippets of code include Groovy assert statements, and test cases are used to execute the scripts during a build. The rest of the examples have a mix of JUnit tests, in Java or Groovy, and Spock tests. In practice I freely intermix both, so it seemed natural to do so here, too.

9 Except in the build chapter (chapter 5), where they have Ant or Maven build files, as appropriate.

Enjoy the hero’s journey[10] that is Making Java Groovy!

10 So are you the hero, or is Groovy? Let me be blunt. Did you pay for this book? Then you’re my hero. Duh.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.166.31