watermelonexpress/developer-exercise — pull request #3 by saneshark (2012-07-02 04:15:13+00:00)
Title: Completed Developer Exercise for Ruby

Ruby Exercises:

[Where] method: as a module was really straightforward. Since it was specifically asked to implement this as Module I figured it would be nice if it could be mixed in for Hash class as well. I went ahead and wrote the necessary condition that will allow this to work for Hash in addition to Array.

[Youtube API]: I just wrote a wrapper for this one using the existing Google Data / Youtube API. It requires rubygems, json, cgi, and open-uri libraries.

[Blackjack]: This one should be pretty well documented. The classes are tied together by a game class and its table class. This allowed me to build a method for the User, Player, and Dealer classes to communicate, namely showing the dealer's top card. There are some things I would change or do differently, but I'm generally comfortable with this implementation. Because of the interactive nature of this, it was a bit tricky to build tests for Game and Table classes. I tested it many times by way of simulation. I realize this doesn't help for testing edge cases in the future though. I will need to revisit and either refactor the code to make it more test friendly, or test using inputs.

[JavaScript] Stuff: I took a crack at some of the JavaScript stuff, the first one was easy enough to write, but I struggled with writing the Qunit tests. I worked with Jasmine in the past, but not enough to know how to approach building tests for this. If I had to guess I would need to start by writing my jquery in a more modular / functional way to make testing individual components of that method easier.

This was a lot of fun overall. I did my best to document everything, but if you have any questions feel free to get a hold of me.