SlideShare a Scribd company logo
Grails 101


     Lim Chee Kin
     limcheekin@vobject.com
     http://limcheekin.blogspot.com
About Me
●   Moderator of the Malaysia Groovy and Grails User Group
●   Involved in Grails development since version 0.6 and
    developed 15 Grails plugins to date
●   10+ years experience in software development and
    solution consulting for Java EE platform
●   Experience spans across various industries, including
    retail sector, telecommunication, heath care and
    financial services industry.
●   Experienced in many frameworks and web technologies,
    including Java EE, SpringFramework, Hibernate, Groovy,
    Grails Framework, Web Services, JQuery, JQuery UI
Why Grails

●


●


●   To practice agile development process you
    need an agile framework.
Inside Grails
●   Seamless integration of ...
●   Groovy                ●   Tomcat
●   Java                  ●   Ant
●   SpringFramework       ●   Maven
●   Hibernate             ●   Log4J
●   Java EE               ●   H2 Database
●   Sitemesh              ●   Quartz
●   JQuery                ●   ... many more
Best Practices Support
●   Convention over Configuration         standard directory
    structure

●   Dependency Injection SpringFramework
●   Model domain class View GSP Controller groovy class
●   Test Automation JUnit, Spock
●   Modularization plugin system
●   Code Generation scaffolding
●   Fast Development Cycle dynamic reloading
Running Grails App in 5 minutes

●   Step 1: grails create-app addressbook
●


●   Step 2: grails create-domain-class Person
●


●   Step 3: grails generate-all Person
●


●   Step 4: grails run-app
Step 1: grails create-app addressbook
●   Created Grails Application at /opt/dev/ws/addressbook
Step 1: grails create-app addressbook
    /addressbook
●     application.properties
●     grails-app/conf/            --> location of configuration artifacts
●     grails-app/conf/hibernate   --> optional hibernate config
●     grails-app/conf/spring      --> optional spring config
●     grails-app/controllers/     --> location of controller artifacts
●     grails-app/domain/          --> location of domain classes
●     grails-app/i18n/            --> location of message bundles for i18n
●     grails-app/services/        --> location of services
●     grails-app/taglib/          --> location of tag libraries
●     grails-app/utils/           --> location of grails specific utility classes
●     grails-app/views/           --> location of views
●     grails-app/views/layouts    --> location of layouts
●     lib/                        --> jar files not available via installed plugins
●     scripts/                    --> scripts
●     src/groovy                  --> optional; location for Groovy source files (of types
                                      other than those in grails-app/*)
●     src/java                    --> optional; location for Java source files
●     test/                       --> test classes
●     web-app/                    --> css, images, etc, etc, etc.
Step 2: grails create-domain-class Person
●   Created file grails-app/domain/addressbook/Person.groovy
    Created file test/unit/addressbook/PersonTests.groovy
●

●   class Person {
●    String firstName
●    String lastName
●    Date dateOfBirth
●    Integer age
●

●       static constraints = {
●        firstName(nullable:true, maxSize:60)
●        lastName(nullable:true, maxSize:30)
●        dateOfBirth(nullable:true, maxSize:10)
●        age(nullable:true)
●        }
●   }
Step 3: grails generate-all Person
●   Finished generation for domain class addressbook.Person
Step 4: grails run-app
Server running. Browse to http://localhost:8080/addressbook
Step 4: grails run-app
Step 4: grails run-app
My Open Source Grails Plugins
●   I contributed 15 Grails plugins out of 826
    (13 Aug 2012), including:
●   Grails Activiti Plugin
●   http://code.google.com/p/grails-activiti-plugin/
●   Grails Form Builder Plugin
●   http://code.google.com/p/grails-form-builder-plugin/
●   JQuery Validation UI Plugin
●   http://grails.org/plugin/jquery-validation-ui
●   Mahout Recommender Plugin
●   https://github.com/limcheekin/mahout-recommender

●   Find out more at http://goo.gl/VPVrd
Q&A

More Related Content

Similar to Grails 101

Grails
GrailsGrails
Grails
Vijay Shukla
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
Jeevesh Pandey
 
Groovy and noteworthy
Groovy and noteworthyGroovy and noteworthy
Groovy and noteworthy
Izzet Mustafaiev
 
Groovy shell scripting
Groovy shell scriptingGroovy shell scripting
Groovy shell scripting
Georg Berky
 
Inrotograils 140211155206-phpapp01
Inrotograils 140211155206-phpapp01Inrotograils 140211155206-phpapp01
Inrotograils 140211155206-phpapp01Hiten Pratap Singh
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
NexThoughts Technologies
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
Michael Yan
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
Hiten Pratap Singh
 
Android, Gradle & Dependecies
Android, Gradle & DependeciesAndroid, Gradle & Dependecies
Android, Gradle & Dependecies
Édipo Souza
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
Jody Garnett
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
Izzet Mustafaiev
 
Gluster containers!
Gluster containers!Gluster containers!
Gluster containers!
Humble Chirammal
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
David Amend
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
TO THE NEW | Technology
 
GlusterFS Containers
GlusterFS ContainersGlusterFS Containers
GlusterFS Containers
Mohamed Ashiq
 
Develop Android/iOS app using golang
Develop Android/iOS app using golangDevelop Android/iOS app using golang
Develop Android/iOS app using golang
SeongJae Park
 

Similar to Grails 101 (20)

Grails
GrailsGrails
Grails
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Groovy and noteworthy
Groovy and noteworthyGroovy and noteworthy
Groovy and noteworthy
 
Grails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLTGrails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLT
 
Groovy shell scripting
Groovy shell scriptingGroovy shell scripting
Groovy shell scripting
 
Inrotograils 140211155206-phpapp01
Inrotograils 140211155206-phpapp01Inrotograils 140211155206-phpapp01
Inrotograils 140211155206-phpapp01
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
 
Android, Gradle & Dependecies
Android, Gradle & DependeciesAndroid, Gradle & Dependecies
Android, Gradle & Dependecies
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Grails 101
Grails 101Grails 101
Grails 101
 
Gluster containers!
Gluster containers!Gluster containers!
Gluster containers!
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
 
GlusterFS Containers
GlusterFS ContainersGlusterFS Containers
GlusterFS Containers
 
Develop Android/iOS app using golang
Develop Android/iOS app using golangDevelop Android/iOS app using golang
Develop Android/iOS app using golang
 
Whats New In Groovy 1.6?
Whats New In Groovy 1.6?Whats New In Groovy 1.6?
Whats New In Groovy 1.6?
 

Recently uploaded

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
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
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
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
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
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

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 Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
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
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
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 -...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Grails 101

  • 1. Grails 101 Lim Chee Kin limcheekin@vobject.com http://limcheekin.blogspot.com
  • 2. About Me ● Moderator of the Malaysia Groovy and Grails User Group ● Involved in Grails development since version 0.6 and developed 15 Grails plugins to date ● 10+ years experience in software development and solution consulting for Java EE platform ● Experience spans across various industries, including retail sector, telecommunication, heath care and financial services industry. ● Experienced in many frameworks and web technologies, including Java EE, SpringFramework, Hibernate, Groovy, Grails Framework, Web Services, JQuery, JQuery UI
  • 3. Why Grails ● ● ● To practice agile development process you need an agile framework.
  • 4. Inside Grails ● Seamless integration of ... ● Groovy ● Tomcat ● Java ● Ant ● SpringFramework ● Maven ● Hibernate ● Log4J ● Java EE ● H2 Database ● Sitemesh ● Quartz ● JQuery ● ... many more
  • 5. Best Practices Support ● Convention over Configuration standard directory structure ● Dependency Injection SpringFramework ● Model domain class View GSP Controller groovy class ● Test Automation JUnit, Spock ● Modularization plugin system ● Code Generation scaffolding ● Fast Development Cycle dynamic reloading
  • 6. Running Grails App in 5 minutes ● Step 1: grails create-app addressbook ● ● Step 2: grails create-domain-class Person ● ● Step 3: grails generate-all Person ● ● Step 4: grails run-app
  • 7. Step 1: grails create-app addressbook ● Created Grails Application at /opt/dev/ws/addressbook
  • 8. Step 1: grails create-app addressbook /addressbook ● application.properties ● grails-app/conf/ --> location of configuration artifacts ● grails-app/conf/hibernate --> optional hibernate config ● grails-app/conf/spring --> optional spring config ● grails-app/controllers/ --> location of controller artifacts ● grails-app/domain/ --> location of domain classes ● grails-app/i18n/ --> location of message bundles for i18n ● grails-app/services/ --> location of services ● grails-app/taglib/ --> location of tag libraries ● grails-app/utils/ --> location of grails specific utility classes ● grails-app/views/ --> location of views ● grails-app/views/layouts --> location of layouts ● lib/ --> jar files not available via installed plugins ● scripts/ --> scripts ● src/groovy --> optional; location for Groovy source files (of types other than those in grails-app/*) ● src/java --> optional; location for Java source files ● test/ --> test classes ● web-app/ --> css, images, etc, etc, etc.
  • 9. Step 2: grails create-domain-class Person ● Created file grails-app/domain/addressbook/Person.groovy Created file test/unit/addressbook/PersonTests.groovy ● ● class Person { ● String firstName ● String lastName ● Date dateOfBirth ● Integer age ● ● static constraints = { ● firstName(nullable:true, maxSize:60) ● lastName(nullable:true, maxSize:30) ● dateOfBirth(nullable:true, maxSize:10) ● age(nullable:true) ● } ● }
  • 10. Step 3: grails generate-all Person ● Finished generation for domain class addressbook.Person
  • 11. Step 4: grails run-app Server running. Browse to http://localhost:8080/addressbook
  • 12. Step 4: grails run-app
  • 13. Step 4: grails run-app
  • 14. My Open Source Grails Plugins ● I contributed 15 Grails plugins out of 826 (13 Aug 2012), including: ● Grails Activiti Plugin ● http://code.google.com/p/grails-activiti-plugin/ ● Grails Form Builder Plugin ● http://code.google.com/p/grails-form-builder-plugin/ ● JQuery Validation UI Plugin ● http://grails.org/plugin/jquery-validation-ui ● Mahout Recommender Plugin ● https://github.com/limcheekin/mahout-recommender ● Find out more at http://goo.gl/VPVrd
  • 15. Q&A