On my way back from India, I finally had a chance to read The Clean Coder, Uncle Bob’s latest book. It was something I’d been personally wanting to do for a while now; having been introduced to the tenants of software craftsmanship, professionalism, and test-driven-design as part of reading his previous book, Clean Code.

It also was something I’d wanted to do because last year, my company brought in Robert C. Martin for a two-day course on TDD for me and a dozen other employees. And it was amazing. My colleague Shawn compared it to “getting private guitar lessons from Jimi Hendrix”.

To my delight, this came up as an anecdote in Chapter 6 of his book, “Practice”:

Since then many programmers have adopted a martial arts metaphor for their practice sessions. The name Coding Dojo seems to have stuck. Sometimes a group of programmers will meet and practice together just like martial artists do. At other times, programmers will practice solo, again as martial artists do.

About a year ago I was teaching a group of developers in Omaha. At lunch they invited me to join their Coding Dojo. I watched as twenty developers opened their laptops and, keystroke by keystroke, followed along with the leader who was doing The Bowling Game Kata.

Reading this on the plane, I couldn’t help but smile. Uncle Bob has had a tremendous affect on my development style and coding habits, so I’m glad to hear that I had an influence on him, however small that might be.

Postscript: At the start of the session, we each introduced ourselves and explained what we wanted to get out of the course. Jessica‘s conversation went like this:

Jessica: My name’s Jessica Codr [pronounced "coder"]

Uncle Bob: [pause] That’s the best last name I’ve ever heard. I need to put your name in my next book!

I think this counts.

This morning, I had to fight a production error in an application I support. It turns out that using SELECT * statements with Spring JDBC can cause problems when you add new columns to the table. It has something to do with Oracle caching; I’m not sure.

So, SELECT * statements are evil. But how do you ensure your codebase doesn’t contain any? Being a good test-driven developer, I wanted to have a failing test before making wide swaths of changes to my source code.

The solution I settled on was to write a new static analysis rule, using Checkstyle, to warn me when it identified a SELECT * statement. Here’s what it looks like (you can put this in a Checkstyle v5 xml file):

<module name="RegexpSinglelineJava">
<property name="format" value="SELECT.*[\. ]\*"/>
<property name="ignoreComments" value="true"/>
<property name="message" value="Do not use SELECT * statements"/>
</module>

It’s a regular expression that looks for a SELECT, followed by anything, and then either a dot or a space followed by the asterisk. This way, we can capture:

  • SELECT * from table
  • SELECT t.* from table t

But not:

  • SELECT count(*) from table

Adding this check to our build immediately caught 13 instances where we performed this nefarious deed.  Using a continuous integration build like Hudson, it was easy to identify and track how we were progressing in removing these from the build:

Of course, there a number of issues with this approach:

  • Queries defined outside of a .java file aren’t scanned
  • The regex misses queries defined over multiple lines

But it’s a nice quick solution to an immediate problem, and we can iterate to solve it.  I hadn’t thought about using static analysis tools as a form of test-driven development, but it seems like a natural extension of the red/green/refactor cycle.

My folks got a golf tile puzzle game called “Scramble Squares“. I was tired of trying to solve it manually, so I wrote a little Ruby app to find all the valid solutions. The code’s on GitHub:

https://github.com/mattdsteele/scramblesquares-solver

After uploading it, I realized that quite a few others have already published solutions. But mine’s the only one with unit tests :)

In case you’re like me, use Cardstar, and want to put your Omaha Public Library card on your phone, here’s the custom barcode you should setup:

Symbology: Codabar

Start code: A

Stop code: C

Inverted: no

Hope Google’s indexing this. Knowledge is power!

As previously noted, my bike was stolen a couple weeks ago. Fortunately, some stories have happy endings, and it is now residing back at my house. What follows is the harrowing tale of how I got it back (note: it’s not all that harrowing).

Union Pacific has two sets of bike racks around its HQ building:

rack locations

Rack 1 is positioned next to the front door of the building, and is underneath an overhang that helps protect bikes from the elements. Rack 2, newly added this year, is out next to 13th Street and affords none of the amenities of the original set.  Needless to say, Rack 1 is as popular as a Homecoming queen, while Rack 2 gets rejected like a guy who just upgraded his D&D Avenger character up to level 6.

On this particular day, I was late biking into work, and all the spots in Rack 1 were taken, including several people who had double-used the rack spaces. Rather than trying to force my way in, I decided to park my bike on Rack 2, which happened to be empty when I locked it up.

Actually, “locked” is probably an inappropriate phrase. The previous week, I lost my old lock of several years on a ride home. So I went out to the Bike Rack and looked over their offerings, deciding on this particular model. Kryptonite rates its security as a “1″, which they state is appropriate “if you live in the ‘burbs and have a Rottweiler next to your bike”. A couple pieces of twine tied together probably would have offered only slightly more protection than what I was using.

If there was ever a valid time for a lock to be guilty of EPIC FAIL, this was it. On the first day of its operation, it was broken and my bike was taken sometime while I was working. The thief didn’t leave the broken lock, so I don’t know whether they cut the cable, or found some way to crack the combination, though I’m guessing they used a pair of bolt cutters to snap it.

When I realized my bike was gone, I told a few people in the building about the theft, and got a ride home from a coworker. That evening, I called the police’s theft report line and gave them a my phone number and a brief description. And of course I tweeted about it.

The next day, I got a call back from the police, and gave them more details about the theft. When the officer asked me if I had the bike’s serial number and I replied “no”, she responded with a disappointed-sounding “Oh.”

I also got some great advice from my coworkers Scott and Brady, the latter having had his own bike stolen earlier this year. Brady told me what he did to recover his bike, including handing out flyers to local businesses and pedestrians, checking in pawn shops in the area, and blogging about it. He also mentioned the best way of recovering a bike was if I had the serial number available, which made me doubly skeptical that I would ever see it again.

Then for a long time, nothing happened.

On a Sunday afternoon, about two weeks after the theft, I got a call from an officer working in the Pawn unit, saying he got a description of a bike similar to mine in an area pawn shop. Following up, I gave him some additional details about the bike (going off memory and the one photo I had available), and a few days later he sent me some photos of a bike that was 100%, definitely mine. I sent him a reply and asked him to contact me when I could pick it up.

Then for a long time, nothing happened.

A week and several voicemails later, I finally got a response from the police, who sent a letter to both me and the pawn shop, declaring that I was the rightful owner and could pick up the bike. So yesterday, I ventured downtown to the Mid City pawn shop, and paid the $35 fee needed to get my bike out of hock.

I’ve learned a lot of things through this whole ordeal, most of which are outlined in Brady’s own post about recovering his bike; so I won’t repeat them here.

But the most important part is to record your bike’s serial number. If you have a bike, do it now. I was a lucky bastard to have mine recovered without it, but everything I’ve experienced tells me that it would have made the process much easier. Pawn shops are required to file a bike’s serial number with the police before they can sell it. Without the serial number, I had to trust that the pawn shop and the police operated on the same wavelength, and would be able to identify the merchandise by my vague description: “It’s light blue. Or is it teal? Man, I wish I had more than just one picture of this thing.”

So I’m back in business! I picked up a new Kryptonite-built U-Lock from the Trek store and plan on riding into work tomorrow. No mere larceny can hold me down:

IMG_0425

I only ask that Omaha’s thief population let me keep my bike for at least one week before attempting another swindling.

Stolen bike – Reward Offered

September 23, 2009

Update: my bike was found at a pawn shop this weekend. I’m currently working with the police department to recover the bike.

Yesterday my bike went missing downtown; if you can find it, there’s a cash reward.

The bike was taken from the racks on the east side of the UP building in downtown Omaha. Here’s a map:

bike-taken

Here’s a picture of the bike (sorry that it’s upside down):

bike

Some details on it:

  • Trek 1500
  • Light blue/teal frame
  • Shimano-style pedals
  • Drop handlebars with white grip tape
  • I don’t have the serial number :(

I’m a billionaire

April 23, 2009

It’s all about the benjamins.

zimbabwe1

And by benjamins, I mean Mugabea-ns.

A coworker’s pastor was able to acquire a couple of these Zimbabwean bank notes and has been distributing them like wallpaper.  Wait, I can’t use that metaphor anymore because it’s actually happening.

It’s a depressing story, but you can find cocktail chatter here. Like how the same company that printed money for the hyperinflated Weimar Republic also was pumping out Zimbabwe’s notes until last year.  Or how Zimbabwe’s bank has to churn out dollars 24/7 to satisfy the wheelbarows of money it takes to even get a bus ride.

Anyway, I’m not technically a 5-billionaire because the bill expired at the beginning of the year (who makes bills that expire?!)  So I’m not sure what I should do with the note. Any suggestions?

More about Zimbabwe’s history here.

Once again Blockbuster has silently changed their terms of service and removed the single greatest advantage they had over Netflix:

If you exchange your online rental for a free in-store movie rental at a participating store, that store rental will count towards the number of rentals you are allowed out for your online Total Access plan.

Thanks for at least notifying me of this bullshit, guys. I had to dig around in your unlinked-to FAQ only after realizing after a week that my next disc hadn’t shipped.

Apparently this is all part of Blockbuster’s attempt to drop customers. Seriously. CEO Jim Keyes says he wants to “prune the tree” of its least profitable consumers, so only suckers remain. Well, Mission Accomplished.

The best part about all this is that behind the scenes, apparently the driving force behind the “piss on your most loyal customers” strategy is billionaire jackass, Carl Icahn:

Blockbuster’s online program had been a source of contention within the company. Former CEO and chairman John Antioco, who led the company for a decade, saw online movie rentals as the future of the industry. Some investors and board members, led by Carl Icahn, believed management was spending too much money too fast in the online business while neglecting the core source of their income: Retail stores.

You can read lots more about Blockbuster’s sordid history online here.

From McSweeney’s:

Take a look at my work: I’ve got a unique eye and I create a visual journal of personal moments, like your vows, during which, as a professional, I assure you I will not sigh heavily.

Christmas in September?

September 28, 2008

Saw this at the Younkers today. Really guys?

As an aside, it’s currently 80 friggin degrees outside.

Follow

Get every new post delivered to your Inbox.