Gombak Horse Riding Club

Introduction

I started my horse riding lessons at this affordable place called Gombak Horse Riding Club. I made a deal with the owner to create a website for him to manage his clients database in exchange for free riding lessons as long as I host the website on my server.

ImageAt the time of writing, this project is a basic website with information regarding the business, and a simple back office to keep track of the list of clients. The project is developed with Grails, using spring security service for the authentication for back office.

Image
Static Scaffolding

Grails supports a feature known as static scaffolding which involves the generation of a CRUD (Create/Read/Update/Delete) interface for a given domain class. For this project, I simply define the Member class and run the command "grails generate-all" to generate a controller and views for the class. This includes the create page, edit page, and list page.

I never use this feature in the more complex web applications as I do not like the code structure it generates. In a proper project I much prefer to have the controller calling service to access the database, so all modifications of data is done at the service side, and controller simply deal with data massaging for the views. With scaffolding however, controller does all the works.


Object Relational Mapping

As for the database, during the start up of the web application, Grails will automatically generate the tables according to your class designs thanks to GORM (Grails Object Relational Mapping). This makes tracking database changes easier, although a more complex class relationships takes a bit of experimenting to get it right. When dealing with large database, a direct sql query would also be much more efficient than manipulating the objects.

Summary

The whole project took me less than an hour from build to deploy. This shows how easy it is to launch a simple project with Grails. The scaffolding feature is amazing, giving you a backbone with just a line of command. In a bigger scale or professional web application however, it is easier to just copy the existing code and modify, as it would already have the same code structure your project use or prefer.