an introduction to building groovy web applications with grails jeff brown – [email protected]...
TRANSCRIPT
![Page 1: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/1.jpg)
An Introduction To Building Groovy Web Applications With Grails
Jeff Brown – [email protected]
Principal Software Engineer
Object Computing Inc.
http://www.ociweb.com/
![Page 2: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/2.jpg)
Groovy Party Tricks
Groovy-isms for the unenlightened– Everything is an object– GStrings– Named parameter lists– We don’t need no stinking setters and getters– Markup the easy way
A 3 minute crash course with demos on some of the features in Groovy that Java developers will find fun and interesting…
![Page 3: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/3.jpg)
What Is Grails?
Full stack MVC framework for web apps Exploits the awesome power of Groovy Leverages proven staples
– Hibernate– Spring– Sitemesh
Excellent for those apps in the sweet-spot Fun, Fun, Fun
![Page 4: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/4.jpg)
What About The Celebrities?
Famous people love Grails This presentation includes a number of
quotes from your favorite well knowns Don’t dig it just because they do Just dig it!
![Page 5: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/5.jpg)
A True Visionary
coding by convention
“Imagine no config files.
It’s easy if you try.
No action mappings.
Man, that Grails is going to be fly.”
In a rare moment of clarity, Yoko convinced John to remove this verse from Imagine since Grails hadn’t been invented yet.
![Page 6: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/6.jpg)
Wet Your Grails Whistle
Lets take a lightning fast first look…
From Nothing To CRUD In 2 Minutes…
![Page 7: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/7.jpg)
Is That All There Is To It?
Is that all I can do? I need to build real applications!
Holy productivity Bat Man! What are we going to do
with all the free time?
![Page 8: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/8.jpg)
Grails Commands
Ant is doing some heavy lifting
•create-app
•create-controller
•create-service
•create-domain-class
•create-job
•generate-controller
•generate-views
•generate-all
•run-app
•war
![Page 9: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/9.jpg)
Scaffolding
Dynamic– It is all just magic
Generated– Generated code may be a good starting point
![Page 10: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/10.jpg)
Domain Classes
The “M” Stick to the POGO
– Let the controller do the controlling– Let the view do the viewing
May define validation constraints
![Page 11: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/11.jpg)
Controllers
The “C” Traffic cop Defining actions Navigating to the view
![Page 12: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/12.jpg)
Views
The “V” Groovy Server Pages (GSP) Custom Tag Libraries Sitemesh
![Page 13: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/13.jpg)
Tag Libraries
Provided tags– Logical, Iterative, Ajax, Form, etc…
Custom tags– No config files
Leave those TLDs behind
– It is all Groovy
![Page 14: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/14.jpg)
Should I Miss My TLD Files?
I pity the fool who has to maintain all of those TLD files.
![Page 15: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/15.jpg)
Hey Dude, Where Is My Data?
*DataSource.groovy– DevelopmentDataSource.groovy– ProductionDataSource.groovy– TestDataSource.groovy
HSQL DB– In memory db is great for evolving schema during
development
ApplicationBootStrap.groovy
![Page 16: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/16.jpg)
GORM
Groovy Object Relational Mapping Hibernate under the covers
– JPA support slated for 0.4
No need to manage mapping files– You still can if the need arises– Can map Java classes
![Page 17: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/17.jpg)
Dynamic Domain Class Methods
findBy– Person.findByLastName(“Brown”)– Person.findByLastNameAndFirstName(“Brown”, “Jeff”)
findWhere– Person.findWhere(lastName:”Brown”, firstName:”Jeff”)
Etc…
![Page 18: An Introduction To Building Groovy Web Applications With Grails Jeff Brown – brown_j@ociweb.com Principal Software Engineer Object Computing Inc](https://reader035.vdocuments.net/reader035/viewer/2022062804/56649e875503460f94b8a2f3/html5/thumbnails/18.jpg)
The End
Thank you, thank you very much.