Google+ Infrastructure Update - the JavaScript Story
In Google+ Is Built Using Tools You Can Use Too: Closure, Java Servlets, JavaScript, BigTable, Colossus, Quick Turnaround we glimpsed inside Google's technology stack for building Google+. Mark Knichel, an engineer on the Google+ infrastructure team, has helped us look a little deeper on how Javascript is handled in Google+. Here's a quick look:
- They love Closure for its library, templates, compiler, and strict type checking. Compilation is now required for good performance. I've wondered if GWT will be killed off as have other Google properties, but I've been told GWT is being used heavily inside Google, so thankfully that probably won't happen.
- Closure templates are used both Java and JavaScript to render pages server-side and in the browser.
- Just-in-time JavaScript. Code is split into modules so the minimum amount of JavaScript is loaded asynchronously in the background as necessary. Navigation happens without loading the page.
- Page navigation happens without page reloads.
- HTML Flush. Asynchronous data from the server is rendered in the browser immediately so the whole page doesn't need to be loaded.
- Iframes are used to load JavaScript in parallel.
Why no Google+ API? There's conjecture that making a fast responsive UI means the API can't come first because it may not take the shape required to make the UI fast. So the approach is: make the UI first, make it fast, and then wrap an API around whatever evolved. A controversial methodology, but given the imperative for making a responsive UI, it makes sense. Is that the right goal? However good this approach is for creating fast UIs, it's death for feature development and fast responsive innovation. With an API you can develop in parallel and release stuff faster and iterate faster. Which is more important: innovative features that differentiate Google+ from competitors or a fast UI?
More juicy details on this Google+ post.