Lucky 13 Strikes (again)
It’s been a week or two (or three) since we posted the Lucky 13 contest, and it’s time to look at a few submissions. Before the specimens are unveiled, I’d like to thank everyone who contributed (applause).
Note: If you missed the fun and want a t-shirt, just refer a friend to the Zero to Rails 3 class (virtual) scheduled for January 24th. We’ll send you a shirt, and send your friend a free subscription to PeepCode for enrolling!
_ During the contest, people tweeted bits of code that checked Engine Yard’s Roulette Wheel for a winning number. Like Pascal’s foray into gambling, our wager was about learning, not winning. Thus _everyone won! Pascal was crazy excited. “Shirts for all?” he asked. “God truly does exist! Now can someone please OO my language and stamp Borland on my head?”
Here are a couple of the entries that caught my attention. Sorry I could not mention everyone’s. There were some great gists.
Exhibit A: Test Driven Development
First, let’s submit into evidence Tim’s gist (Bend, Oregon). Tim’s entry was longer than most, which conflicted with our requirements. But Tim gets a shout out anyhow, because he not only wrote code, he wrote tests.
First the payout:
Then the tests:
Until recently, most programming books ignored the topic of testing. Nowadays, Test Driven Development is in fashion, even for the smallest of pet projects.
Tim’s example felt like a good excuse to repeat the mantra. Whether your project is small or large, using a testing framework, like Shoulda, will increase your confidence, improve your code, and save time in writing documentation.
The Payout Bait
Tim, and many others, took the bait on a bit of Lucky 13 trickery. While the odds of a winning number are 37 to 1, casinos never pay gamblers what they deserve. The standard payout is 35 to 1. My attention shifts to a special news broadcast…
We are witnessing a veritable pilgrimage to the high desert of Oregon where millions of gamblers, here for Tim’s unrivaled roulette payouts, are causing traffic jams throughout the city. __ Exhibit B: Short and Sweet__
Most of the submissions we received looked a lot like Adrian’s gist (Hamilton, Ontario). Streamlined, aerodynamic, without the clutter of any includes. As Oguz (USC Freshman from Turkey) shows, the solution is even small enough to fit inside of a Tweet.
There were some Java submissions as well. Jano’s gist (Santiago, Chile) was great, not only because his efficient code pays gamblers correctly, but because it led me towards his blog, which made me laugh so hard I spit out my sandwich.
As Sarah Allen and I discussed in our podcast, Ruby makes people happy. I hope the t-shirt (at 1:1 odds) increased the happy factor as well.
Note: Thanks again to Lucky 13 Apparel for permission to use their logo.
Share your thoughts with @engineyard on Twitter