Building SOFEA Applications with GWT and Grails


Published on

Earlier this year, I participated in a major enhancement of a high-traffic well-known internet site. The company wanted us to quickly re-architect their site and use a modern Ajax framework to do it with. An Ajax Framework evaluation was done to help the team choose the best framework for their skillset. The application was built with a SOFEA architecture using GWT on the frontend and Grails/REST on the backend.

This talk will cover how Bryan Noll, Scott Nicholls, James Goodwill and I came to choose GWT and Grails, as well as stumbling blocks we encountered along the way. In addition, we'll explore many topics such as raw GWT vs. GXT/SmartGWT, the Maven GWT Plugin, modularizing your code, multiple EntryPoints, MVP, integration testing and JSON parsing with Overlay Types.

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Building SOFEA Applications with GWT and Grails

  1. 1. SOFEA Applications with GWT and Grails Matt Raible Images by Stuck in Customs -
  2. 2. INTRODUCTIONS Are you developing web applications? Experience with RIA Frameworks? Experience with Grails? What do you hope to get out of this session? © 2009, Raible Designs
  3. 3. Founder of AppFuse Author of Spring Live and Pro JSP 2.0 W H O I S M AT T R A I B L E ? Connoisseur of Web Frameworks Father, Skier, Cyclist and Beer Connoisseur Blogger on since 2002 © 2009, Raible Designs
  4. 4. SESSION AGENDA SOFEA, SOUI and Client Server 2.0 Ajax Frameworks Analysis Why GWT? Why Grails? Conclusion Q and A © 2009, Raible Designs
  5. 5. SOFEA & SOUI SOFEA first introduced in Life above the Service Tier on 10/12/2007. thread_id=47213 SOUI introduced by Nolan Wright and Jeff Haynie in early November 2007. death-of-mvc2 © 2009, Raible Designs
  6. 6. SOFEA & SOUI SOFEA Authors have since formed the Thin Server Architecture Working Group. Increasing productivity through simplicity Nolan and Jeff started Appcelerator. © 2009, Raible Designs
  7. 7. © 2009, Raible Designs
  8. 8. D AW N O F A N E W E R A From web frameworks to services, clients and Ajax... © 2009, Raible Designs
  9. 9. CHOOSING AN AJAX FRAMEWORK 1. Choose a short list of frameworks to prototype with. 2. Create an application prototype with each framework. 3. Document findings and create a matrix with important criteria. 4. Create presentation to summarize document. 5. Deliver document, presentation (with demos) and recommendation. © 2009, Raible Designs
  10. 10. CHOSEN FRAMEWORKS © 2009, Raible Designs
  11. 11. OUR RESULTS © 2009, Raible Designs
  12. 12. GWT FIRST IMPRESSION Pros Write Java => Produces JavaScript Easy to learn and develop with standard Java tools Vibrant Community Zero Turnaround in Hosted Mode Cons Hard to attach GWT on top of existing code Doesn’t support REST very well Operates within the confines of the browser © 2009, Raible Designs
  13. 13. G W T, G X T A N D S M A RT G W T © 2009, Raible Designs
  14. 14. MAVEN GWT PLUGIN Create project using archetype: mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=1.1 -DgroupId=com.yourcompany -DartifactId=gwt-project -Dversion=1.0-SNAPSHOT -B Fix for GWT 1.7+ with browse/MGWT-134 © 2009, Raible Designs
  15. 15. SAME ORIGIN POLICY Modern browsers have a Same Origin Policy JavaScript has to interact with the same domain © 2009, Raible Designs
  16. 16. PROXY SERVLET © 2009, Raible Designs
  17. 17. MODULARIZING CODE GWT Libraries (JARs) for common functionality Builder Helper Plugin allows shared source Hosted mode can still run on JAR libraries © 2009, Raible Designs
  18. 18. TESTING GWT GWTTestCase Code Coverage via EclEmma and IntelliJ IDEA JUnit and EasyMock Works great with MVP © 2009, Raible Designs
  19. 19. PACKAGING AND SELENIUM Package as one or two WARs using the UrlRewriteFilter to manipulate service URIs Use Cargo and Selenium to test the UI Make sure to set IDs on elements! Can still test GWT libraries with this setup © 2009, Raible Designs
  20. 20. MVC VS. MVP GoogleWebToolkitBestPractices.html © 2009, Raible Designs
  21. 21. MVP RESOURCES MVP Example from Hive Development google-web-toolkit-gwt-mvp-example.html GWT Presenter Google GIN GWT Log © 2009, Raible Designs
  22. 22. OVERLAY TYPES Easy, efficient JSON know-gwt-part-2.html © 2009, Raible Designs
  23. 23. OVERLAY TYPES © 2009, Raible Designs
  24. 24. GWT SUMMARY Widgets are awesome and lead to über productivity More time spent with testing and infrastructure than development (a good thing!) Works great with JSON Debugging, IDE and Refactoring support are major advantages over raw JavaScript © 2009, Raible Designs
  25. 25. WHY GRAILS? Existing backend in Spring and Hibernate Fast to develop with REST support built-in Architect Decision © 2009, Raible Designs
  26. 26. REST articles/rest-introduction API © 2009, Raible Designs
  27. 27. GRAILS PLUGINS Stuck on version 1.0.4 Test Quartz Ivy Searchable © 2009, Raible Designs
  28. 28. GRAILS + MEMCACHED Installing and using memcached library/j-memcached1/index.html Integration memcached into Grails library/j-memcached2.html © 2009, Raible Designs
  29. 29. GRAILS SUMMARY Grails 1.0.4 JSON Parser fails for deep object graphs Very productive, mostly because of Groovy Changing services requires restart, not so with controllers But ... Smart programmers use Python because Python is good. Python is good, because smart programmers use it. -- © 2009, Raible Designs
  30. 30. CONCLUSION Last Monday, 1.5MM unique visitors, 2MM visits, 10MM pageviews © 2009, Raible Designs
  31. 31. QUESTIONS? Contact Information Download Presentation © 2009, Raible Designs