Jump into Groovy and Grails: a 2-day class
Groovy is a remarkably easy language to learn and use, whether you're a seasoned Java developer or newcomer to the Java platform. Grails makes web development both fun and productive. Together, they'll show you what "next generation Java development" means.
It's been said that Java is more than a programming language -- it's a platform. Indeed, it's an ecosystem where multiple languages can operate and co-exist. In fact, there are over 200 languages supported by the JVM; however, only a few have gained a large mind share. One of them is Groovy, which is distinct from other JVM languages -- its syntax is a subset of Java's syntax. This means, of course, you don't have to learn an entire new language to code with Groovy. What's more, while other languages build upon their parents' libraries, Groovy employs the features and libraries Java developers are most familiar with, but puts them in an rapid development framework. Groovy makes Java development easier, faster, and a lot of fun by:
- Permitting dynamic types, which means increased flexibility
- Freeing developers from compilation, which means increased turn around time
- Easing syntactical constructs, which allows for faster development times
What's more, Grails is a Java-and Groovy-based web framework that is built for quick turnaround. First-time developers are amazed at how quickly a page-centric Model-View-Controller (MVC) web site is up and running (thanks to the conventions and tools which Grails provides). Plus, Grails builds upon the core frameworks ubiquitous in the Java world today: Spring and Hibernate.
Objective
To give seasoned Java developers a quick introduction to Groovy (a next-generation Java language) and Grails (a modern web framework written in Groovy).
Goals
You will be comfortable installing and upgrading Groovy. You'll see how Groovy seamlessly integrates with existing Java code through the GDK. You'll learn about Groovy collections, closures in action, XML processing, GroovySQL, Groovlets, and metaprogramming. You'll then focus on Grails: installing Grails, understanding GORM, mapping to legacy databases, handling security with the Acegi plug-in, and publishing RESTful web services.
Course Outline
Throughout the program students will be challenged with lab exercises that will drive home various techniques of programming in Groovy and leveraging Grails, which will serve to provide an energizing and engaging learning environment. Students will then be able to leverage what they will learn in this course on their respective company's applications immediately with confidence. Companies will benefit from having more confident developers who can quickly design, construct, and maintain highly structured, testable code.
Most labs will leverage a form of testing as a means to validate the lesson. That is, students will be given easyb stories that are either in a pending state or failing. Through out the course of a lab, students will invoke techniques germane to the lab to ensure that the corresponding easyb stories are running in a passable state.
Getting started with Groovy
Groovy is Java -- just without a lot of ceremony inherent in Java's syntax. But as you'll learn in this workshop, Groovy classes, while terse in nature are normal Java classes at the byte code. In fact, as you'll see, anything you write in Groovy can be used in Java and vice versa.
The GDK
Groovy adds quite a few new methods to core Java classes that facilitate programming in new and exciting ways -- students will learn the core methods that enhance Java classes like File, String, and even Thread.
Groovy collections
Students will learn to leverage Groovy's Collections as a native implementation of Java's collections with the added functionality and features that ultimately make working with Groovy's collections a breeze in fewer lines of code.
Closures in action
While Closures might end up in some future version of the core Java language, they are already available in Groovy. These constructs offer impressive functionality and are elegant structures available for quite a few different programming situations.
XML processing in Groovy
Groovy's XML and SQL processing libraries are unparalleled in the world of Java development. Students will learn to quickly embrace Groovy as the preferred means to process (that is, read or produce) XML.
GroovySQL
Students will learn to employ GroovySQL as another option for quickly building applications that utilize JDBC with the verbosity of JDBC.
Groovlets
While GroovySQL and Groovy's XML handling libraries are impressive, Groovlets take the cake when it comes to rapidly building web applications.
Metaprogramming in Groovy
The magic of Groovy and consequently it's XML processing, GroovySQL, collections and even the GDK are all embodied in Groovy's powerful metaprogramming library. Students will learn how to embrace this feature in more than one way while learning the ins and outs of effective metaprogramming techniques.
Getting started with Grails
In this section, we'll dive deeply and in no time having a working Grails application up and running. Along the way we'll see the basic structure of a Grails application and begin to uncover a lot of the magic that makes Grails development efficient.
GORM
GORM is the magic behind a Grails object model. In this session, students will learn the ins and outs of GORM queries as well as mapping domain objects.
Advanced GORM
GORM makes a lot of assumptions regarding an underlying data model; consequently, an understanding of how GORM works will enable a higher level of understanding when it comes to building Grails applications as well as deploying them.
Controllers in action
In this lab, students will learn how to generate controllers and dynamically scaffold them out at runtime, understand Grail's various scopes, and how parameters are passed back and forth between the web browser and a controller instance.
Views
Students will explore the various built-in GSP tags, learn about SiteMesh, plus, we'll go over creating partial templates and modifying the default Grails templates.
Security in Grails
The Spring framework's Acegi plug-in for Grails is undoubtedly the most effective means to fully secure a Grails application. In this lab, students will employ Acegi to create roles and rules associated with those roles to effectively secure a web application.
Mapping legacy databases
Grails does make the default assumption that it has total control over a database; however, many organizations don't have the luxury of starting afresh but must use what's already there. Grails nevertheless does support mapping a data model to an underlying legacy database; what's more, the custom mapping doesn't prohibit effective GORM techniques or queries as students will learn.
RESTful services in Grails
Groovy's Grails gives you the ability to apply RESTful techniques with a full fledged web application framework that supports an ORM and testing to boot! As you see, using Groovy's Grails framework makes building RESTful Web services a snap.