10. Targeting the Diverse Internet Client
Your applications, anytime, anywhere, on any device
Each platform has different physical capabilities
Same application/different experience
Experience customized to suit the capabilities/limits of the target platform
4
11. The Solution: Separate Web Sites per Platform
Create a unique (aesthetically and functionally) site for...
Desktop browsers
Handhelds (iPhone, various Android phones, iPod Touch)
Tablets (iPad, various Android tablets)
Now you have a new problem
Code duplication across platform-specific sites
4
12. Addendum to Previous Solution
Spring Mobile
Extension to Spring MVC
Directs requests to platform-specific sites
Lumbar (and Thorax)
From Walmart Labs (yes, that Walmart)
Build tool for JavaScript client projects
Identify collateral common to all platforms
And collateral specific to certain platforms
Builds site-per-platform
Thorax: Opinionated Backbone framework
4
14. Spring Mobile
• Provides support for developing mobile web applications
• Extension to Spring MVC, for server-side support
• Compliments client-side mobile frameworks
7
16. Device Detection
• Differentiate requests from various devices
• Introspects HTTP requests to determine the device that
originated the request
• Provides a DeviceResolver abstraction and interceptor
• LiteDeviceResolver implementation
9
20. Site Preference Management
• Allows the user to indicate whether he or she prefers the
mobile site or the normal site
• Remembers the user’s preference for their session
• StandardSitePreferenceHandler implementation
13
24. Site Switcher
• Some applications may wish to host their "mobile site" at a
different domain from their "normal site"
• SiteSwitcherHandlerInterceptor can be used to redirect
mobile users to a dedicated mobile site
• Supported SiteSwitchers
– mDot
– dotMobi
– urlPath
17
30. Introducing Thorax
Opinionated Backbone Framework
Project structure and scaffolding
On-demand module loading
Model/collection view binding
Inheritable view and DOM events
Data loading helpers
Form serialization/population
Form validation
Based on Backbone, Underscore, Zepto, Handlebars, Stylus, and Lumbar
4
31. Introducing Lumbar
JavaScript Build Tool
Works from a general codebase
With a list of platforms
Generates modular, platform-specific applications
Works best with Backbone/Thorax
Pluggable architecture
4
32. Getting and Installing Thorax and Lumbar
Prerequisites
Node and npm
Quick Start*
% npm install -g lumbar thorax@1.2.1
% thorax create MyProject
% cd MyProject
% lumbar build lumbar.json public
% npm start
* Adapted from Thorax website
4
33. Elements of a Lumbar Build File (lumbar.json)
Application: Defines the root module
Platforms: Target platforms (e.g., iPhone, Android, etc)
Packages: Macro-level definition of what goes into a platform
Modules: Logical groupings of code
Templates: Client-side templates (e.g. Handlebars)
Styles: Stylesheets to be compiled (e.g. Stylus)
4
42. Summary
The web is consumed by many different kinds of clients
Each client platform has unique capabilities and limitations
Web applications should target each platform
Same application / different experience
Lumbar can build platform-specific applications from a general codebase
Spring Mobile can detect the platform and direct to a platform-specific site
4