Slide 1: Agile Web Development with Grails
spkr.name = 'Venkat Subramaniam' spkr.company = 'Agile Developer, Inc.' spkr.credentials = %w{Programmer Trainer Author} spkr.blog = 'agiledeveloper.com/blog' spkr.email = 'venkats@agiledeveloper.com'
Slide 2: Abstract
Agile development is all about developing code and seeking feedback from your users to make sure you're developing what's relevant. When they suggest changes, those must be affordable and reliable. Grails, along with its facility to develop test driven, is a killer combination for rapidly developing web applications. In this ZePo (Zero PowerPoint) presentation, we will take a test driven approach to developing a small but fully functional web application in Grails. We will cover the fundamental features of Grails along with utilizing other capabilities like Ajax. At the end of this presentation, you not only be confident, but eager to roll your own web application using Grails.
Slide 3: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 4: What’s Grails?
Open Source Web Framework Inspired by Rails, but not a port Uses Groovy and Java Built for JVM Rapid Development of CRUD Applications But you can leverage Java strengths This presentation based on Grail 0.4
Slide 5: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 6: Grails Principles
DRY Convention Over Configuration A bit of a problem when you’re new Once you get used to it, you’re in Paradise Keep it Simple Leverage Java Platform
Slide 7: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 8: Grails MVC
Grails built on concept of MVC It does not merely recommend that you use MVC It tells you to do so, then follows you home, and sits next to you to make sure you do
B R O W S E R
Control
Model
View
Slide 9: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 10: Build and Learn
A Contacts Application Add name, email, phone, state of residence Edit, list, ...
Slide 11: grails Generator
Slide 12: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 13: Create App
Slide 14: Directory Structure
Slide 15: Code Generation
Grails script generates quite a bit of stuff for you Mostly html Code is mostly synthesized rather than being generated
Slide 16: Three Configurations
Creates three configurations Production Development Testing
Slide 17: Create Domain class
Slide 18: Generated Code
Slide 19: Editing Domain Class
Slide 20: Generating Controller and Views
Slide 21: Controller
Slide 22: Views
Slide 23: A Quick Test Drive
Slide 24: A Quick Test Drive...
Created New State by clicking on this link
Slide 25: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 26: Test Driven Development
A way to design an application Helps find problems quickly As system evolves, let us know if we meet the expectations Serves as a valuable form of documentation Safety net for refactoring Write Positive, Negative, and Exception tests
Slide 27: Test First Domain Logic
Slide 28: Code Next Domain Logic
Slide 29: After Two More Tests...
Slide 30: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 31: Integration Testing
Functional Testing or Integration Testing is automated testing of functionality Very helpful when done in addition to unit testing Grails uses Canoo for this
Slide 32: Generate Web Test
Slide 33: Generated Web Test
Slide 34: Running Generated Tests
Slide 35: Viewing Test Results
Slide 36: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 37: Building Second Domain Class
We will continue to build the next Domain class— Person Steps similar to what we’ve done earlier Create Domain Class Generate Controller and Views
Slide 38: Person Class
Slide 39: Test Driving
Where’s our State? Was in the in-memory database Missing State won’t give confidence to our customer
Slide 40: Bootstrap Data
Slide 41: Revisit Create Person
???
Slide 42: A Quick Fix
Add optionValue element to the select in create.gsp
Slide 43: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 44: Templates
Reusable fragments File naming convention starts with _ You can render as a bean or collection bean results in one expansion collection results in one expansion per element of collection
Slide 45: Templates
Slide 46: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 47: Ajaxing Frameworks
Very easy to integrate with Ajax frameworks Ships with Prototype You may use other frameworks as well
Slide 48: Ajaxing Create
Slide 49: Ajaxing Create...
Slide 50: Ajaxing Create...
Slide 51: Ajaxing Create...
Slide 52: Agenda
What’s Grails? Functional Testing Principles Phase II Fundamentals Templatizing A Quick App Ajaxing Phase I Conclusion Unit Testing
Slide 53: Quiz Time
Slide 54: References
http://grails.codehaus.org http://grails.codehaus.org/Download
http://groovy.codehaus.org http://groovy.codehaus.org/Download http://aboutgroovy.com
Slide 55: Thank You!
http://www.agiledeveloper.com — download