Archive for August, 2006

New Weird All Song

Weird Al’s Don’t Download This Song:

Don't Download This Song
Even Lars Ulrich knows it's wrong
Go and buy the CD like you know you should
The record store is where you belong

A list of funny things on that page:

  1. The ‘Lynwood’ jacket
  2. The Goatee
  3. The Giant Dog
  4. Premiering on Yahoo!?!?!
  5. The ‘Click Here to Download This Song’ link
  6. Oh, and the song

(Via Boing Boing.)

Iran’s President’s Blog

يادداشت هاي شخصي احمدي نژاد is the blog of Iranian president Mahmoud Ahmadinejad. I’d post a long, thought-provoking entry about his policies, but the site doesn’t work in Safari.

Twelve Benefits of Writing Unit Tests First

Twelve Benefits of Writing Unit Tests First:

How do you solve a software problem? How do they teach you to handle it in school? What’s the first thing you do? You think about how to solve it. You ask, “What code will I write to generate a solution?” But that’s backward. The first thing you should be doing— In fact, this is what they say in school, too, though in my experience it’s paid more lip-service than actual service— The first thing you ask is not “What code will I write?” The first thing you ask is “How will I know that I’ve solved the problem?”

(Via Coding Horror.)

I’ve written a lot of code. And recently, I’ve been trying this whole test-first thing out, and I’m really happy with the results. Everything they say in the article is true, and it makes a lot of sense, but I think the real benefit is far simpler:

Writing tests for code that doesn’t exist yet means that you come at the design from the point of view of a user with a specific problem, instead of the normal point of view of a coder trying to make his Brilliant New Solution™ that is both a dessert topping and a floor wax.

This plays into one of the other ideas XP expounds: Do the Simplest Thing That Could Possibly Work. Instead of trying to solve all the problems you might ever have, you tackle the problem at hand right now by writing a test that is the problem at hand right now, and deal with the rest later. Sometimes later is in a few minutes, sometimes it’s in a few days, and sometimes it’s never, but Test-First Programming lets you split those tasks down into more manageable chunks, and that’s huge.

Back when I worked at ParaSoft and was peddling Unit Test software, one of the biggest problems we found was this huge string of dependancies most code has built into it. In order to test class X, you need to create an instance of class Y to pass into the constructor. And Y, of course, needs a Z. But you can’t make a Z without an A and a B, which requires this environment property set just so. This seems insane because it is insane: no one sets out to write like this but every company I visited had code that looked exactly like this.

And it’s because they were trying to bolt unit tests on at the last minute. If they had tested first, they would have thought “This is insane. We didn’t set out to write like this” and they’d be right, and they’d fix it, and (key point) their architecture would benefit because they had to think it through before writing the code and “unit testing” with the compiler.

That’s the power of test-first: it makes you see the code from the vantage of the programming who’ll have to make use of it instead of the one creating it, and that’s the seat you’ll be occupying for most of the class’ lifetime, anyway.

Saved locations on Google Maps

Saved locations on Google Maps:

One of the most common requests we’ve received is for the ability to store a list of personal addresses on Google Maps — and now you can.

(Via Google Blog.)

Neat stuff with one glaring omission; once I turn off auto-save, I should be able to click on a location (the place I searched for or anything else that offers a bubble popup) and add it to my saved locations list. That’d make populating my locations list a lot easier and a lot less messy than saving everything I type.

Uno Cracko

Sonja and I got bored with a deck of Uno cards and this is the result. We’ve only play-tested this with two players, but it could theoretically work with more. At some point you’d probably need to add another deck of cards into the mix, but we don’t know when that point would be; six players is probably about right.

The games we played through took about 20 minutes each.

Setup

Take any deck of normal Uno cards. Shuffle.

Deal out two cards to the center of the table in two separate piles. These are the “Play Piles”. If you have more than two players, only use one Play Pile.

Deal all cards out evenly to all players.

Each player puts their stack face down in front of them. This is their “Draw Pile.” They flip over the top card and put it immediately in front of their Draw Pile, face up. This is their “Discard Pile.”

The Turn

The player to the dealer’s left takes the first turn by flipping over a card and seeing if it can play– using normal Uno rules– on either of the Play Piles or any player’s Discard Pile.

Alternatively, the player can draw the top card from their own Discard Pile and play it– using normal Uno rules– on any Play pile (but not other player’s Discard piles).

If the card chosen cannot be placed, the player puts it in his discard pile and flips over another card from their Draw Pile to attempt to play it. There is no limit to the amount of cards that can be moved from Draw to Discard in this way: the player keeps plowing through cards until they can place one.

If you play a “Draw Two” or “Draw Four” card, the requisite number of cards are drawn from your Draw Pile and put into the next player’s Discard pile.

Endgame

Play ends when any player runs out of cards in their Draw Pile. The player with the least number of cards in their Discard Pile wins.

New Sci-Fi Channel Show: The Amazing Screw-On Head

The Amazing Screw-On Head is a new show that Sci-Fi might be putting on, if the online pilot is well-accepted. And it should be. From the creator of Hellboy, this is a witty, fast-paced romp through civil-war-era America staring a cast of characters that can’t be beat: the villian is a zombie and his henchmen are two old women and a monkey.

No, I’m serious.

This was simultaneously one of the coolest and most bizarre things I’ve ever seen, and I’d watch another show in an instant.