The Pragmatic Studio

Practicing What We Teach

January 10, 2011

I often get asked if I still do development or if I only run a training company nowadays. The short answer is that I do both, though not always in equal parts. I can’t imagine just doing training because I love to make software. And to effectively teach people how to do something, I firmly believe you have to be actively doing it yourself. On the flip side, I can’t imagine just doing development because I genuinely enjoy sharing what I’ve learned with others.

So what kind of development have I been doing recently? Well, late last year I overhauled the various apps that help us run our training business and upgraded everything to Ruby 1.9 and Rails 3. That turned out to be a great way to learn all the new bits and bobs. I’ve also been doing quite a bit of iPhone development over the past couple years.

I recently took on a side project building an iPhone app for a client. TrackPro is a hands-free lap timer and video recorder for amateur racers. It was a lot of fun to build and a great learning experience. I even got rejected a couple times!

"We Have An App Idea"

It started with a phone call I received from a team of auto racing enthusiasts. They had the idea that an iPhone would be an ideal in-car data collection device for amateur drivers. As I would quickly learn, racers are data geeks. Data is what they brag about after a day at the track, and what they use to continually improve their driving. And if they can record data that helps them shave a fraction of a second off their next lap time, they’ve got an edge on the competition.

Now, the pro drivers have the luxury of piloting high-end cars with specialized equipment that measures all kinds of data. That kind of gear, however, comes at a hefty price. Folks who tear up the track for fun on the weekends generally don’t have the budget for pro-level hardware.

But the iPhone changes the game for them. It’s a relatively inexpensive device that many racers already own. It’s easy to securely mount an iPhone inside any car without custom wiring or harnessing. And it has everything you need to collect and record data: GPS, accelerometer, gyroscope, camera, and plenty of capacity. Mix in some deft custom programming and you have yourself a respectable piece of racing equipment that fits any amateur racer’s budget.

There was just one minor catch: they needed someone to do the programming. I had been fiddling with the iPhone SDK since it was released, but up to this point had only created a few toy apps. And, to be honest, I didn’t really have time to take on a client project. Then again, the domain sounded like fun (who doesn’t like racing?) and I figured it was a good opportunity to really sink my teeth into iPhone development. Plus they didn’t mind that I only had a few hours a week available to work on a side project. In fact, that constraint actually turned out to be a good thing as it helped keep the scope of the project in check.

A Simple Lap Timer

Not long after that first phone call we met in person to flesh out the app. Not surprisingly, everyone had a lot of ideas for what the app could do. I remember feverishly writing them all down. It was exhilarating for a few short minutes, but everyone knew the reality. They had a limited budget. I had a limited amount of time available to work on the app. A trade show was coming up, and a prototype sure would be nice. That is to say, it was a typical software project.

So we all reset our expectations and narrowed in on the simplest app that would be useful to an amateur driver. That process turned out to be fairly straightforward. After all, they were at the track nearly every week and had some itches of their own that needed scratching. They wanted an app that did one thing really well: accurately record lap times with no driver intervention. The app had to be drop-dead easy and intuitive to use:

  1. Go to any one of over 80 official race tracks
  2. Securely mount your iPhone in your car
  3. Turn on the app and select the lap timer
  4. Drive!

The challenge here was designing the app so that it required no track configuration or user input to record lap times. It had to "just work". Track configuration was out of the question because drivers already have a checklist of pre-flight activities to do before a race. They’re primarily focused on getting their car (and their mind) prepared; they don’t need yet one more thing to do. And while driving, any type of user input was to be avoided because taking your hands off the wheel at lap speed isn’t safe. For convenience and safety, the app needed to be self-sufficient. I took that as a fun and unique challenge.

A few months later, the first version of TrackPro was released.

Quick Tour

The app has two personalities depending on whether you’re driving or reviewing your driving results.

When you’re behind the wheel, the app uses the iPhone’s built-in sensors as its primary inputs. You start by driving to the pit area of any official track, launching TrackPro, and selecting the timer. Based on your location, the app identifies the track:


As you accelerate and reach the minimum lap speed, the timer starts ticking:


Every time you cross the track’s start/finish line, TrackPro triggers a lap. Laps are grouped into what’s called a session and sessions are grouped by day into per-track events. When the car comes to a stop and doesn’t move for a predetermined time period, the session ends.

TrackPro then changes from an immersive app into an interactive app. You immediately see your session results, including each lap time:


Selecting any lap updates the table header to show you the lap’s top and average speed, and how it compares to the fastest lap (shown in red).

From there you can view the line you drove for any lap and compare speeds for any point along the way:


And you can always go back and review a full history of every track event and session:


Let the bragging begin!

Thoughts On Pricing

Just to be clear, I’m not involved in the business decisions of this app. So the topic of pricing, for example, is above my pay grade. However, if you’re struggling with how to price your app, you may find this interesting.

The app currently sells for $29.99. Relative to other apps you’ve purchased, that might seem steep. But context is important here. It’s not uncommon for an amateur racer to spend $30 (or more) renting conventional timing equipment at the track for one day. This typically consists of a beacon transmitter placed alongside the start/finish line that sends an IR signal to a receiver unit in the car as it crosses the line. That kind of equipment can be a pain to set up, it’s not always accurate, and you pay a recurring rental fee. So, if you look at it from the perspective of value, it’s totally worth it to some drivers to drop $30 on a lap timer that runs on their iPhone.

What’s the volume play here? Well, amateur racing is a niche market. Let’s face it, racing has a fairly high barrier to entry. For starters, you need a suitable car and access to a track. You’ll likely also want to take a few lessons from a pro. Then you’ll need the funds to deal with the maintenance that inevitably comes with putting your car to the test every weekend. And once you get hooked, there’s no end to the tweaks and upgrades you’ll want to invest in to get the most out of your car. Suffice it to say, it’s an expensive hobby. So we’re talking about a relatively small community. But the folks who are in the community are really passionate about racing. Our goal was to craft a practical, highly-specialized app for them.

Here’s the point: Don’t forget about the small but vibrant markets, and price accordingly. If you always set your sights on creating the next "Top 10 Downloaded" app for a market of potentially millions of users, you’ll overlook a slew of good opportunities to serve smaller markets. And I suspect many of them are underserved when it comes to good, usable apps.

Now With TrackCam!

Sorry, that sounded like a cheesy sales pitch, didn’t it? It’s only because I’m excited this feature is finally in the app.

One of the original ideas that didn’t make it into the first version of TrackPro was automatic recording of race videos. At the time, though, the iPhone SDK didn’t have a public API for programmatically recording video. You had to use an Apple-provided camera view and press a button to start/stop video recording. That wasn’t ideal. Added to which, the camera in the iPhone 3G was good, but not on par with third-party cameras being used by some drivers.

So we put video recording on the back burner with the hopes that the technology would soon catch up with the idea. We didn’t have to wait long. iOS 4 and iPhone 4 made it all possible.

Let me just say that AVFoundation in iOS 4 is an amazing framework. In that framework, Apple handed developers an unprecedented amount of audio/video processing capability on a phone. AVFoundation now gives you full programmatic access to the iPhones cameras, including access to individual video frame data if you want it. (Check out WWDC Session 409 - Using the Camera with AV Foundation for details.)

Building on that, the latest version of TrackPro includes what we dubbed TrackCam. TrackCam automatically records full HD video while the lap timer is running—no configuration or button pressing required. (You can preview the video orientation before starting to drive.) Video recording is triggered by the same state machine I developed to record other events. And when you’re done driving, you can play the video for an entire session or jump straight to the video for a specific lap. It’s all integrated in the app so your videos are easy to play and neatly organized.

I’ve been blown away by the quality of video recorded by the iPhone 4. The guys who beta tested TrackCam had a ball with it. It’s a shame I don’t have videos to show, but here’s a scaled-down video frame recorded by a pro driver (our domain expert) at Mid Ohio last fall:


These videos look great on iPhone 4 in full HD. Depending on the duration of the race, though, the file sizes tend to creep up on you. So there’s an option to record at other qualities. And if space becomes a premium, you can use iTunes file sharing to easily copy TrackCam videos onto your computer. These videos look even better on a cinema display!

In-App Purchase

Developing and testing TrackCam was a significant effort. It looks really easy from the outside ("Just turn on the camera!"), but even with the help of AVFoundation there’s a lot going on inside the app to make it all work. Before I started in earnest I sketched out a rough set of tasks and sent the client a overall development cost estimate. Thankfully, it ended up being pretty darn close. I mention this because I think it’s important to come up with a realistic cost estimate for new app features, then use that number to frame your plan for recouping that cost.

So if you already have a base app out there, what options do you have for getting a return on the cost of developing new features? In general, the App Store model gives you three basic options: add the feature to the base product and increase the price, create a separate product with a higher price that includes the kitchen sink of features, or offer an in-app purchase. After careful consideration, they chose to go with in-app purchase. It seemed to be the most fair, flexible option.

Unlocking features with an in-app purchase (called a non-consumable), turned out to be easier than I expected. (Thanks to Troy Brant for an excellent walkthrough.) StoreKit is by no means perfect, but it does a good job of shielding you from all the nasty bits associated with collecting payment of in-app purchases and restoring purchases across devices.

Where you end up spending your time, as you’d expect, is designing the user interface for the purchase and dealing with StoreKit’s responses. We tried to keep it simple and direct:


It seemed important that drivers be able to fully evaluate TrackCam before purchasing it. At $14.99, it’s certainly no impulse upgrade. So the client decided that TrackCam 2.0 would be a free upgrade and all the features of TrackCam would be enabled. The limitation is that the base product only records the first two laps of every session: the partial lap out of the pit area (called the "out" lap) and the first full lap (called the "hot" lap). You can play those videos in the app, transfer them to your computer, and so on. Once you have a feel for the quality, you can upgrade TrackCam to record video for all your laps.

Again, the upgrade price is about value. Shelling out $14.99 is a no-brainer when compared to buying an external camera, setting it up in your car before every session, and organizing the videos later.

It Got Rejected, Twice!

It wouldn’t be fair if I left out the missteps and setbacks. You’ve no doubt heard horror stories about apps being rejected. And let me tell you, when you get those rejection emails it hurts. Trust me, I know. It happened to me—twice! It’s even worse when you have to tell your client that the app you charged them to build got rejected but everything will be ok… you hope.

The first rejection had to do with a false positive on using a private API. In my code, I had defined a method with the same name as a method in one of Apple’s private APIs. I wasn’t calling their private API. It just so happened that I designed a class of my own with a taboo method name. Nevertheless, when the reviewer ran the automated utility to check for private API usage, it flagged my method name. Far as I can tell, the utility doesn’t know the context of the message send, Objective-C being a dynamic language and all. I stated my case hoping it would help future developers, but in the interest of time I simply renamed my method.

The second rejection turned out to be a simple misunderstanding about use of the camera in the app. I won’t go into specifics, and it really doesn’t matter as it’s unlikely you’ll get bit by this yourself. I ended up sending an appeal to the App Review Board clarifying the behavior of the app. A couple days later I got a response saying they were investigating it further. A couple days after that I got an email saying they had completed their review and the app was approved.

Rejections happen, often for good reason. I always recommend warning clients about the possibility of a rejection (or two), despite your best efforts. Build a couple weeks of slack into the schedule. That way it’s not a huge shock or setback if your app is rejected. Finally, my experience has been that it’s best to set aside your bruised ego and take the time to write a reasoned appeal.

Go On, Build Something

This project was a lot of fun and I’m glad I took it on. I can’t emphasize enough how important it is to dive into a real project as a way of learning something new. It helps you cut through all the possibilities of what you could learn and focuses your energy on what you need to learn… right now… for your app!

Anyway, that’s what I’ve been up to. You know, besides running a training company. :-)

Have fun!