The Bowling Game Kata in nodejs

I had to ride a train with sketchy internet connection this week, which meant it was finally time to try Bob Martin’s Bowling Game Kata. This is a simple walkthrough of building a system for scoring bowling games using Test Driven Development. It is simple (one class, < 10 functions, often less than 200 lines of code), short (50 code examples, less than an hour to complete), and puts you into Bob’s brain as he points out bits of code he doesn’t like and refactors them.

Thoughts!

I completed the kata using Javascript and NodeJS instead of Java. I used Mocha for writing tests. It was easy to translate the exercise to these tools. At the end of the project, I was curious about how to add up scores for incomplete games (< 10 frames), and whether more tests would be necessary to verify the program works because I chose a dynamic language. I was also relieved that none of the suggested refactoring steps seemed out of place to me.

I discovered the –watch argument for Mocha part way through the project, which saved some keystrokes and clicking by automatically running tests when relevant files changed.

I have only completed this Kata once. A Kata is supposed to be completed many times. It should be habit forming. I haven’t decided if this is a good to repeat over and over again. Is it too simple? I’m not sure if I would benefit from this one.

My source code is available on GitHub

More Katas!

Chairs for programmers

I need a new chair. My current no-name mesh back chair has these problems:

  • worn out seat no longer provides cushioning
  • reclining lifts my feet off the ground
  • arm rests are too tall to fit under desk
  • mesh back doesn’t provide enough support, and enforces bad posture
  • seat is too deep for my legs

(this list keep growing as I learn more about ergonomics)


Over the past few months I’ve tried out a bunch of chairs at home, in stores, and showrooms. Here’s my picks in order from Awesome to Not for me:

  1. Zody
  2. Aeron
  3. Very
  4. SAYL
  5. Liberty
  6. Embody
  7. World
  8. Mirra 2
  9. ReGeneration
  10. Celle
  11. Setu

Here are my impressions of each chair, roughly in the order that I tried them out (tried first = top of the list)

Herman Miller Aeron

I rented a Herman Miller Aeron for 2 weeks from Executive Furniture Rentals in Toronto just to try it out. I used one when I worked at marketing agency around 2007. It’s as good as I remember! I find I compare all the other chairs to this one.

Aeron

Pros:

  • best feeling mesh seat and back
  • I can feel it improving my back and should posture. My shoulders aren’t pushed forwards, and my upper back is straightening. I can feel it stretching.
  • reclining tension and feel is great
  • even the non-adjustable arm rests fit under desk

Cons:

  • seat depth is not adjustable. You pick a chair size (A, B or C), and you are stuck with it
  • adjustable arm rests don’t quite come to the right spot for my body – a bit too low at the highest setting

Other links:

Herman Miller SAYL

I spent a couple of hours in a Herman Miller SAYL at a consulting job a few months ago, and in a few stores.

SAYL

Pros:

  • less expensive than many other chairs here (30% – 50% less). That money could go towards a better standing desk
  • narrow back is great putting my shoulders in the right place (I can feel my collar bones sink back in to where they should be), and makes it easy to stretch by reaching behind your back

Cons:

  • spongey seat isn’t as nice as Aeron’s mesh
  • fixed armrests are too tall to fit under desk. Need adjustable armrests which negates most of the price advantage

I wish I could find a place to rent one in Canada. CORT in the USA rents the SAYL

Other links:

Herman Miller Mirra

This is supposed to be one of the successors to the Aeron. I spent a few minutes in Herman Miller Mirra at a store. The mesh seat as good as the Aeron, but lacks in other areas.

Mirra

Pros:

  • has an adjustable length mesh seat
  • arm rests are almost perfect

Cons:

  • back rest is less comfortable than other chairs – it feels like hard plastic
  • less lower back support than an Aeron
  • almost the same price as an Aeron

Other links:

Mirra vs Mirra 2

The Herman Miller Mirra 2 has a softer feeling back than the Mirra. I didn’t notice other major differences. The seat is comfortable and the seat length adjustment is really cool, but I fit better in the Aeron.

Mirra 2

Knoll Regeneration

The padded seat and mesh back of the Knoll Regeneration reminded me of the SAYL, but without the freedom to move my arms around due to the wide back.

Knoll Regeneration

Links:

Herman Miller Setu

Setu

The Herman Miller Setu is not a heavy duty office chair, but it was nearby and meshy looking, so I gave it a try.

Pros:

  • lightweight and simple compared to something heavy and complex like the Aeron
  • feels great when you first sit in it and it bends around your body

Cons:

  • not as comfortable as some other chairs after sitting in it for a while
  • expensive for a chair without adjustments
  • tall arm rests stop it from rolling under desks

HumanScale World

Humanscale Diffrient World Chair

The Humanscale Diffrient World chair was a surprise find. I spent about 20 minutes in it in a few sitting sessions. It has a mesh seat and back like my favorite (the Aeron), and is much lighter and simpler to adjust.

Pros:

  • HumanScale’s 15 year warranty is the longest in this comparison
  • really lightweight and simple design compared to most other chairs
  • mesh seat and back for great breathability

Cons:

  • backrest doesn’t feel as good as the Aeron. It probably works well for people wider than me
  • recline feature doesn’t feel as luxurious as the Aeron

HumanScale Liberty

HumanScale Liberty

I tried out the Liberty at the HumanScale showroom in Toronto back-to-back with the World chair. The Liberty feels a bit more solid than the World. Sitting in it was silent, and recline mechanism felt smoother. The back support fits my body very well.

Pros:

  • simple and light
  • mesh back as a great shape
  • 15 year warranty is a loooong warranty

Cons:

  • arm rests aren’t as adjustable as other chairs
  • seat might be too firm

Haworth Zody Task Chair

Zody

I tried out the Haworth Zody at the Haworth showroom in Toronto back-to-back with the Very. This chair feels solid and comfortable, and packs a lot of features.

Pros:

  • great feeling mesh back and foam seat
  • armrests adjust to a perfect spot for my body
  • pretty good at letting my shoulders settle into the right spot

Cons:

  • just missing a mesh seat

BTW, it’s pronounced hay-worth, not haw-orth.

Haworth Very Task Chair

Haworth Very Task

The area around the shoulders doesn’t feel as nice as Zody, probably because the frame isn’t flexible. Otherwise, it feels very similar and is a bit less expensive.

Herman Miller Celle

The Herman Miller Celle offers a lot of features at a good price, but isn’t right for me. The cellular suspension design and recline tension are too stiff for my weight, and the shape of the back didn’t feel right to me.

Herman Miller Embody

The Herman Miller Embody felt good to sit and recline in once adjusted properly, but the only things that really stood out about it were the arm rests and high price.

Pros:

  • luxurious reclining feel
  • arm rests come to the perfect spot for my body

Cons:

  • back rest doesn’t feel as good as some other chairs
  • it’s bloody expensive!

Links

Related Posts

If these chairs seem pricey, check out my thoughts on buying a new vs used ergonomic chair.

Other ways you can improve your work space


Converting a static site from Middleman to Yeoman

This one time I inherited a static website built with Middleman. Middleman has the best of intentions, but I couldn’t get it running well. Some of its gem dependencies could not run on Windows, and I couldn’t get the live reload functionality working through Vagrant‘s port forwarding. I made the decision to change stacks.

To Yeoman we go!

I knew I could run Yeoman under Windows or a Linux virtual machine, and there were grunt-contribs to do everything I needed from Middleman and more.

I started with the basic webapp generator generator-webapp. Once it scaffolded all its stuff out, I started moving my compiled and source Middleman files into its directory structure. Live reload worked great right away. I installed grunt-contrib-sass to compile the stylesheets the Middleman site used. After pinning jpegtran-bin to version 0.2.0 in package.json, image minification worked reliably on Windows. Smooth sailing until…

HAML to Jade

The trickiest part was moving from HAML based templates to… something else. At first I tried compiling HAML using various grunt contribs, but the templates had dependencies on Middleman specific code, not just just HAML. The solution was to take the HTML generated by Middleman, and run it through a HTML to Jade converter. Setting up Grunt to build HTML from Jade was easy with grunt-contrib-jade.

BTW, if you want to try out Jade in your browser quickly, the HTML to Jade converter offers that as well.

More optimization!

After some manual work on the Jade files, I had a very DRY set of Jade templates and usemin configured to minify all the JS and CSS how I wanted. Pushing things further, I set up a bash script to help generate a timestamped Cache Manifest file, and ran it with grunt shell when grunt build is called. That bash script works in Git Bash on Windows too, so it is still cross platform.

Next steps

Ideally running grunt deploy would generate gzip versions of all the files, and uploaded them to S3 and set the correct HTTP headers if needed. I couldn’t get an S3 syncing script working. Still working on this one!

Here’s a presentation by some other guy who moved a Rails app to Node and experienced some of the same things I did. This developer used regexes to convert a lot of HAML to Jade instead of converting HAML to HTML to Jade.

Where to find Global Browser usage statistics

This one time I had to provide guidance on which web browsers to support on a future website. That means I need graphs and things!

NETMARKETSHARE

stats-netmarketshare

Worldwide statistics pulled from 40,000 sites according to the FAQ. It provides some free data, and paid subscriptions which provide access to filtering. I liked this graph.

W3Counter

stats-w3counter

W3 Counter provides a free visitor tracking for websites, and posts their aggregated statistics on browser usage from their users sites. The data is not filterable or sortable, but it is easy read.

StatCounter Global Stats

stats-statcounter

Stat Counter is another visitor tracking service, and they also post their aggregated browser statistics. They include some sorting and filtering options for free.