This document discusses client-side rendering, which involves sending templates and application code from the server to the client. The application code then initializes the view and handles interactions by transferring JSON data between client and server and applying templates to update the view dynamically. Benefits include improved performance by offloading work to the client and avoiding full page reloads, but it requires more application code on the client.
6. “My site is living in 2001, I
have a pantry full of ajax
powered spaghetti, and
basically everything is a new
page refresh. How can I make
it slick?”
Sunday, 20 May 12
7. What is
Clientside
Templating?
Sunday, 20 May 12
8. What is Clientside
Templating?
1. Server sends Client templates + ‘application
code’.
2. Application code initialises the View
3. As user interacts with view, JSON data is
transferred between client and server.
4. Application code applies templates to the data to
update the view.
Sunday, 20 May 12
9. Downsides of
Server-side
Architecture
Sunday, 20 May 12
39. Why not just use JS?
Uglies:
• String concatenation and array.push +
join() is unwieldy.
• Multi-line strings are a pain in JS
• Double vs. single quotes
Sunday, 20 May 12
45. •I don’t like things that are
different
• A build process is usually
required
•Performance varies per
device
• More state management
Sunday, 20 May 12
47. The Sweet Spot
Mostly Serverside
rendering + JSON Only Render
Serverside via Ajax with Layout with Client
Rendering + Ajax clientside Everything else
HTML templates rendered with JS
100% Serverside 100% Clientside
Sunday, 20 May 12
48. Hybrid Model
• Twitter/Facebook/Google all render
HTML serverside for initial page
load.
• UX: “Loading…” vs Content
Sunday, 20 May 12
49. Hybrid Model
• Reduces the number of requests
• Shares rendering load between
client/serverside
Sunday, 20 May 12
51. The Future
• Rails: the next 5 years
@wycats
http://lanyrd.com/2012/railsconf/srhtg/
• Rails is just an API & that’s OK
@maccman
http://blog.alexmaccaw.com/rails-is-just-and-api-and-that-s-ok
Sunday, 20 May 12