Pat Maddox, B.D.D.M.F.

RSpec my authority! I just smashed a bug

A Little Bit of CoffeeScript

Alright so I wrote my first program in CoffeeScript. It’s my first pass at a blackjack simulator. My thoughts:

  • Syntax is quick and easy to learn, and fun to use.
  • I love the function definition syntax. Love love love.
  • Same goes for re-opening classes.
  • Scoping can be tricky when passing functions around, but it allows for a lot of power.
  • For loops are ugly
  • I need to learn how to do operator overloading
  • JavaScript is missing a lot of stuff. Need to figure out the ActiveSupport equivalent for JS.

All told it only took me a couple hours to skim through the PragProg CoffeeScript book and hack this up. It went fast and I was pleased with how easily I was able to refactor the code as I built it up. Next I’m going to mess around with adding browser-side features, as well as running it in Node. And I’m going to figure out how to test it.