SlideShare a Scribd company logo
1 of 23
(A case for) GRAILS Mark Daugherty CITYTECH, Inc. July 7th, 2010
Outline Inspiration Grails overview Comparison of Java/Spring/JPA application to Groovy/Grails
Context February 2010 : wrote a small Groovy/Grails app to learn the technologies March 1st, 2010 : started on CDGA project (Struts, Spring, JPA) March 1st, 2010 (later that day) : realized that CDGA had an enormous amount of boilerplate code that Grails could eliminate
(Additional) Context May 7th, 2010 : wrote CITYTECH blog post about code savings from replacing Spring DAO code with Grails May 8th, 2010 – present : blog is read by a total of 4 CITYTECH employees July 7th, 2010 : Grails begins to learn at a geometric rate.  It becomes self-aware at 2:14 AM, Eastern time.
Grails Primer Web application framework built with Groovy (Java-based dynamic language) on top of proven Java technologies Spring MVC, Hibernate Full stack for rapid development Embedded Tomcat container, HSQLDB, (G)Ant, scaffolding features Get a basic app running within minutes
You may notice… Convention over configuration Little-to-no initial configuration Project structure is predefined according to best practices Command line scripts for common tasks Create new application, compile, test, run Generate domain classes, controllers, services, test cases Install plugins Contrast with your last Maven-built project
In practice…
Simple Domain Delegate 1  ∞ User Delegate 1  ∞ Application A “delegate agency” has one-to-many users and one-to-many applications.  An application contains various forms, input by users, to collect data about the delegate agency.
JPA (Java Persistence API) @Entity @Table(name = "USER") public class User implements Serializable {     @Id     private Integer id;     @OneToOne(fetch = FetchType.LAZY)     @JoinColumn(name = "DELEGATE", referencedColumnName = "ID")     private Delegate delegate;     // getters and setters, equals(), hashCode(), toString()… }
(More) JPA @Entity @Table(name = "DELEGATE") public class Delegate implements Serializable {     @Id     private Integer id;     @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)     private Set<User> users;     @OneToMany(cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)     private Set<Application> applications; 	 // getters and setters, equals(), hashCode(), toString()... }
(Still more) JPA @Entity @Table(name = "APPLICATION") public class Application implements Serializable {     @Id     private Integer id;     @ManyToOne(cascade = { CascadeType.REFRESH }, optional = false)     @JoinColumn(name = "DELEGATE”)     private Delegate delegate; 	// getters and setters, equals(), hashCode(), toString()... }
Grails class User { 	static belongsTo = [delegate:Delegate] } class Delegate { 	static hasMany = [users:User, applications:Application] 	static mapping = { 	    users lazy:false 		   applications cascade:'delete' 	} } class Application { 	static belongsTo = [delegate:Delegate] 	static mapping = { 		   delegate cascade:'refresh' 	} }
DAO JPA/Hibernate = verbose, repetitive Even a small domain model can have 1000’s of lines of code for basic CRUD operations Tedious to maintain
GORM! Hibernate under the hood Groovy + runtime code synthesis to eliminate boilerplate code
Basic CRUD
Dynamic Finders
Additional GORM Features ORM DSL for mapping to legacy DB schemas Custom mappings for non-standard table and column names Event handlers (beforeInsert, afterUpdate) Customizable caching and fetching strategies, transactions
Web Render XML or JSON responses using markup builders Automatic marshalling of domain classes to XML/JSON
(More) Web GSP Similar to JSP, but with better tag libraries findAll, grep (filter) for collections Method calls Templates Sitemesh (decorator) layouts Customizable URL mappings
Validation Often painful, less so with Grails
More Features Spring Web Flow Supports subflows, conversation scope (similar to Seam) Interceptors / Filters AJAX DOJO, GWT plugins
Even more to like Groovy tests Ideal for TDD Unit tests created automatically from command line script Dynamic language features for easy mocking Easy RESTful web services URL mappings Controllers can render XML or JSON Consider attending a CGUG meeting Extremely active community 400+ plugins (Spring Security, JQuery, GWT, Google App Engine, Flex) Wide range of tutorials Frequent releases
Summary Grails compared to Spring, EJB, JPA Substantially less code without compromises Easier to maintain and test Shorter iterations and release cycles Same proven underlying technologies Gain competitive edge Why not?

More Related Content

What's hot

What’s behind a high quality web API? Ensure your APIs are more than just a ...
What’s behind a high quality web API? Ensure your APIs are more than just a ...What’s behind a high quality web API? Ensure your APIs are more than just a ...
What’s behind a high quality web API? Ensure your APIs are more than just a ...Kim Clark
 
Keyword Services Platform (KSP) from Microsoft adCenter
Keyword Services Platform (KSP) from Microsoft adCenterKeyword Services Platform (KSP) from Microsoft adCenter
Keyword Services Platform (KSP) from Microsoft adCentergoodfriday
 
External - IT Specialist
External - IT SpecialistExternal - IT Specialist
External - IT SpecialistJacob Wardon
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperKarthik Reddy
 
Differentiating between web APIs, SOA, & integration …and why it matters
Differentiating between web APIs, SOA, & integration…and why it mattersDifferentiating between web APIs, SOA, & integration…and why it matters
Differentiating between web APIs, SOA, & integration …and why it mattersKim Clark
 
20101007 how smart use cases drive web development
20101007   how smart use cases drive web development20101007   how smart use cases drive web development
20101007 how smart use cases drive web developmentSander Hoogendoorn
 
Opac labs overview-pr1.0
Opac labs overview-pr1.0Opac labs overview-pr1.0
Opac labs overview-pr1.0opaclabs
 
Taking a REST and being HAPI
Taking a REST and being HAPITaking a REST and being HAPI
Taking a REST and being HAPIChris Davenport
 
Joomla in a world of ubiquitous computing
Joomla in a world of ubiquitous computingJoomla in a world of ubiquitous computing
Joomla in a world of ubiquitous computingChris Davenport
 
React js vs react native a comparative analysis
React js vs react native a comparative analysisReact js vs react native a comparative analysis
React js vs react native a comparative analysisShelly Megan
 
We don’t need no stinkin app server! Building a Two-Tier Mobile App
We don’t need no stinkin app server! Building a Two-Tier Mobile AppWe don’t need no stinkin app server! Building a Two-Tier Mobile App
We don’t need no stinkin app server! Building a Two-Tier Mobile AppPat Patterson
 
S Kumar Resume
S Kumar ResumeS Kumar Resume
S Kumar ResumeS Kumar
 
Sanjeev_Kumar_Paul- Resume-Latest
Sanjeev_Kumar_Paul- Resume-LatestSanjeev_Kumar_Paul- Resume-Latest
Sanjeev_Kumar_Paul- Resume-LatestSanjeev Kumar Paul
 
2015-05-19-resume
2015-05-19-resume2015-05-19-resume
2015-05-19-resumeLee Norris
 

What's hot (20)

What’s behind a high quality web API? Ensure your APIs are more than just a ...
What’s behind a high quality web API? Ensure your APIs are more than just a ...What’s behind a high quality web API? Ensure your APIs are more than just a ...
What’s behind a high quality web API? Ensure your APIs are more than just a ...
 
Resume
ResumeResume
Resume
 
Keyword Services Platform (KSP) from Microsoft adCenter
Keyword Services Platform (KSP) from Microsoft adCenterKeyword Services Platform (KSP) from Microsoft adCenter
Keyword Services Platform (KSP) from Microsoft adCenter
 
Gangadhar_Challa_Profile
Gangadhar_Challa_ProfileGangadhar_Challa_Profile
Gangadhar_Challa_Profile
 
External - IT Specialist
External - IT SpecialistExternal - IT Specialist
External - IT Specialist
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
 
Differentiating between web APIs, SOA, & integration …and why it matters
Differentiating between web APIs, SOA, & integration…and why it mattersDifferentiating between web APIs, SOA, & integration…and why it matters
Differentiating between web APIs, SOA, & integration …and why it matters
 
DOT NET RESUME
DOT NET RESUMEDOT NET RESUME
DOT NET RESUME
 
20101007 how smart use cases drive web development
20101007   how smart use cases drive web development20101007   how smart use cases drive web development
20101007 how smart use cases drive web development
 
Opac labs overview-pr1.0
Opac labs overview-pr1.0Opac labs overview-pr1.0
Opac labs overview-pr1.0
 
Taking a REST and being HAPI
Taking a REST and being HAPITaking a REST and being HAPI
Taking a REST and being HAPI
 
Surya resume WSU
Surya resume WSUSurya resume WSU
Surya resume WSU
 
Joomla in a world of ubiquitous computing
Joomla in a world of ubiquitous computingJoomla in a world of ubiquitous computing
Joomla in a world of ubiquitous computing
 
React js vs react native a comparative analysis
React js vs react native a comparative analysisReact js vs react native a comparative analysis
React js vs react native a comparative analysis
 
We don’t need no stinkin app server! Building a Two-Tier Mobile App
We don’t need no stinkin app server! Building a Two-Tier Mobile AppWe don’t need no stinkin app server! Building a Two-Tier Mobile App
We don’t need no stinkin app server! Building a Two-Tier Mobile App
 
Resume
ResumeResume
Resume
 
S Kumar Resume
S Kumar ResumeS Kumar Resume
S Kumar Resume
 
Sanjeev_Kumar_Paul- Resume-Latest
Sanjeev_Kumar_Paul- Resume-LatestSanjeev_Kumar_Paul- Resume-Latest
Sanjeev_Kumar_Paul- Resume-Latest
 
Mobile Apps Develpment - A Comparison
Mobile Apps Develpment - A ComparisonMobile Apps Develpment - A Comparison
Mobile Apps Develpment - A Comparison
 
2015-05-19-resume
2015-05-19-resume2015-05-19-resume
2015-05-19-resume
 

Viewers also liked

[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'
[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'
[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'Lucy Hull
 
Easy way to embed video
Easy way to embed videoEasy way to embed video
Easy way to embed videoguest3b3fc2
 
Tugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan PembelajaranTugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan Pembelajaranlindiani
 
Tugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan PembelajaranTugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan Pembelajaranlindiani
 
Introduction to derivatives
Introduction to derivatives Introduction to derivatives
Introduction to derivatives Saifu Rather
 
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...Publishing Technology
 
Group Project
Group ProjectGroup Project
Group Projectdarnay12
 
Mokama reklama Facebook.com tinkle
Mokama reklama Facebook.com tinkleMokama reklama Facebook.com tinkle
Mokama reklama Facebook.com tinklePDFONTOUR
 
Takahe by Jacob, Claire, Yuan and Karen L
Takahe by Jacob, Claire, Yuan and Karen LTakahe by Jacob, Claire, Yuan and Karen L
Takahe by Jacob, Claire, Yuan and Karen LHelenOfTroy
 
English introduction
English introductionEnglish introduction
English introductiongabriela
 
Itunes vs rhapsody
Itunes vs rhapsodyItunes vs rhapsody
Itunes vs rhapsodycmcsoley458
 
1อนุชิตเผยแพร่
1อนุชิตเผยแพร่1อนุชิตเผยแพร่
1อนุชิตเผยแพร่somdetpittayakom school
 
《氪周刊:互联网创业必读》(第65期)
《氪周刊:互联网创业必读》(第65期)《氪周刊:互联网创业必读》(第65期)
《氪周刊:互联网创业必读》(第65期)Chada Chiu
 

Viewers also liked (20)

92
9292
92
 
Pwp Actors
Pwp ActorsPwp Actors
Pwp Actors
 
Kurikulum Dan Pembelajaran
Kurikulum Dan PembelajaranKurikulum Dan Pembelajaran
Kurikulum Dan Pembelajaran
 
[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'
[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'
[Matt Morrison] The Societal Web: How we can Model & Measure 'Influence'
 
Easy way to embed video
Easy way to embed videoEasy way to embed video
Easy way to embed video
 
Linkedin
LinkedinLinkedin
Linkedin
 
Tugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan PembelajaranTugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan Pembelajaran
 
Asuhan keperawatan lansia 2013 diii kep
Asuhan keperawatan lansia 2013 diii kepAsuhan keperawatan lansia 2013 diii kep
Asuhan keperawatan lansia 2013 diii kep
 
10 Things to Do at SXSW
10 Things to Do at SXSW10 Things to Do at SXSW
10 Things to Do at SXSW
 
Tugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan PembelajaranTugas Kurikulum Dan Pembelajaran
Tugas Kurikulum Dan Pembelajaran
 
Introduction to derivatives
Introduction to derivatives Introduction to derivatives
Introduction to derivatives
 
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...
The Semantic Web and Book Publishing - Supply Chain Seminar, London Book Fair...
 
Group Project
Group ProjectGroup Project
Group Project
 
Mokama reklama Facebook.com tinkle
Mokama reklama Facebook.com tinkleMokama reklama Facebook.com tinkle
Mokama reklama Facebook.com tinkle
 
Takahe by Jacob, Claire, Yuan and Karen L
Takahe by Jacob, Claire, Yuan and Karen LTakahe by Jacob, Claire, Yuan and Karen L
Takahe by Jacob, Claire, Yuan and Karen L
 
English introduction
English introductionEnglish introduction
English introduction
 
Herhaling V2B
Herhaling V2BHerhaling V2B
Herhaling V2B
 
Itunes vs rhapsody
Itunes vs rhapsodyItunes vs rhapsody
Itunes vs rhapsody
 
1อนุชิตเผยแพร่
1อนุชิตเผยแพร่1อนุชิตเผยแพร่
1อนุชิตเผยแพร่
 
《氪周刊:互联网创业必读》(第65期)
《氪周刊:互联网创业必读》(第65期)《氪周刊:互联网创业必读》(第65期)
《氪周刊:互联网创业必读》(第65期)
 

Similar to The Case for Grails: How It Eliminates Boilerplate Code

Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Guillaume Laforge
 
sMash at May NYPHP UG
sMash at May NYPHP UGsMash at May NYPHP UG
sMash at May NYPHP UGProject Zero
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 
Compass Framework
Compass FrameworkCompass Framework
Compass FrameworkLukas Vlcek
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web DevelopmentRobert J. Stein
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Lars Vogel
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009marpierc
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansCarol McDonald
 
Spring boot 3g
Spring boot 3gSpring boot 3g
Spring boot 3gvasya10
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than YouRobert Cooper
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedPeter Lubbers
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCJim Tochterman
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And GroovyKen Kousen
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 

Similar to The Case for Grails: How It Eliminates Boilerplate Code (20)

Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 
sMash at May NYPHP UG
sMash at May NYPHP UGsMash at May NYPHP UG
sMash at May NYPHP UG
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
Java Technology
Java TechnologyJava Technology
Java Technology
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J)
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
 
my test
my testmy test
my test
 
Spring boot 3g
Spring boot 3gSpring boot 3g
Spring boot 3g
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And Groovy
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

The Case for Grails: How It Eliminates Boilerplate Code

  • 1. (A case for) GRAILS Mark Daugherty CITYTECH, Inc. July 7th, 2010
  • 2. Outline Inspiration Grails overview Comparison of Java/Spring/JPA application to Groovy/Grails
  • 3. Context February 2010 : wrote a small Groovy/Grails app to learn the technologies March 1st, 2010 : started on CDGA project (Struts, Spring, JPA) March 1st, 2010 (later that day) : realized that CDGA had an enormous amount of boilerplate code that Grails could eliminate
  • 4. (Additional) Context May 7th, 2010 : wrote CITYTECH blog post about code savings from replacing Spring DAO code with Grails May 8th, 2010 – present : blog is read by a total of 4 CITYTECH employees July 7th, 2010 : Grails begins to learn at a geometric rate. It becomes self-aware at 2:14 AM, Eastern time.
  • 5. Grails Primer Web application framework built with Groovy (Java-based dynamic language) on top of proven Java technologies Spring MVC, Hibernate Full stack for rapid development Embedded Tomcat container, HSQLDB, (G)Ant, scaffolding features Get a basic app running within minutes
  • 6. You may notice… Convention over configuration Little-to-no initial configuration Project structure is predefined according to best practices Command line scripts for common tasks Create new application, compile, test, run Generate domain classes, controllers, services, test cases Install plugins Contrast with your last Maven-built project
  • 8. Simple Domain Delegate 1  ∞ User Delegate 1  ∞ Application A “delegate agency” has one-to-many users and one-to-many applications. An application contains various forms, input by users, to collect data about the delegate agency.
  • 9. JPA (Java Persistence API) @Entity @Table(name = "USER") public class User implements Serializable { @Id private Integer id; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "DELEGATE", referencedColumnName = "ID") private Delegate delegate; // getters and setters, equals(), hashCode(), toString()… }
  • 10. (More) JPA @Entity @Table(name = "DELEGATE") public class Delegate implements Serializable { @Id private Integer id; @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER) private Set<User> users; @OneToMany(cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY) private Set<Application> applications; // getters and setters, equals(), hashCode(), toString()... }
  • 11. (Still more) JPA @Entity @Table(name = "APPLICATION") public class Application implements Serializable { @Id private Integer id; @ManyToOne(cascade = { CascadeType.REFRESH }, optional = false) @JoinColumn(name = "DELEGATE”) private Delegate delegate; // getters and setters, equals(), hashCode(), toString()... }
  • 12. Grails class User { static belongsTo = [delegate:Delegate] } class Delegate { static hasMany = [users:User, applications:Application] static mapping = { users lazy:false applications cascade:'delete' } } class Application { static belongsTo = [delegate:Delegate] static mapping = { delegate cascade:'refresh' } }
  • 13. DAO JPA/Hibernate = verbose, repetitive Even a small domain model can have 1000’s of lines of code for basic CRUD operations Tedious to maintain
  • 14. GORM! Hibernate under the hood Groovy + runtime code synthesis to eliminate boilerplate code
  • 17. Additional GORM Features ORM DSL for mapping to legacy DB schemas Custom mappings for non-standard table and column names Event handlers (beforeInsert, afterUpdate) Customizable caching and fetching strategies, transactions
  • 18. Web Render XML or JSON responses using markup builders Automatic marshalling of domain classes to XML/JSON
  • 19. (More) Web GSP Similar to JSP, but with better tag libraries findAll, grep (filter) for collections Method calls Templates Sitemesh (decorator) layouts Customizable URL mappings
  • 20. Validation Often painful, less so with Grails
  • 21. More Features Spring Web Flow Supports subflows, conversation scope (similar to Seam) Interceptors / Filters AJAX DOJO, GWT plugins
  • 22. Even more to like Groovy tests Ideal for TDD Unit tests created automatically from command line script Dynamic language features for easy mocking Easy RESTful web services URL mappings Controllers can render XML or JSON Consider attending a CGUG meeting Extremely active community 400+ plugins (Spring Security, JQuery, GWT, Google App Engine, Flex) Wide range of tutorials Frequent releases
  • 23. Summary Grails compared to Spring, EJB, JPA Substantially less code without compromises Easier to maintain and test Shorter iterations and release cycles Same proven underlying technologies Gain competitive edge Why not?