SlideShare a Scribd company logo
1 of 25
Download to read offline
Smokejumping Grails
                             Robert Fischer, Smokejumper Consulting
                             robert . fischer @ SmokejumperIT . com

                                     Presented Nov 17th, 2008
                             at the Triangle Java User Group (TriJUG)




Tuesday, November 18, 2008                                              1
Hi, I’m Robert
Tuesday, November 18, 2008                    2
Math Major
Tuesday, November 18, 2008                3
Born and Raised in Perl
Tuesday, November 18, 2008                 4
Agile Java Consultant
Tuesday, November 18, 2008                     5
Technical Blogger
                   EnfranchisedMind.com
                   •         The Joy of BDD, or, Re-writing Your Code in
                             Mocks and Asserts is Not Unit Testing

                   •         Functional (Meta)?Programming Stunts for Ruby
                             and Groovy (and a Little Perl)

                   •         7 Actually Useful Things You Didn’t Know Static
                             Typing Could Do: An Introduction for the
                             Dynamic Language Enthusiast

                   •         A Defense of Prototypes, or, Why Does Tom
                             Christiansen Hate Perl?


Tuesday, November 18, 2008                                                     6
Groovy/Grails Fanboy
                   • Introduced to Groovy/Grails at Carol.com,
                             Active in Groovy Users of Minnesota
                   • Uses Grails as freelancer to quickly develop
                             prototype applications
                   • Regular on IRC: FreeNode #groovy, #grails
                   • Active on Groovy and Grails mailing lists
                   • Autobase and BackgroundThread plugin
Tuesday, November 18, 2008                                          7
All Web App
                        Development Should
                             Be Grails


Tuesday, November 18, 2008                   8
No, Really.
                   • Stunningly simple development.
                   • Succinct code using a superset of Java.
                   • Sane defaults, straightforward configuration.
                   • Static typing as deemed useful by developer.
                   • Standard deployment approach.
                   • SpringSource backed and here to stay.
Tuesday, November 18, 2008                                          9
What Is Grails?
                   • Web application development framework/
                             environment leveraging Java and Groovy.
                   • Convention-based MVC development with
                             a set of powerful command-line tools.
                   • Powered by pre-configured and pre-
                             integrated Spring, Hibernate, SiteMesh, and
                             JUnit.


Tuesday, November 18, 2008                                                 10
How Would You
                                Like Your Grails?
                   •         Conceptually thin dynamic MVC framework
                         •    Dynamic, succinct domain and controllers
                         •    Run from source code check-out
                         •    Mash-up with extensible plugin architecture

                   •         Actually approachable best-of-breed Java stack
                         •     Prepackaged Java environment and build system
                         •     Builds a WAR to plug into existing deployments
                         •     Hooks for existing Spring and Hibernate config



Tuesday, November 18, 2008                                                      11
Grails Before
                             Your Very Eyes!
                                 Live Coding!




Tuesday, November 18, 2008                      12
But Wait, There’s More!
                         Plugins
                   • Functional Testing
                             webtest, selenium, fitnesse
                   • Rich User Interface (RIA)
                             grails-ui, richui, gwt, flex, yui, iui
                   • Database Management: Autobase
                   • Background Tasks: BackgroundThread
                   • And dozens more: http://grails.org/plugins
Tuesday, November 18, 2008                                           13
Autobase
                   • Manages database state using a non-linear
                             collection of database change sets.
                   • Leverages existing Grails database
                             automation to minimize effort.
                   • Provides a Liquibase-based embedded DSL
                             for database migrations.
                   • http://github.com/RobertFischer/autobase/
                             wikis/

Tuesday, November 18, 2008                                         14
Example Migration

                      changeSet(id:'rename_bar_to_baz', author:'Robert')
                      {
                        dropColumn(tableName:'foo', columnName:'baz')
                        renameColumn(tableName:quot;fooquot;,
                          oldColumnName:quot;barquot;,
                          newColumnName:quot;bazquot;)
                      }




Tuesday, November 18, 2008                                                 15
Background Thread

                   • Provides a Spring bean that will execute
                             arbitrary closures in the background.
                   • Handles some awkwardness around
                             Hibernate sessions, and provides thread
                             pooling and logging.
                   • http://grails.org/BackgroundThread+Plugin

Tuesday, November 18, 2008                                             16
BackgroundThread
                               Usage Example
                      class FooService {
                          boolean transactional = false
                          def backgroundService
                          def serviceMethod() {
                            (1..<10).each { cnt ->
                               backgroundService.execute(quot;Logging '$cnt'”, {
                                 log.info(quot;${cnt}quot;)
                            })
                          }
                      }



Tuesday, November 18, 2008                                                     17
But What About
                             JRuby on Rails?



Tuesday, November 18, 2008                     18
My JRuby on Rails
                                  Street Cred
                   •         Work history in Rails,
                             including last 5 months
                             on a JRuby on Rails
                             project
                   •         Regular attendee,
                             competition member,
                             and one-time presenter
                             at Ruby Users of
                             Minnesota (RUM)
                   •         Charlie “Headius”
                             Nutter fan



Tuesday, November 18, 2008                             19
Why Not
                                    JRuby on Rails?
                   •         Although Java-in-Ruby is fairly slick, Ruby-in-Java is pretty
                             rough and best mediated via Groovy metaprogramming
                   •         GORM is superior to ActiveRecord
                         •      http://www.oreillynet.com/ruby/blog/2007/05/
                                bind_parameters_now.html
                   •         GSPs are superior to ActionView
                   •         Spring is superior to nothing
                   •         Optional static typing is superior to pure dynamic typing
                   •         You can code Grails without grokking its source
                   •         Nobody is fired for choosing Java




Tuesday, November 18, 2008                                                                   20
The One Circumstance
                  I Would Still Use Rails
                   • Small CRUD-based app with its own DB
                   • No or very generous performance limits
                   • Owned by one or two developers
                   • Expected life cycle of less than a year
                   • Deployed system is without Java or is an
                             Apache web server with mod_passenger
                             and without mod_proxy or mod_jk


Tuesday, November 18, 2008                                          21
Your Grails
                                  Adoption Plan
                   • Best approach: start with a roughly green-
                             field proof-of-concept web application
                   • Use GRAG on SourceForge to generate a
                             database front-end to impress your boss
                   • Wrap an existing Java web application in
                             Grails and use web.xml (installed via “grails
                             install-templates”) to map urls to servlets


Tuesday, November 18, 2008                                                   22
Resources
                   •         Home Pages:
                             http://grails.org
                             http://groovy.codehaus.org/

                   •         Live Open Source Applications
                             Grails Crowd
                             Grails.org
                             Groovy Blogs

                   •         Media
                             Groovy & Grails Podcast
                             GroovyMag

Tuesday, November 18, 2008                                   23
Groovy Mag
Tuesday, November 18, 2008                24
Sold?
                      Want to know more?
                   • Robert is offering “Introduction to Groovy,
                             Grails, and AJAX” training in the Triangle on
                             December 15th through 18th. Additional
                             training courses will be offered next year.
                   • Subscribe to “Smokejumper Training”
                             Google Group for more information.
                   • On-demand training, technical leadership,
                             and mentoring services are also available.
                             http://SmokejumperIT.com
Tuesday, November 18, 2008                                                   25

More Related Content

Similar to Intro To Grails

Behind The Scenes At My Spacecom
Behind The Scenes At My SpacecomBehind The Scenes At My Spacecom
Behind The Scenes At My SpacecomConSanFrancisco123
 
Merb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksMerb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksRowan Hick
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practicejavablend
 
Scripting Support in GFv3 Prelude - Full Version
Scripting Support in GFv3 Prelude - Full VersionScripting Support in GFv3 Prelude - Full Version
Scripting Support in GFv3 Prelude - Full VersionEduardo Pelegri-Llopart
 
Crate Packaging Standalone Ruby Applications
Crate  Packaging Standalone Ruby ApplicationsCrate  Packaging Standalone Ruby Applications
Crate Packaging Standalone Ruby Applicationsrailsconf
 
Why would a Java shop want to use Ruby?
Why would a Java shop want to use Ruby?Why would a Java shop want to use Ruby?
Why would a Java shop want to use Ruby?Keith Pitty
 
Grails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleyGrails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleySven Haiges
 
Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Cybera Inc.
 
Scaling Rails with memcached
Scaling Rails with memcachedScaling Rails with memcached
Scaling Rails with memcachedelliando dias
 
Generator Tricks for Systems Programmers
Generator Tricks for Systems ProgrammersGenerator Tricks for Systems Programmers
Generator Tricks for Systems ProgrammersHiroshi Ono
 
Building and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsBuilding and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsViget Labs
 
2009 Java One State Of The Open Web
2009 Java One State Of The Open Web2009 Java One State Of The Open Web
2009 Java One State Of The Open WebPatrick Chanezon
 
Javascript Framework Roundup FYB
Javascript Framework Roundup FYBJavascript Framework Roundup FYB
Javascript Framework Roundup FYBnukeevry1
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executablesJeremy Hinegardner
 
Unoesc - Ruby, Rails e JRuby
Unoesc - Ruby, Rails e JRubyUnoesc - Ruby, Rails e JRuby
Unoesc - Ruby, Rails e JRubyFabio Akita
 

Similar to Intro To Grails (20)

Behind The Scenes At My Spacecom
Behind The Scenes At My SpacecomBehind The Scenes At My Spacecom
Behind The Scenes At My Spacecom
 
Merb The Super Bike Of Frameworks
Merb The Super Bike Of FrameworksMerb The Super Bike Of Frameworks
Merb The Super Bike Of Frameworks
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice
 
Scripting Support in GFv3 Prelude - Full Version
Scripting Support in GFv3 Prelude - Full VersionScripting Support in GFv3 Prelude - Full Version
Scripting Support in GFv3 Prelude - Full Version
 
Crate Packaging Standalone Ruby Applications
Crate  Packaging Standalone Ruby ApplicationsCrate  Packaging Standalone Ruby Applications
Crate Packaging Standalone Ruby Applications
 
Why would a Java shop want to use Ruby?
Why would a Java shop want to use Ruby?Why would a Java shop want to use Ruby?
Why would a Java shop want to use Ruby?
 
Grails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleyGrails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon Valley
 
Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008Pstrong Cybera 29 Sept 2008
Pstrong Cybera 29 Sept 2008
 
Meet BrowserPlus
Meet BrowserPlusMeet BrowserPlus
Meet BrowserPlus
 
Scaling Rails with memcached
Scaling Rails with memcachedScaling Rails with memcached
Scaling Rails with memcached
 
Paperclip
PaperclipPaperclip
Paperclip
 
Generator Tricks for Systems Programmers
Generator Tricks for Systems ProgrammersGenerator Tricks for Systems Programmers
Generator Tricks for Systems Programmers
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Building and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on RailsBuilding and Working With Static Sites in Ruby on Rails
Building and Working With Static Sites in Ruby on Rails
 
2009 Java One State Of The Open Web
2009 Java One State Of The Open Web2009 Java One State Of The Open Web
2009 Java One State Of The Open Web
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
Javascript Framework Roundup FYB
Javascript Framework Roundup FYBJavascript Framework Roundup FYB
Javascript Framework Roundup FYB
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executables
 
Unoesc - Ruby, Rails e JRuby
Unoesc - Ruby, Rails e JRubyUnoesc - Ruby, Rails e JRuby
Unoesc - Ruby, Rails e JRuby
 

Recently uploaded

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Recently uploaded (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Intro To Grails

  • 1. Smokejumping Grails Robert Fischer, Smokejumper Consulting robert . fischer @ SmokejumperIT . com Presented Nov 17th, 2008 at the Triangle Java User Group (TriJUG) Tuesday, November 18, 2008 1
  • 2. Hi, I’m Robert Tuesday, November 18, 2008 2
  • 4. Born and Raised in Perl Tuesday, November 18, 2008 4
  • 5. Agile Java Consultant Tuesday, November 18, 2008 5
  • 6. Technical Blogger EnfranchisedMind.com • The Joy of BDD, or, Re-writing Your Code in Mocks and Asserts is Not Unit Testing • Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl) • 7 Actually Useful Things You Didn’t Know Static Typing Could Do: An Introduction for the Dynamic Language Enthusiast • A Defense of Prototypes, or, Why Does Tom Christiansen Hate Perl? Tuesday, November 18, 2008 6
  • 7. Groovy/Grails Fanboy • Introduced to Groovy/Grails at Carol.com, Active in Groovy Users of Minnesota • Uses Grails as freelancer to quickly develop prototype applications • Regular on IRC: FreeNode #groovy, #grails • Active on Groovy and Grails mailing lists • Autobase and BackgroundThread plugin Tuesday, November 18, 2008 7
  • 8. All Web App Development Should Be Grails Tuesday, November 18, 2008 8
  • 9. No, Really. • Stunningly simple development. • Succinct code using a superset of Java. • Sane defaults, straightforward configuration. • Static typing as deemed useful by developer. • Standard deployment approach. • SpringSource backed and here to stay. Tuesday, November 18, 2008 9
  • 10. What Is Grails? • Web application development framework/ environment leveraging Java and Groovy. • Convention-based MVC development with a set of powerful command-line tools. • Powered by pre-configured and pre- integrated Spring, Hibernate, SiteMesh, and JUnit. Tuesday, November 18, 2008 10
  • 11. How Would You Like Your Grails? • Conceptually thin dynamic MVC framework • Dynamic, succinct domain and controllers • Run from source code check-out • Mash-up with extensible plugin architecture • Actually approachable best-of-breed Java stack • Prepackaged Java environment and build system • Builds a WAR to plug into existing deployments • Hooks for existing Spring and Hibernate config Tuesday, November 18, 2008 11
  • 12. Grails Before Your Very Eyes! Live Coding! Tuesday, November 18, 2008 12
  • 13. But Wait, There’s More! Plugins • Functional Testing webtest, selenium, fitnesse • Rich User Interface (RIA) grails-ui, richui, gwt, flex, yui, iui • Database Management: Autobase • Background Tasks: BackgroundThread • And dozens more: http://grails.org/plugins Tuesday, November 18, 2008 13
  • 14. Autobase • Manages database state using a non-linear collection of database change sets. • Leverages existing Grails database automation to minimize effort. • Provides a Liquibase-based embedded DSL for database migrations. • http://github.com/RobertFischer/autobase/ wikis/ Tuesday, November 18, 2008 14
  • 15. Example Migration changeSet(id:'rename_bar_to_baz', author:'Robert') { dropColumn(tableName:'foo', columnName:'baz') renameColumn(tableName:quot;fooquot;, oldColumnName:quot;barquot;, newColumnName:quot;bazquot;) } Tuesday, November 18, 2008 15
  • 16. Background Thread • Provides a Spring bean that will execute arbitrary closures in the background. • Handles some awkwardness around Hibernate sessions, and provides thread pooling and logging. • http://grails.org/BackgroundThread+Plugin Tuesday, November 18, 2008 16
  • 17. BackgroundThread Usage Example class FooService { boolean transactional = false def backgroundService def serviceMethod() { (1..<10).each { cnt -> backgroundService.execute(quot;Logging '$cnt'”, { log.info(quot;${cnt}quot;) }) } } Tuesday, November 18, 2008 17
  • 18. But What About JRuby on Rails? Tuesday, November 18, 2008 18
  • 19. My JRuby on Rails Street Cred • Work history in Rails, including last 5 months on a JRuby on Rails project • Regular attendee, competition member, and one-time presenter at Ruby Users of Minnesota (RUM) • Charlie “Headius” Nutter fan Tuesday, November 18, 2008 19
  • 20. Why Not JRuby on Rails? • Although Java-in-Ruby is fairly slick, Ruby-in-Java is pretty rough and best mediated via Groovy metaprogramming • GORM is superior to ActiveRecord • http://www.oreillynet.com/ruby/blog/2007/05/ bind_parameters_now.html • GSPs are superior to ActionView • Spring is superior to nothing • Optional static typing is superior to pure dynamic typing • You can code Grails without grokking its source • Nobody is fired for choosing Java Tuesday, November 18, 2008 20
  • 21. The One Circumstance I Would Still Use Rails • Small CRUD-based app with its own DB • No or very generous performance limits • Owned by one or two developers • Expected life cycle of less than a year • Deployed system is without Java or is an Apache web server with mod_passenger and without mod_proxy or mod_jk Tuesday, November 18, 2008 21
  • 22. Your Grails Adoption Plan • Best approach: start with a roughly green- field proof-of-concept web application • Use GRAG on SourceForge to generate a database front-end to impress your boss • Wrap an existing Java web application in Grails and use web.xml (installed via “grails install-templates”) to map urls to servlets Tuesday, November 18, 2008 22
  • 23. Resources • Home Pages: http://grails.org http://groovy.codehaus.org/ • Live Open Source Applications Grails Crowd Grails.org Groovy Blogs • Media Groovy & Grails Podcast GroovyMag Tuesday, November 18, 2008 23
  • 25. Sold? Want to know more? • Robert is offering “Introduction to Groovy, Grails, and AJAX” training in the Triangle on December 15th through 18th. Additional training courses will be offered next year. • Subscribe to “Smokejumper Training” Google Group for more information. • On-demand training, technical leadership, and mentoring services are also available. http://SmokejumperIT.com Tuesday, November 18, 2008 25