Automatically unit testing client-side JavaScript with Jasmine and Node.js
Posted: February 4, 2013 Filed under: General Leave a comment »Our initial JavaScript unit testing system was built around JsTestDriver. It ran instances of various browsers on a headless server and ran our tests there. When it worked, it gave fantastic results – but it wasn’t as reliable as we were hoping for, and we were never able to fully integrate it into our build process.
Last year, we switched to a new system built on node.js that proved to be much more reliable and easier to integrate. Nathan, our resident JavaScript Ninjaneer, just put up a detailed post explaining how we we put it all together and how you can do the same:
Automatically unit testing client-side JavaScript with Jasmine and Node.js
Stay tuned for part 2 where we go over the switch from a custom JS build system to one based on require.js and jam.js.
Entrepreneurial Engineers
Posted: November 23, 2011 Filed under: Engineering, General Leave a comment »Sociable Labs was founded on the lean startup model and the idea that everything we create should be tested and validated to have real ROI. This means that we question everything we do with “how is this is improving our product and providing real ROI to our customers”.
In product management and engineering we strive to follow this approach in a number of different ways. When we design a new application we do extensive usability testing to determine if users actually find value in it. When we tweak an existing feature we follow experiment-driven-development and perform real-time A/B testing to determine if that change creates lift – if not it gets dropped. When we refactor code our engineers focus on those areas that provide the most ROI to our business and are most beneficial to our customers – not all software is created equal.
In a sense we are elevating our engineers beyond coders to “entrepreneurial engineers” who blend their engineering skills with business accumen, make design decisions based on real metrics and create software and technology backed by real ROI.
Wiring up Model-View-Presenter UIs using Google Gin
Posted: October 5, 2011 Filed under: Engineering Leave a comment »We make heavy use of Google Web Toolkit in our dashboard systems: Analytics, management, configuration, and so on. In order to make these applications clean, testable, and modular, we apply the Model-View-Presenter pattern. However, MVP alone is not a particularly good pattern – views are tied to presenters by a controller class and have a circular dependency with their presenters. Changes to the system can require altering multiple moving parts.
This is where we’ve applied Google Gin as a way to create a more loosely coupled implementation of MVP. We still have to put up with the view/presenter circular dependency, but it is cleaner and more manageable now.
Here is how:
First, the GWT module initializes the dependency injection cascade by asking an injector we wrote for the controller class:
private final AppGinjector injector = GWT.create(AppGinjector.class);
public void onModuleLoad() {
injector.getDashboardController();
}
Refactoring away Singletons with Google Guice
Posted: September 23, 2011 Filed under: Engineering Leave a comment »We’ve been engaged on a number of projects lately, such as integrating the and jsTestDriver on the front-end and rolling out Guice and ASM on the back-end.
One of the most enjoyable aspects of these projects has been refactoring the Singletons in our system: We see the typical implementation of Singletons as an anti-pattern that creates tightly bound systems with tangled dependencies.
Rather than showing our own code, I wrote a simple project to illustrate one way we get rid of Singletons. The Main function starts up a pair of Singletons, lets them do some work, and prints out the details:
EventListenerService.get().initialize();
EventGeneratorService.get().start();
Thread.Sleep(100);
for(Event e : EventListenerService.get().getRecordedEvents()) {
System.out.println(e.info);
}
Server Side changes for Facebook’s OAuth 2.0 upgrade
Posted: September 19, 2011 Filed under: Engineering | Tags: Facebook, OAuth 2.0 5 Comments »

This is our second post on OAuth 2.0, and covers server-side changes. To see our previous post on changes to Facebook’s Javascript SDK, read here.
Facebook is upgrading their platform authentication system to OAuth 2.0. During the transition time, both the new system and the old system are supported, however, starting October 1st, 2011 the old authentication system will no longer be supported. Any apps that depend on it will stop working.
Read the rest of this entry »
JavaScript changes for Facebook’s OAuth 2.0 upgrade
Posted: September 16, 2011 Filed under: Engineering | Tags: Facebook, JavaScript, JS SDK, OAuth 2.0 6 Comments »

Facebook is upgrading their platform authentication system to OAuth 2.0. During the transition time, both the new system and the old system are supported, however, starting October 1st, 2011 the old authentication system will no longer be supported. Any apps that depend on it will stop working.
Update: Facebook missed their original cutoff date, however as of December 13, 2011, all apps are now forced to OAuth 2.0 and apps that depend on the older system no loner work.
Facebook initially announced this on May 10th, and later put out updated information once the various SDKs had been upgraded to support the new system. However, details on what code changes were necessary to support the new system were fairly limited.
This post covers every change we’ve come across so far to support OAuth 2.0 with FB’s JS SDK…
On Layering
Posted: August 31, 2011 Filed under: Engineering Leave a comment »While we only sell a single product – our Social Commerce suite of applications, internally, we’ve had to build a number of commercial-grade systems, some of which could be seen as products in and of themselves.
Product 1: First of all, in order to deliver components into remote websites at massive scale, we’ve had to build a sophisticated platform that can deliver content across the web, and integrate data from multiple websites while remaining cross-browser compliant. This platform is built on Java, AWS, CloudFront, Memcached, and other sophisticated “shoulders of giants” systems.
Product 2: Next, in order to deliver analytics over these components, which can be loaded thousands of times per second, we’ve had to develop an analytics platform based on Pig, Hive, Hadoop, S3, and Postgres. This is a layered system, providing multiple tiers of services. We’ve also had to develop our own link shortener.
Product 3: The most visible of our products is our suite of social applications. These build on top of the other two products to deliver trackable, scalable, personalized social content to users. This system, built using JavaScript, YUI, Freemarker, Java, Ehcache, Memcached, and Postgres, sits on a complex multi-tenanted graph database that tracks social graphs and provides deep personalization data.
By treating each part of the system as a standalone product, and building each one to the highest level of performance and API quality, we ensure that new products can be rapidly built by leveraging existing technology investments, which allows us to innovate at a business level – where, at the end of the day, it really counts.


