Wednesday, July 11, 2012

O'Reilly Fluent Conference 2012

Some observations on the first O’Reilly Fluent JavaScript Conference in San Francisco last month. The weather was great as it usually is in the Bay Area, we were cooped up in the hotel all day but that was fine. The food provided for lunch was excellent and the conference rooms were huge though all were packed every day. There were about 1,000 technologists in attendance with some decent vendors & exhibitors on hand. I think Twitter & Google brought the largest presence in terms of speaks & resources, they also threw the best after hours get-togethers.

TL;DR - Conference was great. I learned a lot but also I received validation that the approach the ECM Technology team is currently adopting with our client-side & web framework is the right one for our needs & team dynamic. There was also a heavy emphasis on Product/Design led development where folks lucky enough to have an engaged Product team can reap huge benefits from a collaborative approach with developers. The days of throwing stuff over a wall and moving on should be over as that never leads to thoughtful execution.
Day 1 was workshop day, a day to deep dive into certain tools & languages, I chose CoffeeScript in the morning & node.js in the afternoon.  The CS session put on by Caike Souza & Gregg Pollack from Envy Labs was pretty good, though most if not all we’re currently leveraging in the language. The bulk of Q&A centered around Object orientation, inheritance, fat arrow, & encapsulation. The v-next stuff looked interesting mostly in terms of further debugger support/parity with JS.

After CoffeeScript there was the Robust Node.js session for the rest of the day, really enforcing our current patterns and module choice and there was cool stuff regarding load balancing and/or cluster scripts that we should definitely try to take advantage of for multi-core running of event loops. This session was put on by Tom Croucher from Jet Packs for Dinosaurs  who’s a pretty cool British neck bearded fellow, read ex-Perl nut. We walked through Node streams which we take advantage of in our proxy layer, we dove into the once() call and how it can handle stopping repeated function calls, useful. For production deployments we walked through some nice tools like putting a production app into debug mode on the fly, node-proxy, squid, varnish & haproxy for load balancing, cluster scripts to handle multi-core, Cluster can also feed health stats to the IPC/console/log/scout to tell if node process is healthy or hanging. Good SSL acceleration approaches using modules like Unbundle SSL, stud or stunnel where we saw in some cases about a 35-40% speed bump.

A big theme in this node session was that Memcached should be set out to pasture as Redis is the new better Memcached, interesting. Also some of the upcoming features in Express 3 look really promising in terms of better built in asset handling & caching as well as performance & api call improvements.

Day 2 was the real start of the conference with keynotes from some heavy hitters like Brendan Eich, Ward Cunningham, Steve Souders & Tim O’Reilly. Eich talked about low level javascript, c/c++ inside JS, malloc, dealloc & other c style or actual c baked into JS itself, very cool and the demos he showed were VERY fast. He praised CoffeeScript as Ruby 4.0 and wants to support CS more as a JS/ECMA writing style vs something completely separate so more native support for code parity and style similarity. He ended his talk with pointing out this nugget

Ward Cunningham continues to impress, he was like a college kid taking copious notes throughout the conference and really throwing himself into the JS world. I asked him why was he so into the current JavaScript scene and he said that he saw it as the future as it’s the most ubiquitous way to achieve the reach he’s striving for. Calling back to his invention of the wiki as a means to reach the masses as well. His keynote was great, he demoed this web client-side API builder that he used to repurpose popular web sites into consumable JSON API’s.

Steve Souders of Google was showing some case studies on web site bottlenecks, core concept here -> if you have a bottleneck in your web site its most likely on the front-end and more specifically it’s from using synchronous JS library references & API’s, async always. He used & to illustrate his point.

The sessions for the day were pretty good, in 10 things you didn't know HTML5 could do we walked through asynchronous binary streaming, client-side file IO & native API's to system devices such as mics, 3D printers, cameras, etc.

Functional programming with Streams in Node.JS was a good one. Adam Crabtree walked us through the Event Emitter, Streams from the POV of chunks over time and while we use .on, .end for data streams I was also exposed to .drain, .pause and using the request object for req.pipe to stream to the console, file or http response.
Day 3 the focus was on mobile, CSS & JavaScript craftsmanship. Paul Irish from Google showed off the latest in Chrome Dev Tools as well as his personal toolkit, I think it mirrors what a lot of folks here use. One point he was trying to impart was to favor local storage to persist client-side only information as opposed to cookies that are always sent back and forth on the wire, makes sense.

Leah Veroe the “Queen of CSS & RegEx” talked about CORS - cross domain requests. CORS is the future of cross domain ajax and JSONP is relegated to a “hacky” moniker.

Ben Gailbrath & Dion Almaer from Walmart Labs then took the stage, great talk, watch out for walmart. Their topic was Web vs. Apps and how Walmart is betting their development on the Web as a platform approach with native apps losing favor. They utilize node.js as a common technology platform both client & server side using a conditional rendering engine in Node which decides whether a page is rendered client or server side based on input parameters or UA strings. They are big fans of Backbone.js regardless of whether they are building a Mobile app or a Website, they utilize a project called Thorax for web & mobile dev on backbone.

Alex Maccaw of Spine.js fame talked about modular patterns & building large applications in JavaScript. Build lots of small independent modules that perform simple tasks and orchestrate them together, the Unix way. Expose a simple API and use events for communication. Child modules should never know about their parents and favor clear simple code approaches as opposed to a blind DRY approach. His current project is Stylo -, open sourced example of the modular approach he walked through. Another big theme of his was to store client & data state in the controllers, not the models, not the view, I tend to agree with this as in developing a large single page application your controller is the arbiter that can provide any modules with the information they need. Snapshots in the Chrome Dev Tools was a nice approach to fix memory leaks, compare snapshots after introducing modules & backbone views to find bloated modules.

Then it was onto Trevor Burnham with Async coding patterns & Promises. His talk started out discussing Backbone’s simple wiring of events to model changes, not dom event wiring. jQuery promises is the way to untangle async in the JS language itself, works well on the client probably not the best approach with Node. In Node the approach for the promise pattern seems to be to use a CommonJS approach with "Q" or Promises/A. Q accepts jQuery promises and converts it to its own promises type so you can use the same syntax both client & server side. A promise is an object representing a task with 2 potential outcomes; resolved or failure, jQuery 1.5 was first to introduce promises. A Promise is definitely attractive to remove the async callback spaghetti although CoffeeScript handles this in a much nicer syntax than JS so the problem is lessened there. The debate surrounding this pattern seems to be Promises vs Pub/Sub - they are very similar why use one over the other.

Day 4 was for breakout sessions and deeper dives with folks who decided to stick around for an extra day. After meeting with the guys from Twitter Bootstrap in the morning and learning about some of the upcoming features and changes to our core CSS framework I was off to Mozilla HQ in Mountain View. At Mozilla we were given presentations on the latest firefox and firebug features and given a chance to play around with some cool offline technology coupled with their new Mozilla Mobile OS. Mozilla might be back to being a big player with an offering larger than just a web browser option, all of these browser or portal providers seem to want their own OS, it will be interesting to see this competition heat up in 2013 after windows 8. The overall browser sentiment seemed to be bated breath on IE until Windows 8 hits with no one regarding IE 9 as anything to worry about developing for too strictly.

The last event I wanted to mention was the D3.js meetup. I was blown away by some of the visualizations & canvas rendering being demoed. Examples that made Flash look so 1998, not that Flash needs more reasons to die ;-) I am really looking forward to implementing D3 here when appropriate and hope to show you guys what can be done with it and how extensible the library is. I was even inspired to build a real-time chart collaboration tool using Socket.IO, Node & D3, I’ll be opening this up on GitHub soon and will send out links when it’s ready.

San Francisco has a great technology culture and scene, the physical beauty of the Bay Area is tough to match however I think New York has the right mix of progressive technology and some of the best engineers in the world while at the same time a more diverse exposure to the global economy to ply our trade. There’s very exciting stuff on the horizon as JavaScript takes a seat at the big boys table of Computer Science and it’s no longer just for the client-side.

Tim O’Reilly on JavaScript & HTML5