Agile Development with Groovy and Grails. Christopher M. Judd. President/Consultant Judd Solutions, LLC



Similar documents
Grails - Rapid Web Application Development for the Java Platform

Intruduction to Groovy & Grails programming languages beyond Java

Grails 1.1. Web Application. Development. Reclaiming Productivity for Faster. Java Web Development. Jon Dickinson PUBLISHING J MUMBAI BIRMINGHAM

Dynamic website development using the Grails Platform. Joshua Davis Senior Architect Cognizant Technology Solutions

Rapid Application Development. and Application Generation Tools. Walter Knesel

Grails: Accelerating J2EE Application Development

Ruby on Rails in GlassFish Sun Microsystems

Consuming and Producing Web Services with WST and JST. Christopher M. Judd. President/Consultant Judd Solutions, LLC

Consuming and Producing Web Services with Web Tools. Christopher M. Judd. President/Consultant Judd Solutions, LLC

Web Development Frameworks

Building Rich Internet Applications with PHP and Zend Framework

BEST WEB PROGRAMMING LANGUAGES TO LEARN ON YOUR OWN TIME

A Comparison of Open Source Application Development Frameworks for the Enterprise

Game Programming with Groovy. James Sr. Software Engineer, BT/Ribbit

Client-side Web Engineering From HTML to AJAX

JRuby Now and Future Charles Oliver Nutter JRuby Guy Sun Microsystems

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

OpenShift is FanPaaStic For Java EE. By Shekhar Gulati Promo Code JUDCON.IN

CUT YOUR GRAILS APPLICATION TO PIECES

Building Web Services with Apache Axis2

GContracts Programming by Contract with Groovy. Andre Steingress

Developing modular Java applications

Eclipse Web Tools Platform. Naci Dai (Eteration), WTP JST Lead

IBM InfoSphere MDM Server v9.0. Version: Demo. Page <<1/11>>

Outline. Lecture 18: Ruby on Rails MVC. Introduction to Rails

Build management & Continuous integration. with Maven & Hudson

Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language The amazing productivity claims of Rails is

Networks and Services

Exam Name: IBM InfoSphere MDM Server v9.0

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

ITG Software Engineering

JBoss Portal 2.4. Quickstart User Guide

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

An Overview of Servlet & JSP Technology

WIRIS quizzes web services Getting started with PHP and Java

Web Frameworks. web development done right. Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.

Beginning POJOs. From Novice to Professional. Brian Sam-Bodden

9/11/15. What is Programming? CSCI 209: Software Development. Discussion: What Is Good Software? Characteristics of Good Software?

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

Unit and Functional Testing for the ios Platform. Christopher M. Judd

Application Servers - BEA WebLogic. Installing the Application Server

Open Source SOA with Service Component Architecture and Apache Tuscany. Jean-Sebastien Delfino Mario Antollini Raymond Feng

Pete Helgren Ruby On Rails on i

PHP vs. Java. In this paper, I am not discussing following two issues since each is currently hotly debated in various communities:

How to choose the right PaaS Platform?

Evaluation. Chapter 1: An Overview Of Ruby Rails. Copy. 6) Static Pages Within a Rails Application

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

LDAPCON Sébastien Bahloul

Concordion. Concordion. Tomo Popovic, tp0x45 [at] gmail.com

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide

Visualizing a Neo4j Graph Database with KeyLines

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Bayeux Protocol: la nuova frontiera della comunicazione a portata di mano. Relatore Nino Guarnacci

Volume 1: Core Technologies Marty Hall Larry Brown. An Overview of Servlet & JSP Technology

RESTful web applications with Apache Sling

Rails Cookbook. Rob Orsini. O'REILLY 8 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

Table of contents. Reverse-engineers a database to Grails domain classes.

FROM BANNER 8 TO BANNER XE. What s the story?

WEBAPP PATTERN FOR APACHE TOMCAT - USER GUIDE

Java/J2EE or Web Developer. Formal Education. Technical knowledge. Spoken Languages

Fortigate SSL VPN 4 With PINsafe Installation Notes

Architecture Rules Enforcement and Governance Using Aspects

Database Migration Plugin - Reference Documentation

How To Use An Informix System With A Computer System (For A Dba)

PASS4TEST 専 門 IT 認 証 試 験 問 題 集 提 供 者

Running a Program on an AVD

IBM Proof of Technology Discovering business application services, featuring IBM WebSphere Application Server Network Deployment V8

<Insert Picture Here> Betting Big on JavaServer Faces: Components, Tools, and Tricks

Building and Deploying Web Scale Social Networking Applications Using Ruby on Rails and Oracle. Kuassi Mensah Group Product Manager

Web Application Development and Frameworks

Engine: Using MSBuild and Team Foundation

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

Ruby on Rails. a high-productivity web application framework. blog.curthibbs.us/ Curt Hibbs <curt@hibbs.com>

Hello World RESTful web service tutorial

Triple-E class Continuous Delivery

ADF. Joe Huang Joe Huang Senior Principal Product Manager, Mobile Development Platform, Oracle Application Development Tools

JobScheduler and Script Languages

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

AJAX Toolkit Framework

Process Integrator Deployment on IBM Webspher Application Server Cluster

tc Server Webinar Series Deployments

Using Tomcat with CA Clarity PPM

Ruby On Rails. CSCI 5449 Submitted by: Bhaskar Vaish

WebLogic Server: Installation and Configuration

Configuring the LCDS Load Test Tool

Fortigate SSL VPN 3.x With PINsafe Installation Notes

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

JWIG Yet Another Framework for Maintainable and Secure Web Applications

Continuous Delivery for Alfresco Solutions. Satisfied customers and happy developers with!! Continuous Delivery!

Transcription:

Agile Development with Groovy and Grails Christopher M. Judd President/Consultant Judd Solutions, LLC

Christopher M. Judd President/Consultant of Judd Solutions Central Ohio Java User Group (COJUG) coordinator Creator Open Source projects FallME and Fiddle Creator of the Chmod iphone App

James L. Shingler Sr. Consulting Architect for Nationwide Principal Consultant for Genuine Solutions Co-Creator of Open Source Project FallME Co-Author of Beginning Groovy and Grails

Agenda Java Web Development Landscape Groovy and Grails Overview Demo

Starting Java Web Projects What do you need to start a Java Web Project? JDK Web Container/App Server Build System Application Stack Persistence Framework Web Framework Unit Test Framework AJAX Framework Database Scheduling Framework. XML Framework Logging Framework View IDE.

Java EE/J2EE Architecture

Java Development Cycle Code Debug Compile Test Package Deploy Takes too much time and is too complicated!

Conclusion Java Web and J2EE development is too complicated and not very agile!!! But we can t or don t want to abandon Java completely.

Solution

Agenda Java Web Development Landscape Groovy and Grails Overview Demo

Groovy Dynamic scripting language for Java VM Open Source under Apache 2.0 License Current version 1.6 JSR 241 Better Java (Java 3.0) Advanced features Properties Closures Optional typing Builders Cool operators Operator overloading Meta-programming Groovy JDK (methods to Java library) groovy = [ ] groovy << java groovy << ruby groovy << python groovy << scripting groovy << agile groovy << dynamic

Language Stack Domain Specific Language Groovy Java Language Domain Application (Dynamic) System (Static)

Grails Web Application Framework Development Environment Open Source under Apache 2.0 License Current version 1.1 Best Practices Convention over configuration Don t repeat yourself (DRY) Default is what you expect (DIWYE) Agile Scaffolding AJAX Plug-ins Unit testing Web Services

Grails Frameworks JDK Web Container/App Server Build System Application Stack Persistence Framework Web Framework Unit Test Framework AJAX Framework Database Scheduling Framework XML Framework Logging Framework View IDE GORM JDK 1.4

Grails Architecture Application Controllers Views Services Domain Libraries Spring Java Language Grails SiteMesh GORM Groovy Language Gant Java Virtual Machine

MVC Application Design Controller GSP Domain DB

Creating Grails Project Eclipse Project Project Structure

Running application

Creating Domain Class class Todo { Domain Class static constraints = { Integration Test import grails.test.* class TodoTests extends GrailsUnitTestCase { protected void setup() { super.setup() protected void teardown() { super.teardown() void testsomething() {

Defining Domain Properties class Todo { String name String note Date datecreated Date duedate Date completeddate String priority String status Java class with getters and setters static constraints = {

Just Another Java Class Compiled from "Todo.groovy" public class Todo extends java.lang.object implements groovy.lang.groovyobject { public static final java.lang.class $ownclass; public static java.lang.ref.softreference $staticmetaclass; transient groovy.lang.metaclass metaclass; public static java.lang.long timestamp; public static java.lang.long timestamp 239_neverHappen1219721540048; public Todo(); protected groovy.lang.metaclass $getstaticmetaclass(); public groovy.lang.metaclass getmetaclass(); public java.lang.object invokemethod(java.lang.string, java.lang.object); public java.lang.object getproperty(java.lang.string); public void setproperty(java.lang.string, java.lang.object); static {; public java.lang.string getname(); public void setname(java.lang.string); public java.lang.string getnote(); public void setnote(java.lang.string); public java.util.date getdatecreated(); public java.util.date getdatecreated(); public void setdatecreated(java.util.date); public java.util.date getduedate(); public void setduedate(java.util.date); public java.util.date getcompleteddate(); public void setcompleteddate(java.util.date); public java.lang.string getpriority(); public void setpriority(java.lang.string); public java.lang.string getstatus(); public void setstatus(java.lang.string); public void setmetaclass(groovy.lang.metaclass); void super$1$wait(); java.lang.string super$1$tostring(); void super$1$wait(long); void super$1$wait(long, int); void super$1$notify(); void super$1$notifyall(); java.lang.class super$1$getclass(); boolean super$1$equals(java.lang.object); java.lang.object super$1$clone(); int super$1$hashcode(); void super$1$finalize(); static java.lang.class class$(java.lang.string);

Creating Controller Controller class TodoController { def index = { Integration Test class TodoControllerTests extends ControllerUnitTestCase { protected void setup() { super.setup() protected void teardown() { super.teardown() void testsomething() {

Enabling Scaffolding class TodoController { def scaffold = true Generates CRUD Application

Adding Constraints class Todo { String name String note Date datecreated Date duedate Date completeddate String priority String status static constraints = { name(blank:false) priority(inlist:["high", "normal"]) status(inlist:["complete", "in process"]) note(maxsize:1000, nullable:true) completeddate(nullable:true) duedate(nullable:true)

Defining Relationships class Todo { String name String note Date datecreated Date duedate Date completeddate String priority String status static belongsto = [Group] Group group static constraints = { name(blank:false) priority(inlist:["high", "normal", "low"]) status(inlist:["complete", "in process"]) note(maxsize:1000, nullable:true) completeddate(nullable:true) duedate(nullable:true)

Simple Search Action TodoController search action def search = { def todos = Todo.findAllByNameLike("${params.value%") render(view:'search', model: [value: params.value, todos: todos]) search.gsp <html> Layout <head> <meta name="layout" content="main" /> <title>todo Find</title> </head> <body> <h2>post Search</h2> <g:form controller="todo" method="post" > <input type='text' name='value' value="${value" /> <g:actionsubmit value="search" /> </g:form> Results: <ol> <g:each var="todo" in="${todos"> <li>${todo?.name <g:if test="${todo.note">- </g:if> ${todo?.note </li> </g:each> </ol> </body> </html> GORM Safe Navigation Operator GString

Ajax Search TodoController Ajax search action def remotesearch = { def todos = Todo.findAllByNameLike("${params.value%") render(template:'results', model: [value: params.value, todos: todos]) _results.gsp <ol> <g:each var="todo" in="${todos"> <li>${todo?.name <g:if test="${todo.note">- </g:if> ${todo?.note </li> </g:each> </ol> search.gsp <html> <head> <meta name="layout" content="main" /> <title>todo Find</title> <g:javascript library="scriptaculous" /> </head> <body> <h2>ajax Search</h2> <g:formremote name="remotesearch" url="[controller:'todo',action:'remotesearch']" update="[success:'results'" > <input type='text' name='value' value="${value" /> <g:submitbutton name="search" value="search" /> </g:formremote> Results: <div id="results"></div> </body> </html> Spinner

Incremental Ajax Search TodoController Incremental Ajax search action def isearch = { def todos = Todo.findAllByNameLike("${params.value%") def writer = new StringWriter() new groovy.xml.markupbuilder(writer).ul { todos.each { li(id: t.id, "${t.name") Builder Closure render writer.tostring() search.gsp <html> <head> <meta name="layout" content="main" /> <title>todo Find</title> <g:javascript library="scriptaculous" /> </head> <body> <h2>incremental Ajax Search</h2> <input type="text" id="autocomplete" name="autocomplete_parameter"/> <span id="indicator1" style="display: none"><img src="../images/spinner.gif" alt="working..." /></span> <div id="autocomplete_choices" class="autocomplete"></div> <script type="text/javascript"> new Ajax.Autocompleter("autocomplete", "autocomplete_choices", "isearch", {paramname: "value",indicator: 'indicator1'); </script> </body> </html>

Grails Development Cycle Code Debug Test

URL Convention http://<server>/<project>/<controller>/<action>/<id> http://localhost:8080/collab-todo/todo/list http://localhost:8080/collab-todo/todo/show/1

Development Convention Grails command-line tool grails bootstrap grails init grails bug-report grails install-plugin grails clean grails install-templates grails compile grails list-plugins grails console grails package grails create-app grails package-plugin grails create-controller grails plugin-info grails create-domain-class grails release-plugin grails create-integration-test grails run-app grails create-plugin grails run-app-https grails create-script grails run-war grails create-service grails set-proxy grails create-tag-lib grails set-version grails create-unit-test grails shell grails doc grails stats grails generate-all grails test-app grails generate-controller grails upgrade grails generate-views grails war grails help

Service Application Design Controller GSP Service Domain DB

Default Development Environment Controller JVM Jetty (Web Container) GSP Domain HSQL DB

Production Environment JVM Web Container/App Server Controller GSP Domain DB WAR

Grails vs. Ruby on Rails Design for the JVM Domain driven Flexible Supports multiple AJAX frameworks Runs on the JVM Database driven My way or highway Single AJAX framework

Conclusion Java s capability, flexibility, backwards compatibility and community have lead to it s unprecedented success. However, these same things have become it s Achilles heal. The combination of Groovy and Grails simplifies the Java web platform while making developers more productive and agile.

Beginning Groovy and Grails 1. Introduction to Groovy 2. Groovy Basics 3. More Advanced Groovy 4. Introduction to Grails 5. Building the User Interface 6. Building Domains and Services 7. Security in Grails 8. Web 2.0 Ajax and Friends 9. Web Services 10. Reporting 11. Batch Processing 12. Deploying and Upgrading 13. Alternative Clients

Resources Groovy groovy.codehaus.org Documentation groovy.codehaus.org/documentation Groovy JDK (GDK) groovy.codehaus.org/groovy-jdk/ Groovy Java Doc groovy.codehaus.org/api/ Groovy Zone - groovy.dzone.com About Groovy - www.aboutgroovy.com Groovy Blogs - www.groovyblogs.org Mastering Grails Series at IBM Developer Works www.ibm.com/developerworks/java/library/j-grails01158/

Resources Grails grails.codehaus.org or www.grails.org Grails Quick Start grails.codehaus.org/quick+start User Guide Books grails.org/doc/1.1/

Contact Information Website: http://www.juddsolutions.com Email: cjudd@juddsolutions.com Blog: http://juddsolutions.blogspot.com/ Beginning Groovy and Grails http://www.apress.com/book/view/1430210451 Pro Eclipse JST http://www.apress.com/book/bookdisplay.html?bid=447 Enterprise Java Development on a Budget http://www.apress.com/book/bookdisplay.html?bid=197

Questions? Please fill out your evaluations.