Monday, 10 September 2012

Sometimes You Need to Re-invent the Wheel

Start with Something Simple

The first App I ever published to the Windows Phone Marketplace was a stopwatch.  I needed to get my feet wet and I needed a decent stopwatch while watching my children swim competitively so I figured, “What the heck?” and started pounding away.  Starting with something you know and is simple is a great way to introduce yourself to a new environment. 
For me to learn, I need a project.  I can’t just sit down and read a bunch of books then write “hello world” apps.  I need to sink my teeth into a real project that has a real, defined goal.  The stopwatch was everything I needed.  Yes, it was just creating another wheel (at least it didn’t fart) but I knew what I wanted and just had to learn how to get there.
It didn’t take long before I had the FusionWare Stopwatch available for free in the Windows Phone Marketplace on December 12, 2011.  I gotta say, it was pretty neat seeing that thing available for download the first time it popped up.
Tip: Start with something easy and something YOU need.  Things will go smoother. Oh, and DO IT!

Time to Re-invent the Wheel

Once that App was done I was not, of course, satisfied.  I mean, anybody can do the simple stuff and the stopwatch was a useful thing to have in my pocket while at swim meets.  But, after using the app for a little bit the phrase; “That’s pretty useful but what I REALLY need is…” came to mind.  So I decided to reinvent the wheel (well, stopwatch) and add some features that I have never seen in a stopwatch but that would be very very useful to anybody in the competitive swim community.  As it turns out, it’s actually useful for anybody in any sort of timed event such as track and field or bicycling but that’s not my area of expertise.
One major design innovation I added here (although it seems small) was to put the start/stop buttons at the bottom instead of top as is usual in stopwatches.  This way, I could press the buttons without blocking my view of the elapsed time and lap splits.  I also found that it was easier to actually tap the buttons here than at the top. 
I needed new features and I knew exactly what those new features should be.   Let me start with my problems as that is the usual place to start with any application or app.  What is the problem?  How can I solve it?  There is nothing wrong with re-inventing something that has worked in the past.  A stopwatch doesn’t need to just be a stopwatch.  It can do so much more.
Tip:  Once you have a basic idea, asking “What do I REALLY need?” and thinking “It’s missing something!” should always be asked and listened to!

The Problems

The first problem is related to the fact that I am lazy (in a good way, I don’t like to waste time doing stuff I shouldn’t have to).  When I used my spiffy new stopwatch I could use it to get a timing with splits to the degree of accuracy I needed but what then?  I keep track of my child’s progress by recording the times.  So in this case I had to look at the time record and then open Mobile Excel and then fill in their results by memory.  The stopwatch was good if I just wanted to see the results but not if I wanted to record it. The simple solution would be to implement “copy to the clipboard”.  However, it had been done and would still require me to app switch in the middle of a swim meet with a tiny phone.  Too difficult and time consuming (remember the lazy bit?).
The second problem was even if I could remember the time and record it in Excel I would also have to record where and when the meet took place so I could remember later when I went back and viewed history.  I needed some way to make that easy with no more than a tap and I could deal with it later.  I needed to know when and where!
Tip:  Sorry, no tip this time, find yer own problems.

The Solutions

The first problem was how to record the information.  Windows Phone has easy integration with email from within your App.  What if I could just tap an icon and the whole time recording would get emailed to me in a format I could handle at my leisure on a home computer where I can track the information properly.  This feature turned out to be really easy to implement.  I added an “application bar”, Windows Phone 7’s little picture menu bar at the bottom of the screen.  To that bar I added an email icon.  Press the icon and you only need fill in the “To” section of the email and the App fills in the subject and content containing all the splits along with the final time.

Used: Microsoft.Phone.Tasks.EmailComposeTask
The second problem required a little more thought.  The phone has built in GPS ability and there are all kinds of wonderful information available there.  So I GPS enabled the app.  Now, whenever you tapped the Start/Stop button, it records the GPS location along with altitude (the altitude is vastly useful when training).  I added another pivot item and dropped a Bing Map control on it. The Bing Map control is included with the Windows Phone 7.1 SDK and is really easy to use.  So with a simple flick of the finger I could see a live map with location information on it.
Used: System.Device.Location.GeoCoordinateWatcher & Bing Map Control

Putting them together.

I already had the email stuff working, so I just added the GPS location information to the email we were sending out along with Altitude (when available) and links to Bing Maps and Google Maps (just in case you have an aversion to one or the other.
So now, I was getting an email directly from the swim meet telling me everything about that recorded time I would need to track my kid’s progress in swimming including the final time, the splits, the location, the altitude and convenient links to both google and bing maps. (Shameless Dad Brag: for his age group in Canada, my son is in the top 10 but one of the youngest).
Tip: Both Bing Maps and Google Maps have easy URLs you can create using Latitude and Longitude.