XBox Live Gold and a Pet Peeve

WARNING: Nerdy, kvetchy, juvenile rant ahead. Those of a sensitive disposition may wish to avert their eyes. You must be at least 48″ tall to read this post. Pregnant women or visitors with neck or back problems should sit this one out. Please consult your physician before proceeding. Do not read while under the influence of alcohol or medication. This post has been shown to cause cancer in laboratory animals. 4 out of 5 dentists surveyed believe you should read something else instead. Still here? Ok, but don’t say I didn’t warn you.

You know what I hate? Businesses that will  let you sign up easily for their service on their web site, but when you want to cancel said service, require you to call their support line, wait on hold, get hung up on, call back, get transferred to their outsourced support center, punch your account number into the phone, talk to “Bob” from somewhere that’s definitely not mid-America, tell “Bob” your account number, tell “Bob” your account number again because he wasn’t ready the first time, tell “Bob” why you want to cancel the service, endure “Bob’s” sales pitch on the many virtues of the service, assure him that yes you still want to cancel, endure another sales pitch with the promise of a temporary discount, assure him that yes you still want to effing cancel, wait on hold again, get transferred to another representative who doesn’t know anything about the conversation that’s already transpired, tell the new representative your account number, and write down the “cancellation confirmation number” so that when they charge you again next month you can provide the number and be told they have no record of it.*

Which is why I won’t be buying another XBox Live Gold subscription.

Bad enough that, even though I’ve already paid for the XBox, for the game I want to play, and for my Internet connection, I still have to pay an additional fee for the privilege of playing on-line. But add the fact that they won’t let you cancel your Gold membership online — a fact which they don’t actually make clear anywhere except by not giving you a cancel option in any of the dozen places on their website and subscription management screens on the XBox you might reasonably think a cancel button might lurk — and it pushes me well over the threshold of nonsense tolerance.

My favorite part of the whole experience was asking “Bob” why there’s no online option to cancel my account. He assured me initially that it was for security reasons. “Let me get this straight,” I said to him. “You guys consider your systems secure enough that I can enter my personal credit card information and incur debt, but not secure enough to stop doing that?” He then said there were also technical reasons that prevented it. Bollocks. If they can cancel an account on his computer, they can do it on mine.

So, adios, XBox Live Gold. I liked the service well enough to pay a few bucks a month for it, but not enough to endure Microsoft’s account management shenanigans.

* This is not actually what happened when I called Microsoft, but a pastiche of bad customer service experiences I’ve had, exaggerated for comic effect. Take that, lawyers.

On Software Testing

Over the past several years at the University, we’ve had to hire for a variety of programming and programming-related positions. One of the interviewing practices we’ve adopted is to give candidates a programming assignment which they can complete at home, at their own pace using any resources they can muster. Because these conditions approximate the conditions under which they would normally be working, we find this to be a really good indicator or what sort of work they’ll do if hired. (Besides, it’s one of the practices from The Joel Test! We currently score about 8.5/12.)

One of the jobs we’ve been hiring for is what I refer to as the “Quality Assurance Czar” — someone who will spearhead and organize our efforts to make sure the code we’re fielding is as awesome as we want it to be. The programming test for this includes both writing a small program to compare two hands in poker and, more importantly, writing a suite of tests to verify that the program works correctly. (This is not the exact programming challenge we use. It was actually one we considered, but it’s a thornier problem than one would guess at first glance, and there are a number of published algorithms out there already. We decided to make up our own problem so that applicants couldn’t just google for an answer.)

A few months back, one of my good friends — let’s call him Larry — interviewed for this position. He did a fine job in the interview, and while his code was very good, it didn’t include the comprehensive testing we were looking for. He wrote a small PHP application that generated a couple of random hands and then compared them, relying on the person running the program to verify that the winning hand the program chose was correct. His solution was 100% accurate, but didn’t include any automated tests, as he had a hard time imagining what sort of testing would have been useful in that case. Here’s a note he sent after the position had been filled:

I was real proud of my [Poker] app, the one that was supposed to include a testing approach.  Now I’ve tried Selenium, and I still don’t see how to test my app, because it has no user inputs.

What did you guys ever have in mind?

Okay, I can see these tests:

  • entering the URL brings up the page.
  • A refresh causes a change to the page (a new checkers arrangement).

But that don’t seem adequate.

He is, of course, completely correct. While this would test a few trivial aspects of the application’s functioning, it would leave the important and juicy bit of code, analyzing the poker hands, completely untested. (This is called “incomplete code coverage” in the argot.)

There are several things one can do to make this application more testable. First off, one needs to create a mechanism to feed the program a specific input. Once you can do that, you can give it a couple of predetermined hands and verify that it chooses the correct one. Doing this with a variety of different hands will demonstrate that the program is working correctly in those cases.

There are, however, about 2,400,000,000,000,000,000 combinations of two 5 card hands. For obvious reasons, we can’t test all of those. How do we choose which ones to check?

Let’s start with easy ones. Verify that a flush beats a pair. Verify that a full house beats a flush. Verify that four of a kind beats three of a kind. Verify that a pair of 8s with hearts and spades beats a pair of 8s with clubs and diamonds.

Once you have the basics covered, we want to look for “edge cases”. These are where our data bumps up against boundaries of some kind. They’re very important because “off by one” errors are very common in programming, and these tests help to expose those errors. In poker, for example, we would want to check that an “A2345” hand would count as a straight, and that a “10JQKA” would also count as a straight, but that “QKA23” would not.

By this point, we’ve accumulated perhaps a few dozen tests — a miniscule percentage of the possible total, but strategically enough chosen that we have confidence that things are working as they should be. If we later discover that we’ve missed something and that our program is inaccurate in some cases, we simply add another test that demonstrates the failure, and then work on our algorithm until all the tests are once again succeeding.

Next, it’s important to try invalid data and make sure that our program handles the error condition as we would expect. Asking the program to evaluate a hand with 5 aces of spades is meaningless, and should generate an appropriate message for the user. (Something like “You’re a dirty cheating dog” might be appropriate.) Having the 17 of acorns as one of the cards in your hand is similarly out of bounds, and should also trigger an appropriate error.

In Larry’s program, all of the logic was stored in a single PHP file. Though it’s a bit more work to set up, I would recommend using a Model-View-Controller design pattern, and splitting the “evaluate the poker hand” portion of the program from the “show the poker hand on screen” portion and the “handle user input” section. By doing so, we can test these portions of the code independently. If we know that the code that evaluates the hand does so correctly, but it’s showing the wrong answer on the screen, we have immediately narrowed the code that might contain the bug to just the bit that’s responsible for presentation.

Finally, once we’re using MVC, it becomes practical to use one of the many excellent unit testing frameworks that encapsulate a lot of hard-won experience doing effective testing. Since Larry was working in PHP, PHPUnit and SimpleTest appear to be decent options. Using an established testing framework has a number of advantages: the code for common testing tasks (like logging into a site) will already be written, it becomes easier to integrate our tests with other systems, test output can be reported in succinct, attractive forms, and other programmers will have an easier time understanding how our tests work.

So, in summary, we’ve updated our program to accept input, fed it a number of test cases and verified that it’s returning the results we expect, adopted MVC and a standard test framework. We now have both a high degree of confidence that our current code is working as expected and a “safety net”: if we decide to refactor the program or change the algorithm we’re using to compare hands, we’ll know immediately if anything we’ve done has broken it.

For a more comprehensive introduction to testing and using it to drive development, see this article. And if you’ve followed this, want to learn more, and are interested in a job, our QA Czar position is open once again!

Miscellanea

Hi Folks! I’ve been a lousy blogger/family chronicler lately. As a partial and entirely inadequate penance for my laxity, here’s a high-level overview of some of what’s been up lately:

  • The end of school has come and gone, and we’re a third of the way through summer. The kids have been enjoying their break from school, taking good advantage of the opportunity to spend more time relaxing, swimming in the river, spending time with friends, building forts in the living room, playing games, etc. My sister Meara has generously planned a day out with each of the members of the junior set, hauling them off to SeaWorld, to see Wicked (the musical), Schlitterbahn, and more. What a treat!
  • Kathy and I celebrated our 14th anniversary. Much to her surprise, I had booked her a reservation to go skydiving as part of our day together. (I am not crazy in the special way required to jump out of a plane, so provided ground support.) She had a great time, even when I joked that I had paid extra to pack the parachute myself and that she should be careful when she pulled the rip cord because an anvil would pop out, Wile E. Coyote-style. After the skydiving (photos here), we enjoyed a terrific lunch at the Gruene Onion Grill and an evening together wandering around the Riverwalk. Delightful!
  • I have also been doing days out with each of the kids this summer — an annual tradition for our family. Emily and I spent a pleasant afternoon together watching the new Transformers movie, eating lunch, and shopping for her. Maggie and I are off to Schlitterbahn next week for a day of sun-drenched fun. Further plans are still sketchy, though Liam and I are considering an overnight campout at the beach.
  • We’ve bid a fond farewell to Will Atkinson, a student friend of ours who had lived in our garage room for the last year or so. We’ll miss having him around, as he has been a good friend, a sitter for our kids when Kathy and I have gone out on dates, and an adjunct family member. The departure, however, is for a good cause, as he’s getting married later this month. Congratulations, Will & April!
  • Kathy has been working about 3 days a week at AlzCare, an Alzheimer’s care facility in town. She has found the work extremely rewarding, and seems to really find a sense of mission in taking care of these elders who are no longer able to fully care for themselves. Unfortunately, she’d been unable to work for a bit when a slippery rock at the river resulted in a neck injury that had her out of service for about a week and a half, but that is now well on its way to being healed — a fact for which we’re all grateful.
  • I traveled to Marfa, Texas for the latest annual-ish Stupid Guy Trip. We had a crew of 8 this time around, including Marc Hadler, Chris McMains, Daniel Priest, Ben Mengden, Ross Richie, Mike Brack, Jason Young, and me. We enjoyed our weekend in this little west Texas art town quite a lot, taking things easier than we have on past trips, and dedicating large swaths of time to simply sitting and talking or ambling about the town together. We did make it to the McDonald Observatory, which was terrific for the nerds among us (8 out of 8), but never did quite manage to get out to see the famous Marfa lights. Photos from the trip are here.
  • I’m slated to speak, along with my friend and coworker Jeff, at a conference in Switzerland in September. (Topics: a case study on our experiences with content management software at Texas State University, and a presentation on how to use a CMS to publish data from other systems.) I’m excited about the trip for several reasons, not least of all because we plan to stretch it out to a week, allowing some sightseeing time, and to bring Kathy along. Unfortunately, getting the whole family over would be financially prohibitive, but thanks to my brother and mother’s extremely generous offers to come stay with the kids for several days each, Kathy and I will be able to enjoy our first week-long vacation together since our first anniversary.

So that’s pretty much what’s been up with us. I hope summer is treating each of you (at least those in the Northern hemisphere) well, and that we’ll have a chance to cross paths soon.

Maggie the Entrepeneur