In order to try out a complete Grails development/deployment process I’ve developed a simple Timesheet application.
UPDATE 19/05/2011: I’ve now shut down the cloud server running the timesheet application but if you particularly want to see it or want an in depth tutorial, leave a comment and if there’s enough demand I’ll oblige…
On a recent contract I often found myself doing some calculations mid-week in order to see how my week’s hours were shaping up and I noticed other people using home made Excel spreadsheets for this kind of thing too. A Timesheet planner seemed an ideal Grails sample application to test out my skills on from development right up to putting it live on a cloud server. It’s basic and doesn’t even have a concept a user login but it has the core feature of allowing you to enter your start/end times and lunch breaks and displays a running total for the week.
It’s not too hard to break the validation and I’m sure you can think of lots of obvious missing features but it gave me some practical experience in Groovy on Grails Programming using a MySQL database, setting up and securing a Centos server and deploying to Tomcat 7. I hope to be blogging more about Groovy and Grails in the future but for now, here are a few snippets to whet your appetite if you’ve not yet looked at it:
- Grails ~ Rails but in the Java Universe: having developed with Rails before and having a (mostly) Java background I was at home pretty quickly.
- Safe Navigation Operator: day?.lunch will only try to get the value for the day’s lunch field if it is not null. Convenient.
- dayName.capitalize() – “tuesday” becomes “Tuesday”
- It’s very easy to work on your model and Grails/hibernate will update your database schema as you go.
- No need for semi colons, return statements or exception handling (most of the time)!
- All this simplicity (compared to Java) but you can still make use of any Java API should you need to do so.