We’ve all been there. Maybe you were in a rush to get your latest Grails app out the door, or maybe it was a hobby project you were doing in your spare time and things just got out of hand. Hack code, click refresh, hack code, click refresh, (pause to complain about why Grails needs a restart), hack code, click refresh. You know the drill. Refresh-driven development (RDD).
Either way you find yourself with a steaming pile of Grails application, and you dread updating the thing because of the carefully crafted house of cards that it’s become.
I know you wouldn’t do that. But I would. In a heartbeat. But I’m repenting. And changing. I hope.
I’m starting a blog series cataloguing the biggest and shamless Grails hacks that have slowed me down, and I’d like you to join in the conversation. The end result is going to be a talk at SpringOne 2GX in October called Grails Hacker Triage, where we’ll talk about some strategies for treating these shameless hacks.
So, over the next few weeks, I’m hoping to write about my personal “Top 5 Hacks of Shame”:
- The Fat Controller: who needs any other artefact when you have this Golden Hammer! Use implicit transactions, generate markup, do querying. What can’t it do when you get creative?
- The Skinny Model: You wouldn’t want to clutter up your domain classes with domain logic right?
- The Nosey Magic Service: it turns an untyped params object into all kinds of business magic, and has Dr Phil-style co-dependency problems.
- The TagLib that ate Tokyo: it lives and breathes embedded html with a rich tapestry of business logic for good measure. And does a little querying to stay holistic.
- The 100KLOC view: With so many logic taglibs built into Grails, why not use them all? And let’s get polyglot by embedding a bunch of JavaScript and CSS FTW.
I suspect I have good examples of all of these pattern in my personal Grails app archive, so I’m off to do some painful researching and personal contemplation.
Look forward to your input on some great personal hacks and remediations along the way!