Saturday, June 29, 2013

First GitHub pull request

Tonight while twiddling with a new pet project, I made my first GitHub pull request ever. To add icing on the cake, it's for an Elixir project, and I'm a complete Elixir noob!

Here's to hoping the original author will accept my pull request and doesn't think that I'm way out of my depth.

Sunday, June 23, 2013

Farewell mocks and stubs, here comes JavaScript

This isn't exactly a revelation to many developers out there, but I finally got my head around unit testing JavaScript code! I knew that the dynamic nature of JavaScript would help a great deal, but it wasn't until I actually wrote the tests that I realized how easy stubbing was.

There are a couple of key things to note though:

  1. Dependency injection (a fancy schmancy term for passing arguments) improves testability, even in JavaScript. Being able to just stub arguments negates the need to use a faking framework like Sinon.
  2. While it's not absolutely necessary to use a faking framework, one has to be wary of not changing the behavior of the module being tested across multiple tests. A naive way of getting around this is to cache the actual function that is being faked in setup and assigning it back in teardown. A safer, albeit more convoluted way is to use libraries like NodeUnit and Sinon which provide sandboxing capabilities.

Tuesday, June 18, 2013

Let's Kinect!

My company's upcoming hackathon presents a perfect opportunity to finally do something useful with that Kinect unit that I bought more than a year ago. We're planning to spend a couple of days building a game. The only requirement is it's not supposed to be work-related. How cool is that?

Time to dust off that Kinect. Hot or Not game with motion capture and voice recognition, anyone?

Saturday, June 15, 2013

Where art thou, expm packages?

I had a second look at how the expm package collection is going, and boy progress has been rather slow. Popular frameworks such as Cowboy, MochiWeb and WebMachine are evidently missing.

Although I don't mind using rebar to 'git pull' the dependencies and compile them with a single 'make deps', I still think it'd be more handy to be able to just do an 'expm spec webmachine' or some such.

Note to self: add more packages while grokking Elixir.

Good riddance, parameterized modules!

After previous attempts at upgrading FilmoMeter to rid itself of the ungodly shackles of parameterized modules, I finally managed to pull it off today! WebMachine 1.10.1 and MochiWeb 1.5(?) finally fix this issue by removing all traces of parameterized modules. All hail functional gods!

Now I can finally upgrade to Erlang R16B and Elixir 0.9.2 in peace.

To Elixir or not to Elixir, that's the question

Elixir has been gaining a lot of attention of late. Even the venerable Joe Armstrong himself has taken it for a spin and is impressed by some of its features.

I myself have been mildly frustrated by the lack of 'proper' macros and monads in Erlang. Maybe it's time to succumb to temptation and take the plunge?