Grails: An Introduction to the Platform & Reasons for using it
Grails is a full stack, high-productivity, Open Source web application framework for Java Virtual Machine or JVM. It benefits from Groovy programming language. It is in compliance with Convention over Configuration paradigm which offers both simplicity and flexibility at the same time. This further provides a stand-alone or self-contained environment for development based on naming scheme and hides off most of the confusing configuration details.
With this, one gets instance grails development without the need of any configuration because it offers automatic provision for Apache Tomcat web container as well as the HSQLDB database while the development process is taking place. So, the grails developers have the liberty to use either the database or the web container for the distribution or deployment of the application.
Why to choose Grails in place of other web application framework
First, what brevity does to human languages is done to coding language by this incredible model! As it is based on Groovy programming language, which has much shorter and terser syntaxes compared to those of Java; coding gets short and simple. To be more specific, for every single line of Groovy code, you’re required to write several many of them in Java. Added to this, there are several popular frameworks such as Site Mesh, Hibernate, Spring, and so on that form the backbone of Grails.
Second, it offers a smart and intelligent inbuilt testing support. It distinguishes between Unit Testing and Integration Testing making it much easier to test your products.
Third, Database Migrations & Versioning is equally well handled. You get special plug-in for managing the database migration. Thus, no more the instances of application going out-of-sync with database schema syndrome will be taking place, which is quite common with Java web apps.
Why should this be your web application framework?
This again has several supporting reasons. Some of them are as under.
First, it is based on Groovy language: It works on Groovy programming language which is a superset of Java language as well as a scripting language that offers learning ease. Again, this very programming language has several other advantages such as, in this the coding is far more compact yet expressive and it works on DRY (Don’t Repeat Yourself) principle compared to the coding based on Java. This gives a productive edge to Grails developers as they have to maintain quite a less amount of code.
Second, it offers faster and easier deployment or distribution: As it is based on Convention over Configuration, thus, you don’t have to stress more on the configuration part of your app. It works on a self-contained system that lets it auto wire all the application components on the basis of naming convention making the development process quicker and easier. So, you save more time to write the codes for readying the features instead of unnecessarily getting stuck in creating and configuring the components of the framework. It also has smart defaults and auto-wires that work on the basis of naming conventions.
Third, you get a really large number of plug-ins: It offers really large number of plug-ins as it is an Open Source system and numerous Grails application developers work on it as well as there is also a core Grails development team to work on the same. Thus, they keep contributing to the system. Thus, the processes such as integration of an existing framework or API usage become easier than ever.
Fourth, you get In-built Testing Support: This proves further beneficial as the entire testing process gets easier regardless of what kind of testing you are up to as it works from lower level unit tests to the higher level functional tests more commonly known as Integration Testing. Other than that, you can use any of the testing models such as JUnit, EasyB, Canoo, Spock, Geb, Selenium and so on by simply writing a plugin that will make it work in sync with the testing infrastructure of the Grails.
Fifth, it is super easy to set-up and kick start: Any Java developer can easily start working with it as it is really easy to handle. Most importantly, it gives fun to build apps added to the ease of using it.
Sixth, it offers most incredible features such as DRY (Don’t Repeat yourself); Convention over Configuration; XML Configuration and XML Management. You can write DRY code using this. In fact, it is a great example demonstrating how one can be really DRY while writing codes. Moreover, you don’t face any trouble in using your already written Java code in Grails. Interestingly, you never have to waste your time and efforts in writing any of the plumbing or boilerplate codes on your own while you use this system. So, you really save a whole lot of time that can then be utilized in creating features of your app. And as it works on Convention over Configuration, this further makes things easier as it then works as a self-contained system that uses naming conventions.
Seventh, the Scaffolding feature: It provides you with Scaffolding utilities that support CRUD operations (Create, Read, Update, Delete). This also works great in building prototypes that you need for validating the idea, or for Admin interfaces building. In fact, most new handlers of this platform just fall in love with this feature!
Eighth, “environments have clear separation: You get the liberty of managing your apps on the basis of different environments such as production, staging, local development environments and the likes. You also get a special ease of managing the configurations specific to environments right in your code base. And when aren’t ready to store the configurations specific to certain environment in the code base you have a special externalization option for the configuration also.
Ninth, the GORM: GORM has an exceptionally easy and flexible layer to use in place of Hibernate and some other of the non-relational Data Sources. This feature makes it super easy for the users to communicate with any Data Sources that are supported by GORM. Apart from this, GORM also has support for all the Hibernate (JDBC) supported relational databases and along with this there is also a recent addition of other Data Sources, such as Redis, MongoDb, and etc. that it supports. It also has plans for supporting Google Big Table, JCR, etc. in the future.
Tenth, it is JVM or Java Virtual Machine compliant platform. As you know Groovy is a superset of Java, thus, it is Java rooted or in other words it is made to run on a Java runtime. Now when the code compiles into JVM bytecode, you have the option for making Groovy and Grails applications to run on any of your favorite application servers such as Apache Tomcat and even on the likes of JBoss and Weblogic! Most importantly, you get to reuse all those wonderful libraries that you have in the Java ecosystem within no time! For this, all you’ll have to do is plug in your environment with the Maven or Ivy repository of your choosing or simply try copying some JARs.
With all these reasons in support, it is really meaningful to go for Grails development in place of your conventional platform.
Infoshore is Java development company and also provide grails development services, If you want to discuss any grails development you can contact them via contact page.