Web Application Development with Groovy and Grails syllubus
- Installation and introduction
Install Groovy using sdkman. Learn about the tools that come with the Groovy installation.
- Variables & Operators
Define Groovy variables.Understand dynamic/static typing support for variables, play with operators.
Learn how to define functions in the Groovy way! Implicit/explicit returns, closures and much more
- Branching & Looping
Learn to make branches in the code using selection statements. Also learn to write loops in Groovy.
- Object oriented programming
Learn object oriented constructs & how Groovy achieves pure object orientation in language design.
- Composition and inheritance
Understand the use of other object oriented concepts like composition, inheritance.
Learn to use groovy collection data types like lists and maps.
- Exception handling
Learn the use of exceptions to alter the flow of a Groovy program, build your own custom exceptions
Learn Groovy goodness like meta object protocol, meta class; that add dynamacity to Groovy
Build custom domain specific languages using builders available in the Groovy programming language
- Introduction and installation
Learn to set up the Grails environment along with a high level tour of the technology
- Model layer
Learn the Grails solution to object relational mapping (GORM), model relationships, querying etc
Learn this Grails component that orchestrates the entire request-response flow.
- Common web concerns
Learn common web concerns like redirect, chaining, data binding; that the controller has to offer
- View layer
Learn the all powerful groovy server pages (GSP) templating language, and understand JSON views
- Service layer
Learn to write complex business logic in this Grails component.
Why have profiles in your Grails project. Practically use REST profile for making rest web services.
- Other common web concerns
Learn to upload files in grails, cookies, session management, server side validation and much more.
What is Grails in Java?
Grails is an open source web application framework that uses the Apache Groovy programming language (which is in turn based on the Java platform).
How do you build a Grails project?
Go to start.grails.org and use the Grails Application Forge to generate your Grails project. You can choose your project type (Application or Plugin), pick a version of Grails, and choose a Profile – then click “Generate Project” to download a ZIP file.
What is Grails Groovy?
Grails is an open source web application framework which uses the Groovy programming language. It is intended to be a high-productivity framework by following the “coding by convention” paradigm, providing a stand-alone development environment and hiding much of the configuration detail from the developer.
Why do we use Groovy?
Groovy is a Java enhancer because it provides greater flexibility and even introduces special features to applications (those that have already been developed can be improved or they can be made from scratch). Groovy is a Java-like syntax, but with the ease of more moldable languages like Python and Ruby.
What is groovy in Java?
A multi-faceted language for the Java platform
Apache Groovy is a powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax.
Why Choose Groovy and Grails for Web Application Development?
Grails is a Rapid Application Development web framework inspired from Ruby on Rails. Grails runs on Java’s Virtual Machine (JVM) and relies on Groovy – a JVM compatible language. Grails is one of the fastest growing RAD (Rapid Application Development) web frameworks.
Grails provides a no ceremony, Convention over Configuration framework that increases the developer’s productivity by multiple times.
In a traditional Java project, one spends weeks writing the initial code to set up the infrastructure but that can be done in a matter of couple of hours with Groovy and Grails. The Speed and Productivity that it gives you is incredible. Development with Grails is not like traditional Java development. Some of the advantages that are associated with Grails are scaffolding, auto reloading of classes (change code, click refresh in browser to see the change), unparalleled testing support, and GORM – greatest of all database abstraction layers.
Grails has provided a solid solution to Java community who can now develop applications with the speed of Rails and at the same time capitalize on the robustness of Java.
Grails follows a DRY (Do Not Repeat Yourself) principle which enables an accommodation of requirements changes with a breeze. Extensive plugins (there are around 500 plugins), vibrant Grails community & extensive online documentation is a big plus and helps developers not to get stuck on any issue for more than a few hours. Its intuitiveness helps speed up the productivity of team members new to Grails framework.
Grails is now being used by companies such as LinkedIn, Pepsi, Wired.com, Sky.com, Aegeon etc.
There is no denying the fact that current adoption of Grails is nowhere near to Rails or Django, leading RAD web frameworks but at the same time, growth of Grails is astonishing.
Grails is now in the making of a main stream technology & RoR of Java world. G2One, the company behind Groovy and Grails was acquired by SpringSource in Nov 2008 and SpringSource was later acquired by VMware which speaks volumes about the growth and importance of Groovy and Grails.
Grails Developers are the ones who all helped in making the open source web application framework Grails a reality. This was known as “Groovy on Rails” previously.What were the Grails developers trying to accomplish here though? Well Grails was developed with a quite a number of things in mind. Some of the major goals included:
• Providing sample applications which would display the frameworks power
• Using previous Java technologies such as hibernate and spring in a consistent yet simple interface
• Having both easy to use and powerful templates
• Having a dynamic tag library so that web page components can easily be created
• Having great Ajax support that can be easily extended or customized
• Providing both a powerful and persistent framework
• Providing a highly productive web framework to work on the Java platform
• Reduction in confusion and promoting easy learning on a consistent framework
• Providing documentation to users for parts of the framework which are relevant
• Providing a comprehensive development mode which should include the automatic reload of resources as well as a web server
When Grails was being designed the grails developers aimed for an easy to learn design which would also be very extensive and an easy way to develop applications. Grails was needed to have just the right amount of balance between very powerful features as well as consistency. Grails was also designed to be very productive. There are three properties Grails has that make it more productive than other tradition Java web frameworks. These include:
A ready to use environment for development
With the traditional Java development environments the responsibility of assembling the development units and this can be a very tedious task. Grails on the other hand comes with a development environment that incorporates a webserver so that the developer will be able to get started without any delays. Grails also prepares the web environment automatically for deployment and all necessary libraries are included in the Grails distribution.
No XML configuration is necessary
When a developer is going to create web applications using Java this involves configuring both frameworks and environments before and during the development. XML was happily welcomed before as initially it was seen to provide much greater consistency when developing applications. Recently though it has been found that XML can be very tedious when setting up an environment. This takes away a lot of productivity time from the developers as they may need to spend some time in understanding and maintaining the configuration as the application grows. With grails the need to add any XML configuration has been taken away.
Functionality is available via mixins
What is a mixin? This is a method that is added to class. These dynamic methods will allow the developer to now perform all needed operations without having to extend the base classes’orimplement interfaces.
With grails,developers have ensured that dynamic methods will be provided based on the type of class. An example of this is a method with automates the process of finding, deleting and saving.