SlideShare a Scribd company logo
Adopting Grails


Klaus Baumecker
   Hewlett-Packard
About me
Klaus Baumecker
Software Architect & Technologist @
       Hewlett-Packard, Böblingen, Germany


Professional Software Developer since 1992


Java Programmer since 12+ years
Using Groovy & Grails since 3+ years




2
Introduction
We started using Grails in production 2 years ago.
We used Grails already for in-house projects (version 1.0.x)


The following episodes show


        … what we’ve learned and
        … a few best practices derived from it.




3
Context
•   Large product suite for IT-Management in HP Software
•   Two teams developing the next release of a product
    – One   using classic JEE approach
    – Other   using Grails

•   Both web-apps share a common data model based on POJOs and
    Hibernate mapping files
•   All web-apps run inside a JBoss application server
•   Continuous integration builds based on maven
•   Time-boxed development cycles
•   Agile approach with features and stories (SCRUM like)




4
Episode 1 – GORM Constraints
The Grails web-app uses GORM constraints to enforce rules on the
domain classes
There was and (and still is) a general attempt to reduce footprint by
moving common web-app libraries into shared lib space
   therefore the shared domain model (incl. hibernate mapping) became
    a shared library (among others like apache-commons-*, etc)



                           GORM constraints work fine in
                           development (run-app), but are
                           ignored while running production
                           code inside JBoss



5
Episode 1
            GORM constraints were part of the Grails source
            code (src/groovy/…)

            They were loaded by the web-app class loader

            Domain classes and mapping file have been
            loaded by the shared class loader (and loaded
            before the constraints)

            The shared class loader cannot access classes
            within the web-app (only the other way around)

            GORM constraints are ignored!

             Extract constraints and move to shared lib
            space

6
Episode 2 – Flex UI
Demand for graphical editor has led to Flex based UIs.
Communication was XML based.
Then we’ve seen too many Flex timeouts. So we moved to faster
communication with Blaze-DS using the BlazeDS grails-plugin.
We mapped domain classes to Flex classes (Blaze feature).
Better performance now, but…



                         After a round-trip of a data object
                         (grails - flex - grails) we got empty
                         fields in the received object. Although
                         there were properly set before and
                         not modified in the UI.

7
Episode 2


        Our POJO based domain classes have some
        protected fields (public getter, private setter).

        No problem for hibernate.

        Blaze-DS uses commons-bean utilities for mapping
        from/to POJOs and ignores asymmetric fields.

         Need DTO and some tool to define mapping. We
          use Dozer (dozer.org)




8
Grails with BlazeDS or not?
Motivation: Optimization (High performance data transfer)!...But
sometimes you really need
    –a   different rendering strategy (partial vs. all at once)
    –a   fix for your slow performing back end (Flex timeouts)


Use cases
    – Event   Browser for IT-Mgmt:
     •   Large list of IT events to be viewed by an operator (> 20000 events)
     •   Interactive operations on events (e.g. filtering, dynamic updates from the server)

    – More    advanced client/server communication (pub/sub, push)



Main issues
    – Another    layer in your communication
    – No   controller level (Blaze works on services directly)  breaks Grails paradigm
     •   Same with other communication extensions directly working on services (remoting plugin).
     •   Some security plugins do not work as expected
9
Generalizing the Controller layer
•   Grails services w/
    controller semantics        Controller
                                                                                          Other
                                Layer                HTTP          BlazeDS    Remoting
•   Avoiding redundant          (transport spec.)                                        Access

    authorization


                                Services                                Business
                                Layer (atomic ops,                       Service
                                caller neutral)
          Grails       Grails
                                                                       Transaction
         Controller   Service



                                Business Logic                Business           Business
                                Layer (optional)            Logic Services     Logic Service




    10
Episode 3 – Design your web services
We’re using XML for most of our UI/backend communication.
Our backend provides web services for UI and automation tools.
The Flex guy says: Add a special attribute to the XML to make my
rendering easier.
Architect says: Don’t fiddle with the automation interface!




                        How to setup my web services to
                        fit the needs for UI and
                        automation?



11
Episode 3


        Flex = Rich UI  Treat your UI as another
        automation client.

        Don’t allow UI specifics to show up in the XML. If
        you don’t, you’ll end up in maintaining parallel XML
        flows.

        My recommendation for XML generation
        • gsp.xml
        • Plain XML code is easy to read and maintain
        • No DTO required (as in BlazeDS or JAXB). Map
          domain data to XML inside the gsp.



12
Episode 4 – Meta Programming
Due to a change of the architecture some domain classes are no longer
stored in our DB. They stored with a different technique (out of our
control).
GORM methods are no longer available.
Store and retrieval is replaced by new a persistence API incl. new DAOs


                      We still have many consumers of
                      the (original) classes all over the
                      place.

                      How to minimize refactoring?




13
Episode 4

        Enhance the meta-class of the old classes by the
        missing GORM functions (get(..), simple finders).

        Meta-class methods map to the new API.

        Existing code remains unchanged.

        But do this with care!

        Comment your code and explain it in your tech
        meeting.




14
Episode 5 – Developer Support
Programmers with strong Java background often feel lost with reduced
IDE support.


They miss(ed) code completion, static analysis, compile errors, etc.




                       How can we reduce the whining
                       and complaining, while moving
                       them into the Groovy/Grails
                       world?




15
Episode 5


        Get a good IDE.

        Spent effort in installing analysis tools into your
        build. E.g. run CodeNarc analysis.

        Write your own CodeNarc rules according to your
        internal regulations and needs

        Own rule brought some safety back: “Finding
        dynamic variable”.




16
Episode 6 – Modularization with Plugins
Each web-app developed services which became useful in the other
web-app.


Inter-web-app communication is easy to set-up but not really a solution
     – Architecture,   security, etc.
     – E.g.   RMI



Reusing a Grails service inside a Java web-app is not straight-forward.


                                        How can we leverage functionality
                                        across multiple web-apps, keep good
                                        architecture and independent web-app
                                        development in two teams?

17
Episode 6
        Grails-ify the Java web-app. Now you have two
        Grails apps.

        Extract shared services into additional Grails
        plugin(s).

        Create a new umbrella Grails app that loads the two
        main web-apps as plugins.

        The two Grails apps consume the extracted services
        plugins.

        Each of the main web-apps run independently (run-
        app) to keep lightweight development for each team.



18
From applications to plugins
•    Refactor your beans from resources.groovy to a resource location, e.g.
     src/java/myBeans.groovy
     – Watch     out:
       •   Before: “beans = {“
       •   After: “beans {”

•    For each web-app :
     – Refer    to the new beans file within resources.groovy

•    Merging beans in the umbrella app
     – Refer    to the new beans files from the underlying web-apps
     – Wire   beans between web-apps (optional)

•    Add plugin descriptor
•    Adjust URL mapping
•    Merge other resources (e.g. files under web-app/)
     – Requires      extra scripting
19
From applications to plugins (con’t)
beans = {
                                  resource.groovy
                                                    umbrella
    loadBeans(‘/beans2.groovy’)                     web-app
    loadBeans(‘/beans1.groovy’)                      (grails)
}




                                    web-app 1
                                                                     web-app 2
                                  (java, spring,
                                                                    (pure grails)
                                    grailsified)
                                                                         resource.groovy
                                resource.groovy
beans = {                                                          src/java/beans2.groovy
    loadBeans(‘/beans1.groovy’)
}

       src/java/beans1.groovy
beans {
    <your beans here>                               plugin
}                                                    plugin
                                                         plugin
                                                       plugin
                                                        (shared
20
                                                       services)
Summary & Best Practices
•    Clearly articulate the benefits of the framework
     – Not    just cool stuff

•    Reduce emotion (they know what you think anyway)
•    Create a local community
     – find   the people that think like you

•    Use the external community and help others using it
     – Mailing-lists,   IRC, etc.

•    Provide tools
     – IDE,    static analysis, plugins

•    Find situations/cases in which Groovy/Grails really makes a difference
     – E.g
         grails run-app vs. classical web-app redeploy cycle with heavy app servers is a
      huge time saver

•    Stay close to the Grails sweet-spot as long as possible
     – E.g.   Groovy domain model vs. Java domain model
21
Summary & Best Practices (cont’d)
•    Be available
     – Provide   help when necessary
     – Don’t   let the team swim alone

•    Offer/Initiate code reviews/pair-programming
•    Maintain a catalog of design principles and guidelines
     – HowTo(s)

     – Coding guidelines (e.g. use of types, inheritance vs. composition, controller and
      services responsibilities, XML generation strategies, Java vs. Groovy coding etc.)

•    Ideas:
     – Use   the create-* scripts to introduce own templates for controllers and services
     – Provide   own scripts for lab-specific tools




22
Thank You!




       Questions?




                    23

More Related Content

What's hot

Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWS
VMware Tanzu
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
VMware Tanzu
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
Zachary Klein
 
Java modules using project jigsaw@jdk 9
Java modules using project jigsaw@jdk 9Java modules using project jigsaw@jdk 9
Java modules using project jigsaw@jdk 9
Mauricio "Maltron" Leal
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
Ryan Cuprak
 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
Judy Breedlove
 
Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015
Rubén Mondéjar Andreu
 
Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...
Codemotion
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
Julien Dubois
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in Grails
Peter Ledbrook
 
Modular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache KarafModular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache Karaf
Ioan Eugen Stan
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
Ryan Cuprak
 
Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
Zachary Klein
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
Sander Mak (@Sander_Mak)
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
Ryan Cuprak
 
Enabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition LanguageEnabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition Languageelliando dias
 
Developing Plug-Ins for NetBeans
Developing Plug-Ins for NetBeansDeveloping Plug-Ins for NetBeans
Developing Plug-Ins for NetBeanselliando dias
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
Sander Mak (@Sander_Mak)
 

What's hot (19)

Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWS
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
 
Java modules using project jigsaw@jdk 9
Java modules using project jigsaw@jdk 9Java modules using project jigsaw@jdk 9
Java modules using project jigsaw@jdk 9
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
 
Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015
 
Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...Refactor your Java EE application using Microservices and Containers - Arun G...
Refactor your Java EE application using Microservices and Containers - Arun G...
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in Grails
 
Modular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache KarafModular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache Karaf
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Enabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition LanguageEnabling White-Box Reuse in a Pure Composition Language
Enabling White-Box Reuse in a Pure Composition Language
 
Developing Plug-Ins for NetBeans
Developing Plug-Ins for NetBeansDeveloping Plug-Ins for NetBeans
Developing Plug-Ins for NetBeans
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
 

Viewers also liked

GR8Conf 2011: CodeNarc and GMetrics
GR8Conf 2011: CodeNarc and GMetricsGR8Conf 2011: CodeNarc and GMetrics
GR8Conf 2011: CodeNarc and GMetricsGR8Conf
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
GR8Conf
 
GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook
GR8Conf 2011: Grails 1.4 Update by Peter LedbrookGR8Conf 2011: Grails 1.4 Update by Peter Ledbrook
GR8Conf 2011: Grails 1.4 Update by Peter LedbrookGR8Conf
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
GR8Conf
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
GR8Conf
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
GR8Conf
 

Viewers also liked (6)

GR8Conf 2011: CodeNarc and GMetrics
GR8Conf 2011: CodeNarc and GMetricsGR8Conf 2011: CodeNarc and GMetrics
GR8Conf 2011: CodeNarc and GMetrics
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook
GR8Conf 2011: Grails 1.4 Update by Peter LedbrookGR8Conf 2011: Grails 1.4 Update by Peter Ledbrook
GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
 

Similar to GR8Conf 2011: Adopting Grails

Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
George Platon
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
Arun Gupta
 
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)
smancke
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
Alexis Moussine-Pouchkine
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
Harshdeep Kaur
 
Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
Andrei Sebastian Cîmpean
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM Domino
Serdar Basegmez
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
SC5.io
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT Group
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of Tomorrow
Peter Ledbrook
 
GlassFish v3 - Architecture
GlassFish v3 - ArchitectureGlassFish v3 - Architecture
GlassFish v3 - Architecture
Alexis Moussine-Pouchkine
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
Concierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded DevicesConcierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded Devices
Jan S. Rellermeyer
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
graemerocher
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating Applications
Simon Ritter
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
Viridians
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
Mohd Safian
 

Similar to GR8Conf 2011: Adopting Grails (20)

Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
 
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
 
Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM Domino
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of Tomorrow
 
GlassFish v3 - Architecture
GlassFish v3 - ArchitectureGlassFish v3 - Architecture
GlassFish v3 - Architecture
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Concierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded DevicesConcierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded Devices
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating Applications
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
GraniteDS vs BlazeDS
GraniteDS vs BlazeDSGraniteDS vs BlazeDS
GraniteDS vs BlazeDS
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
 

More from GR8Conf

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
GR8Conf
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
GR8Conf
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
GR8Conf
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
GR8Conf
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
GR8Conf
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
GR8Conf
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
GR8Conf
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
GR8Conf
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
GR8Conf
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
GR8Conf
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
GR8Conf
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
GR8Conf
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
GR8Conf
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
GR8Conf
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
GR8Conf
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
GR8Conf
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
GR8Conf
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
GR8Conf
 
Jan reher may 2013
Jan reher may 2013Jan reher may 2013
Jan reher may 2013
GR8Conf
 
Good Form - complex web forms made Groovy
Good Form - complex web forms made GroovyGood Form - complex web forms made Groovy
Good Form - complex web forms made Groovy
GR8Conf
 

More from GR8Conf (20)

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Jan reher may 2013
Jan reher may 2013Jan reher may 2013
Jan reher may 2013
 
Good Form - complex web forms made Groovy
Good Form - complex web forms made GroovyGood Form - complex web forms made Groovy
Good Form - complex web forms made Groovy
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

GR8Conf 2011: Adopting Grails

  • 2. About me Klaus Baumecker Software Architect & Technologist @ Hewlett-Packard, Böblingen, Germany Professional Software Developer since 1992 Java Programmer since 12+ years Using Groovy & Grails since 3+ years 2
  • 3. Introduction We started using Grails in production 2 years ago. We used Grails already for in-house projects (version 1.0.x) The following episodes show … what we’ve learned and … a few best practices derived from it. 3
  • 4. Context • Large product suite for IT-Management in HP Software • Two teams developing the next release of a product – One using classic JEE approach – Other using Grails • Both web-apps share a common data model based on POJOs and Hibernate mapping files • All web-apps run inside a JBoss application server • Continuous integration builds based on maven • Time-boxed development cycles • Agile approach with features and stories (SCRUM like) 4
  • 5. Episode 1 – GORM Constraints The Grails web-app uses GORM constraints to enforce rules on the domain classes There was and (and still is) a general attempt to reduce footprint by moving common web-app libraries into shared lib space  therefore the shared domain model (incl. hibernate mapping) became a shared library (among others like apache-commons-*, etc) GORM constraints work fine in development (run-app), but are ignored while running production code inside JBoss 5
  • 6. Episode 1 GORM constraints were part of the Grails source code (src/groovy/…) They were loaded by the web-app class loader Domain classes and mapping file have been loaded by the shared class loader (and loaded before the constraints) The shared class loader cannot access classes within the web-app (only the other way around) GORM constraints are ignored!  Extract constraints and move to shared lib space 6
  • 7. Episode 2 – Flex UI Demand for graphical editor has led to Flex based UIs. Communication was XML based. Then we’ve seen too many Flex timeouts. So we moved to faster communication with Blaze-DS using the BlazeDS grails-plugin. We mapped domain classes to Flex classes (Blaze feature). Better performance now, but… After a round-trip of a data object (grails - flex - grails) we got empty fields in the received object. Although there were properly set before and not modified in the UI. 7
  • 8. Episode 2 Our POJO based domain classes have some protected fields (public getter, private setter). No problem for hibernate. Blaze-DS uses commons-bean utilities for mapping from/to POJOs and ignores asymmetric fields.  Need DTO and some tool to define mapping. We use Dozer (dozer.org) 8
  • 9. Grails with BlazeDS or not? Motivation: Optimization (High performance data transfer)!...But sometimes you really need –a different rendering strategy (partial vs. all at once) –a fix for your slow performing back end (Flex timeouts) Use cases – Event Browser for IT-Mgmt: • Large list of IT events to be viewed by an operator (> 20000 events) • Interactive operations on events (e.g. filtering, dynamic updates from the server) – More advanced client/server communication (pub/sub, push) Main issues – Another layer in your communication – No controller level (Blaze works on services directly)  breaks Grails paradigm • Same with other communication extensions directly working on services (remoting plugin). • Some security plugins do not work as expected 9
  • 10. Generalizing the Controller layer • Grails services w/ controller semantics Controller Other Layer HTTP BlazeDS Remoting • Avoiding redundant (transport spec.) Access authorization Services Business Layer (atomic ops, Service caller neutral) Grails Grails Transaction Controller Service Business Logic Business Business Layer (optional) Logic Services Logic Service 10
  • 11. Episode 3 – Design your web services We’re using XML for most of our UI/backend communication. Our backend provides web services for UI and automation tools. The Flex guy says: Add a special attribute to the XML to make my rendering easier. Architect says: Don’t fiddle with the automation interface! How to setup my web services to fit the needs for UI and automation? 11
  • 12. Episode 3 Flex = Rich UI  Treat your UI as another automation client. Don’t allow UI specifics to show up in the XML. If you don’t, you’ll end up in maintaining parallel XML flows. My recommendation for XML generation • gsp.xml • Plain XML code is easy to read and maintain • No DTO required (as in BlazeDS or JAXB). Map domain data to XML inside the gsp. 12
  • 13. Episode 4 – Meta Programming Due to a change of the architecture some domain classes are no longer stored in our DB. They stored with a different technique (out of our control). GORM methods are no longer available. Store and retrieval is replaced by new a persistence API incl. new DAOs We still have many consumers of the (original) classes all over the place. How to minimize refactoring? 13
  • 14. Episode 4 Enhance the meta-class of the old classes by the missing GORM functions (get(..), simple finders). Meta-class methods map to the new API. Existing code remains unchanged. But do this with care! Comment your code and explain it in your tech meeting. 14
  • 15. Episode 5 – Developer Support Programmers with strong Java background often feel lost with reduced IDE support. They miss(ed) code completion, static analysis, compile errors, etc. How can we reduce the whining and complaining, while moving them into the Groovy/Grails world? 15
  • 16. Episode 5 Get a good IDE. Spent effort in installing analysis tools into your build. E.g. run CodeNarc analysis. Write your own CodeNarc rules according to your internal regulations and needs Own rule brought some safety back: “Finding dynamic variable”. 16
  • 17. Episode 6 – Modularization with Plugins Each web-app developed services which became useful in the other web-app. Inter-web-app communication is easy to set-up but not really a solution – Architecture, security, etc. – E.g. RMI Reusing a Grails service inside a Java web-app is not straight-forward. How can we leverage functionality across multiple web-apps, keep good architecture and independent web-app development in two teams? 17
  • 18. Episode 6 Grails-ify the Java web-app. Now you have two Grails apps. Extract shared services into additional Grails plugin(s). Create a new umbrella Grails app that loads the two main web-apps as plugins. The two Grails apps consume the extracted services plugins. Each of the main web-apps run independently (run- app) to keep lightweight development for each team. 18
  • 19. From applications to plugins • Refactor your beans from resources.groovy to a resource location, e.g. src/java/myBeans.groovy – Watch out: • Before: “beans = {“ • After: “beans {” • For each web-app : – Refer to the new beans file within resources.groovy • Merging beans in the umbrella app – Refer to the new beans files from the underlying web-apps – Wire beans between web-apps (optional) • Add plugin descriptor • Adjust URL mapping • Merge other resources (e.g. files under web-app/) – Requires extra scripting 19
  • 20. From applications to plugins (con’t) beans = { resource.groovy umbrella loadBeans(‘/beans2.groovy’) web-app loadBeans(‘/beans1.groovy’) (grails) } web-app 1 web-app 2 (java, spring, (pure grails) grailsified) resource.groovy resource.groovy beans = { src/java/beans2.groovy loadBeans(‘/beans1.groovy’) } src/java/beans1.groovy beans { <your beans here> plugin } plugin plugin plugin (shared 20 services)
  • 21. Summary & Best Practices • Clearly articulate the benefits of the framework – Not just cool stuff • Reduce emotion (they know what you think anyway) • Create a local community – find the people that think like you • Use the external community and help others using it – Mailing-lists, IRC, etc. • Provide tools – IDE, static analysis, plugins • Find situations/cases in which Groovy/Grails really makes a difference – E.g grails run-app vs. classical web-app redeploy cycle with heavy app servers is a huge time saver • Stay close to the Grails sweet-spot as long as possible – E.g. Groovy domain model vs. Java domain model 21
  • 22. Summary & Best Practices (cont’d) • Be available – Provide help when necessary – Don’t let the team swim alone • Offer/Initiate code reviews/pair-programming • Maintain a catalog of design principles and guidelines – HowTo(s) – Coding guidelines (e.g. use of types, inheritance vs. composition, controller and services responsibilities, XML generation strategies, Java vs. Groovy coding etc.) • Ideas: – Use the create-* scripts to introduce own templates for controllers and services – Provide own scripts for lab-specific tools 22
  • 23. Thank You! Questions? 23