Notes from Ben Lindsey

Behavior Driven Development for node.js

By on in Development, Process

On Tuesday night, the San Francisco Server Side JavaScripters had an excellent meetup hosted by the folks at CBS Interactive. I gave a short talk on using zombie.js with jasmine-node to test drive your node.js application under automation. Here is the video:

Here are the slides from my presentation:

And here is the source code:

Enjoy and good luck with your integration tests! Hope to see you at the next meetup.

Deploying node.js on Amazon EC2

By on in Development, Ops

After nearly a month of beating my head against the wall that is hosted node.js stacks — with their fake beta invites and non-existent support — I decided it was time to take matters into my own hands. Amazon Web Service (AWS) offers 12 months of a micro instance for free (as in beer) with 10 GB of disk and 613 MB of memory. This is perfect for an acceptance server running node. All you need to do is sign up with a new email address and provide a credit card. Totally worth it. After 12 months, the price will jump to roughly $15 a month.

I’m a huge fan of Debian and it’s progeny Ubuntu. The guys over at do a great job of providing Amazon Machine Images (ami) that are production ready. I choose to use Ubuntu 10.04 LTS because it will be supported until April of 2015. The 64 bit ami for the us-east region is ami-63be790a. Feel free to choose one that best suits your needs.
Continue reading …

Crank Your Specs

By on in Development, Process

One of the downsides to test driven development (TDD) on a large project is that over time your suite of tests will ultimately slow down. Whether it’s stale code, bloated tests, or just an increasing number of features to support, the more tests you write, the more time you will spend watching them run. Imagine how many times the oldest test you wrote gets run over the life of the project. Thousands? Tens of thousands?

At the start of a project, when all is ponies and rainbows, the cost of running all your tests is marginal. But after 6 months, 20 ActiveRecord classes, 15,000 lines of code, and 2,000 specs, you might be staring across the chasm of a 5 minute test suite. 5 minutes before you can check in a code change. 5 minutes before your feature passes continuous integration and hits the deployment server. Ugh.
Continue reading …

Browser session cookies and Dalli

By on in Development

A while back one of our clients requested that Rails sessions be stored in session cookies (i.e. a cookie that will expire when the browser is closed). This was for security reasons so your cookie couldn’t be read off the disk and replayed on another browser/machine.

We were using memcached to store our sessions and dalli as the client. Dalli is an excellent library for the memcached binary protocol that has support for Rails session storage. If you aren’t using it for memcached in Rails, you should be.
Continue reading …