Grails, formerly known as Groovy on Grails, is a web framework based on Groovy and Java that boasts easy deployment into existing Java web servers. Inspired by Ruby on Rails, Grails promoted “coding by convention” to foster best development practices while maintaining high productivity rates. As it’s based on Groovy, it offers dynamic, object-oriented scripting compiled into bytecode running on the Java Virtual Machine (or JVM).
While Grails isn’t as well known as other frameworks, it’s praised in the software development community thanks to its smart features and general ease of use. Many of the world’s most well-known brands also build their products on Grails. This includes big names such as Disney, Netflix, MTV, LinkedIn, and many others.
Grails runs and was built on “tried-and-true” frameworks like the Spring framework. From them, Grails inherited many of its functionalities and plugins. This, in turn, makes Grails somewhat easier for experienced devs to understand as it utilizes concepts that they already know from other frameworks.
Hiring Guide
The goal of building Grails was to provide a web development framework that works with Java while also pulling existing technologies, such as Spring and Hibernate, into one single interface. This helped to create a consistent working environment that offers documentation for other frameworks, dynamic tag libraries for the simplified creation of web components, as well as customizable Ajax support.
Developers with experience in Java, Ruby on Rails, and other Java frameworks have the ability to pick up Grails with a bit of practice. It does stand out over the other traditional frameworks thanks to its many benefits, including 3 main properties that differentiate it from the crowd.
Grails requires no XML configuration. Creating web apps in Java traditionally requires configuring frameworks and environments not only at the start of development but also throughout the process. It’s a common practice for devs to externalize this configuration into XML files as this makes configuration easier while avoiding embedding configuration within the code.
Developers familiar with traditional Java frameworks know that they must assemble all of the pieces of the development puzzle before beginning a project. With Grails, developers possess the ability to work within a pre-constructed environment that includes not only a web server but also all required libraries as well as a Java web environment.
Grails also includes support for dynamic methods through mixins for server classes. Mixins allow developers to perform operations without the need for implementing interfaces or extending base classes. This further helps with the ease of use of the framework.
To become a Grails developer, candidates should possess a degree in computer science to kick off their experience. They must also have coding experience in Java and Groovy while feeling comfortable working in different development frameworks, such as Agile. Potential Grails developers should also have experience with Apache, SQL, Unix, and general web services.
Interview Questions
What are the best practices for devs to follow while developing with Grails?
While building an app using the Grails framework isn’t terribly difficult, doing it correctly does require following some best practice guidelines. Some of the best practices include:
- Keep controller logic as simple as possible while avoiding code duplication.
- Maintain a consistent look throughout the application pages while keeping views generally low-maintenance.
- Services are transactional by nature but this is a good choice for coarse-grained coding.
- The model domain’s specific logic requires its own domain.
- All text messages in view require moving to “messages.properties” for internalization purposes.
What is the difference between the Grails interactive, shell, and console modes?
Grails console is a Swing-based command console that’s considered similar to the Groovy console. It helps developers execute code against the full coding environment with access to all domain classes. The console mode also helps by allowing for quickly testing code that goes into services and controls. Grails interactive features line interface for grails commands in an interactive manner as the name suggests.
However, Grails shell is the headless version of the Grails console. It proves useful when developers need to access and test code on a remote server. One advantage to this headless version of Grails is that it doesn’t reload when domain classes change as it does when in console mode. This is useful for long-running scripts and testing.
What is “scaffolding” within Grails?
Grails provides scaffolding utilities to help developers out to validate their ideas when building prototypes. It also helps when building admin interfaces. For many developers new to Grails and all it has to offer, scaffolding is one of the top “selling features” of the framework.
Job Description
We are looking for a Java developer experienced in the Grails application framework. Your job will require the designing and overseeing of the implementation of new web applications or updates to existing programs or apps using Java and Grails. Other responsibilities include program consulting, quality assurance testing, coding, as well as reviewing and rewriting code to ensure compatibility across backend frameworks and frontend.
Responsibilities:
- Develop, program, troubleshoot, debug, and maintain Grails-based applications
- Collaborate with development team members to design, develop, and test new features
- Review and rewrite code to ensure backend and frontend compatibility
- Oversee the implementation of new applications
Skills and Qualifications:
- Bachelor’s Degree in Computer Science
- Strong knowledge of Java, Groovy, and Grails framework
- Comfortable working with a variety of development frameworks
- Experience in Apache, Unix, SQL, etc.