The Holy GRAILS of web application development

Posted by Bishwas Bhatta on October 12, 2010

Grails Logo
Architecture design for a web application plays a great role in its scalability and robustness. So, it is very important to choose the right technology available for
different aspects of the application without compromising much on the resources spent on doing so. We recently worked on a web application
which targeted a large user base and needed to be platform independent. It integrated a number of popular social networking services but also incorporated other services. The development was done on Grails, a framework of Groovy and jQuery, a library of JavaScript. HTML and CSS was used for creating the user interfaces
and the database was MySQL. For enhancing the performance in processing data and for the integrity of the user-data involved
during the time when the users are online, HBase was used. These technologies have helped us in creating various functionalities of our application with ease and each of them have forte of their own.

Groovy is a relatively new object-oriented programming language which is based upon the Java platform. It utilizes the strengths and speed of Java along with
rapid development features of languages like Python, Ruby etc. So we can build any application utilizing the powers of Java such as multi-threading, platform independence, speedier execution time, robustness etc in very short time utilizing the features like dynamic typing, closures, native support for maps etc. Using these already useful features of Groovy and adding further goodness such as Object Relational Mapping (based on Hibernate) and Model-View-Controller pattern (based on Spring), Grails is the ultimate framework for any web application that requires to be dynamic and robust along with rapid development.

It's paradigm of “coding by convention” allowed us to give less time on configuration and focus more on the development. The Grails' Object Relational Mapping(GORM) made all the database related interaction easier and secure while the powerful Groovy Server Page along with the native support for AJAX meant that the interactions between client side and server side was designed and developed with ease and speed. It's MVC design pattern ensured that there was a clear separation between the business logic, interface design and the control mechanism. The native support for JSON was another feature that allowed us to develop and utilize the full power of AJAX. Whether it was a resource intensive process such as tracing the nodes of a huge data map in Hbase or a simpler AJAX query to handle a user's click, Grails delivered the results without any compromises.

jQuery was the JavaScript framework of our choice. Already a very popular framework for web developers the world over, jQuery can be used for providing every kind of interactivity on the client side. Adding small animations, handling user actions, creating dynamic elements could be done with
very little effort and with no concerns for cross-browser compatibility as jQuery is built to be compatible across all major browsers. Its powerful selectors helped to navigate and control any elements of the webpage and its easy to use AJAX functions helped in creating crisp and quick functionalities into the interface. The flexibility and extensibility of the framework were utilized to include various widgets and dynamic effects such as calenders, type ahead suggestions, sliding controls etc.


The application required to handle a large number of online users at once. This meant that retrieval and storage of user-information involved massive amount of data and the data-integrity had a major importance. Hbase is a distributed database system and has many success stories in the recent years. HBase has good data integrity performance which is primarily because it is based on a distributed software framework Hadoop. Also, write performance and sequential read performance were very important to us in our application as it enabled us to write and store large volumes of data efficiently. In HBase, data rows are stored in labeled tables. A data row has a sortable key and an arbitrary number of columns. When we read/write the database, we traverse in the pre-sorted data-set in the form of a massive graph structure, containing nodes and edges. Due to this, the speed or performance of read and write, for both random and sequential cases, is high compared to other relational, non-distributed database systems. So we used HBase for storing real-time information received dynamically from the user and periodically copied the required data for future use into MySQL.

The use of Grails, the powerhouse of a web development framework, ensured we that not only nailed all the features of the application but also did it with great efficiency and speed. Its ease of use with other technologies such as MySql, Hbase, jQuery saved a lot of development time and made the application more robust. It's features that combined the goodness of a solid language like Java and the dynamic nature of scripting languages like Ruby and Python increased the productivity of the team. It's features, compatibility and ease of use certainly makes it the best framework we've worked on till date. If anyone is looking for developing a web based application which needs to be robust and dynamic and if you have a strict deadline to meet, look no further than Grails.

Written by Aabhushan Mainali and Bishwas Bhatta.