Friday, Oct 22, 2010 – This was an old post from last April. I now drive mobile strategy (read: I’m the only iPhone Developer ) @ Invoke Media, creators of Hootsuite, where I’ve launched apps for the Onion that got mashable & lifehacker love, as well as video contesting apps for large, US insurance agencies (I think we’re on NDA).
This is the first end-to-end iPhone app I authored. It allowed me to learn the Objective C & the iPhone SDK including frameworks such as the Location Services & Core Data. It also helped me to understand the basic Model View Controller concept, as well as how view controllers work in general.
The Big Picture
Often times, I take different routes to and from home, work, Vicki’s work, the gym, church, & other common locations. I wanted to create an application that would allow me to:
- Map common locations & routes
- Calculate the average & fastest times between common locations.
This was important because many times I would want to know:
- Which specific roads provide the fastest times between locations
- The average times between locations so I might better schedule my transportation times.
- It was also amusing because it would allow me to “race” against my own fastest times, of course ensuring that all traffic regulations & speed limits were adhered to.
On top of all that, I needed a good excuse to learn the iPhone SDK platform.
Future Features
I also made sure to architect the program so that in future iterations, it would be easy to add some really exciting features such as:
- Auto-Detecting the location and mapping the exact route taken.
- Audio or Visual cues as to how you are currently matching up with average & fastest times for that route.
- Social racing (being able to race against not only your own individual times, but to be able to compete against other players in your area).
Background & Software Design
Object Oriented design teaches us to treat everything as objects. In this case, it was important that I decided on the following terms.
Location: A location consist of the name of that location, the address (both the longitude and latitude, as well as street address), and a collection of all the Routes the location belongs to.
Route: Routes consist of two or more locations (initially, I allowed only 2 locations) and the fastest & average times for that route.
Screenshots & Walkthrough
I architected this app more with utility in mind rather than design. Frankly, I wanted to be able to use this app with as little input from the user as possible.
The first screen gets right to the point and asks your for your present location. In this case, I have chosen Home.
You can see there are two floating numbers. I have used the iPhone’s “Location Services” to store the longitue and latitude for each location. This is the first step in auto-detecting the start and stop locations as well as being able to trace & record your entire route.
If you want to create a new location, you can add it by pressing the “+” sign, and entering the name of the new location. As mentioned
Once you have selected your location, the next obvious step is to select the destination. Today, I’m driving Vicki to work so I choose “Vicki’s Work.”
If no route has been created between those two locations, one will be created. Otherwise, the route will be selected and displays the fastest & average times, as well as all the past times.
Once you are ready to start, you can press the “Go” button on the top right & the timer begins on the Navigation Bar.
Once you have arrived at your location, you simply press the “Stop” button, and your trip time will be recorded into that route. In this case, my trip magically took 8 seconds.
As you can see, the trip is automatically added to “Past Trip Times” and the fastest and average times have automatically been calculated.
Conclusion
Being my first iPhone application, this was definitely a great learning process. Not only did I get used to XCode and the iPhone SDK, I also got to use the new Core Data library, got to test out Location Services to find the longitude and latitude, and got to prototype the class structures visually using XCode’s build in editor.
The best part is that I now have a way of timing my average and fastest times between my common routes and can race against myself, which was my original goal.
The next features I plan on adding are definitely going to be
- auto-detecting of start and stop locations
- using Location Services to map the entire route, which allows for
- audio cues of my current pace compared to my fastest or average times
If these features work out well, I am definitely excited to add in the social gaming aspect.