groovy & grails jean barmash cto, energyscorecards.com

13
Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com www.nywebguy.com

Upload: jesse-black

Post on 21-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Groovy & Grails

Jean BarmashCTO, EnergyScoreCards.com

www.nywebguy.com

Page 2: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Agenda

• Groovy – Introduction– Examples

• Grails– Introduction– Convention over Configuration– Build A Simple App

Page 3: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Groovy

• Dynamic Language on JVM• Focus on programmer productivity• Focus on Essence vs. Ceremony• Superset of Java• Native Java Library Integration• Compiles into Java• Dynamic Typing• Native Syntax for Lists, Maps, Sets, Ranges

Page 4: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Very Sweet – Tons of Syntactic Sugar

• Tons of Options– Optional parentheses– Optional semicolons– Optional Return

• Safe Dereferencing• Autoboxing• GStrings• Regular Expressions• Autogenerated Setters / Getters• Even Elvis….

Page 5: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Even Groovier

• Closures• MixIns & Categories• Advanced MetaProgramming Capabilities• AST (Abstract Syntax Tree) Transformations• Great XML Processing Capabilities• Object Builders / XML Builders• Easy to make DSLs• Google App Engine

Page 6: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Grails• Web Development framework inspired by Ruby

on Rails– Convention over Configuration– DRY – Do Not Repeat Yourself– More focused on domain objects than Rails

• Underlying Libraries:– Hibernate – Spring – SiteMesh – Quartz– J2EE / Servlet

Page 7: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Grails Key Features

• Convention over Configuration– Domain Objects– Controllers– Views– Services– Dependency Injection

Page 8: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

GORM

• GORM – Robust Domain Modeling Layer– Built on Top of Hibernate, which is hidden– Advanced Layer for modeling of relationships– Maps to Database over JDBC or JPA– Dynamic Finders – query the objects– CRUD Operations– Constraints– Performance Optimizations

• Can be used outside of Grails, including in Java Apps

Page 9: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

UI Features

• Scaffolding to generate Views• Layout Elements• VERY Easy TagLibs• Converters to create RESTful services

Page 10: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Plugins, Plugins, Plugins

• A core concept in Grails– Unit of Functionality– Unit of Reusability– Unit of Integration

• Creating a plugin is almost identical to creating an application

• Over 200 Plugins in all sorts of areas– Central Repository– http://grails.org/plugin/home

Page 11: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Other Stuff

• Gradle – dependency resolution• Gant – build tool• GPars – actor concurrency library• Griphon – Grails like framework for building

Swing application

Page 12: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Resources• Groovy Usage Patterns

– http://gettinggroovy.wordpress.com/2009/05/20/the-gr8-conference-groovy-usage-patterns/

• Grails – www.grails.org• Groovy – http://groovy.codehaus.org

Page 13: Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com

Demo