Best practices for building large GWT applications Heiko Braun <hbraun@redhat.com>
About me • Heiko Braun • Senior Software Engineer JBoss / Red Hat • 4 years JBoss, 12 years industry • Focus on SOA, BPM, GWT • Contributor: JBossWS, jBPM, Riftsaw, Errai, SAM, Savarra > http://jboss.org
Topics • Decomposing a large GWT application • Introducing project Errai
Decomposing a large GWT application
Example: JBoss SOA tooling
Challenge #1:Feature Set • Different features per: • Target runtime • Development stage • Project lifecycle • Target audience
Solution #1: Compile-time composition • Uses Deferred Binding [1] and plugin discovery • Leverage Maven dependency sets • Defer decision which components go into application • Allows ‘divide and conquer’ approach [1] http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/DevGuideDeferredBindingConcepts
Solution #1: Compile-time composition
Limitation #1: Component interplay • Each plugin component isolated • No interplay possible • It would introduce dependencies • Grouping by functionality vs. usability • Technical split vs. conceptual split (i.e process execution & reporting)
Challenge #2: Coupling between components
Challenge #2: Coupling between components • Components “decorate” functionality • i.e. Process Management & Reporting • Dependencies may come and go • Different feature set: - Maturity (Beta vs. Final) - Environment (staging vs. production) - Profiles (authorization roles)
Solution #2: MVC • Model-View-Controller ? • Less coupled • Enables interplay between UI plugin components • Still compile-time dependencies (i.e controller to view)
Solution #2: Pub/Sub • Messaging through publish / subscribe • Baseline on Messaging API • Single, shared dependency • Challenge: detyped, no contract
Challenge #3: UI coupled to services • I.e. Report Tools (UI) requires BIRT Engine (backend) • Services may come and go: • SOA promise • Different product versions • Target runtime derivations
Solution #3: Bootstrap • Bootstrap: “Give me a list of capabilities” • Performed when application starts • Problem: Fixed initialization point • Lazy Components?
Solution #3: Blackboard • Presence: “I need a SMTP service. Notify me upon availability” • Relies on messaging bus behind the scenes • Async, independent, durable
Lessons learned • All purpose solution: pub/sub • Async communication already preferred • Use it to: • Decouple UI components • Integrate backend services • Break the request/response paradigm
Introducing Project Errai
Project Errai • Tackles the problems described earlier • Consolidates JBoss GWT efforts • Both R&D and actual product development • Main components: • Message Bus & Workspace framework > http://jboss.org/errai
Message Bus • Backbone to application design • Federated architecture • Asynchronous & bi- directional • Broadcasting & Conversations • Built-in serialization • Supports OpenHUB spec • HTTP + NIO
Common, shared messaging API Publisher Subscriber
Pub/Sub roles vs. tiers • Subscriber defines target tier: • client-server (client send) • server-client (server push) • client-client across server (browser to browser) • client-client w/o server (inter component)
Workspace framework • UI environment for which to deploy your console • Provides development infrastructure, documentation and examples: - Tear down barriers, ease of use • Common, shared services, i.e: - Authentication & Authorization - Logging & Exception handling • Allows composition at various stages: - Sandbox, Project, Product
Workspaces API • Handles loading, initialization and access of UI components • Uses maven dependencies, deferred Binding and auto-discovery (1) Component declaration (2) Workspace assembly
Conclusion • Presented patterns are solutions to coarse grained problems • Also consider MVP , GIN, etc: See Google I/O • Message Bus has proven to be a good all-purpose solution • Next big thing: Bring GWT to the enterprise Java community - CDI integration ( Tuesday, 1 June 2010, 15:00-15:50, Arena 3 ), - JMS integration - Portal / OpenSocial gadgets
Q&A > http://jboss.org/errai > http://errai-blog.blogspot.com/
Recommend
More recommend