SVCC Intro to Grails

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    SVCC Intro to Grails - Presentation Transcript

    1. Introduction to Grails James Williams
    2. Introduction
      • James Williams
      • Groovy committer
      • Author of Google charts plugin
      • Griffon co-creator
      • Creator of SwingXBuilder
    3. Agenda
      • What is Grails?
      • Domain Classes
      • Controllers
      • GSP/Taglibs
      • Plugins
      • Web Services
      • Conclusion
    4. What is Grails?
      • Rapid web application development
      • Full-stack MVC framework
      • Open source
      • Runs on the JVM
    5. What is Grails? (cont'd)
      • Integrates best of breed tools...
      • And many more...
    6. Grails Quickstart
      • Install Grails
      • Run grails create-app <name>
      • Run grails run-app
    7. Domain Classes
      • Core objects that make up a Grails app
      • Are seamlessly persisted to storage
      • Can have constraints on values
      • Can have relationships with other domain classes
    8. Constraints
      • Determine the validity of member fields
      • blank
      • creditCard
      • email
      • inList
      • matches
      • max
      • maxSize
      • min
      • minSize
      • notEqual
      • nullable
      • range
      • scale
      • size
      • unique
      • url
      • validator
    9. Grails ORM (GORM)
      • No hassle database persistence
      • Leverages Hibernate but minus .hbm files and other messy configuration files
      • Provides dynamic domain class methods like...
      • create
      • save
      • delete
      • update
      • get
      • find
      • findAll
      • addTo
      • count
      • ....
    10. Relationships
      • One to one
      • One to many (hasMany)
      • Many to many
    11. Demo
      • Domain Classes Demo
    12. Controllers
      • Manages requests and response for domain objects
      • Unless overridden, maps requests to a REST-like structure /<domain class>/action_name
      • It's actions can be generated on the fly by the application
    13. Groovy Server Pages
      • Provide views for domain objects
      • Like JSP, GSPs can be a mix of markup, Groovy code and GSP tags*
      • Generally correspond to an associated action in the controller
      • Code fragments use the <% %> and <%= %> forms, though this is discouraged
    14. Typical GSP
      • <html>
      • <body>
      • <% [1,2,3,4].each { num -> %>
      • <p><%=&quot;Hello ${num}!&quot; %></p>
      • <%}%>
      • </body>
      • </html>
    15. Taglibs
      • Allow the developer to simplify blocks of code
      • Similar to JSP tag libs class SimpleTagLib { def emoticon = { attrs, body -> out << body() << attrs.happy == 'true' ? &quot; :-)&quot; : &quot; :-(&quot; } }
      • Can be declared at an application or plugin level (e.g. Grails Chart plugin)
    16. Taglibs in the wild
      • <html>
        • <body>
          • <g:emoticon happy='true'>
        • </body>
      • </html>
    17. Demo
      • Controllers and GSP Demo
    18. Databases
      • Grails supports almost all JDBC compliant databases
      • grails-app/conf/Datasources.groovy allows you to specify datasources for different env's
      • environments {
        • development {
          • dataSource {
            • dbCreate = &quot;update&quot;
            • url = &quot;jdbc:hsqldb:mem:devDB&quot;
            • pooled = true
            • driverClassName = &quot;org.hsqldb.jdbcDriver&quot;
            • username = &quot;sa&quot;
            • password = &quot;&quot;
          • }
      • }
    19. Plugins
      • Grails applications in and of themselves
      • Can
        • provide shortcuts to core tasks
        • encapsulate and integrate external tools
      • Benefit from the huge library of J2EE tools and libraries
      • Over 50 hosted at grails.org
    20. Web Services
      • REST
      • SOAP (requires XFire plugin) class BookService {
        • static expose=['xfire']
        • Book[] getBooks(){ Book.list() as Book[] }
      • }
      • XML Marshaling as XML
      • JSON Marshaling as JSON
    21. Demo
      • Plugins and Web services Demo
    22. Resources
      • Websites
        • grails.org
        • grailspodcast.com
        • groovyblogs.com
      • Books
    23. Questions?
      • Contact me
      • http://jameswilliams.be/blog
      • @ecspike

    + James WilliamsJames Williams, 2 years ago

    custom

    399 views, 1 favs, 0 embeds more stats

    Given at Silicon Valley Code Camp

    More info about this document

    CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

    Go to text version

    • Total Views 399
      • 399 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 13
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags