Cookie Notice

Tuesday 11 September 2012

Upgrading a Windows Phone Database App - Part 1


One of the first Windows Phone applications I wrote (the second actually) was FusionWare Swim Tracker.  Once again I was motivated by the possibility of getting “cool stuff”.  Last year in Canada they had yet another “contest” to help put Apps in the Windows Phone Marketplace.  The first App I did was a Stopwatch.  I actually created a better version of that and discuss it in the blog “Sometimes You Need to Re-invent the Wheel”.  After you have some Apps in the marketplace it serves you well to keep track of how they are doing as far as downloads and reviews.  Let me just digress a bit at this point by pointing out that the way the App Hub lets you look at your reviews is not very good.  You have to manually iterate through each and every country (and there are LOTS) to see if you have any reviews.  There is no way to just list ‘em all.  It’s all very annoying.  Anyway back to the topic.  The second app I did was my first kick at database work.  Using SQL to Linq was interesting and once you wrap your head around the fact that it’s not ADO, RDO or any other DO it makes lots of sense.  Now, the App was something that, once again, relates to my kid’s swimming.  I usually use a spreadsheet or notes or something to keep track of my child’s swims.  Not very cool and involved lots of typing, so I figured I would write an App to do it for me.  And FusionWare Swim Tracker was the result.  I wrote it and published it and it passed certification on the first pass.  That is where this story actually starts.  It was kinda useless.  No scratch that, it was definitely useless.  I mean it did what I intended but it fell down in some major ways.  In my defense it was my second App and I really wasn’t all that Mango infused yet.

What Not To Do

Let me list what was “useless” about this App, or rather what made using it so terribly difficult that I couldn’t see anybody ever really using it.  By the way, the App has been downloaded 118 times so far.  Not many, but enough that I am sure there is some disappointment. 

  1. Keyboards are EVIL.  Avoid the need to use the virtual keyboard at all costs.  Trying to type on that itty bitty little keyboard when you are mobile, in a hurry or just plain lazy (me) will make you stop using the App so fast it will make your head spin.  Swim Tracker required you to use the keyboard for almost everything.
  2. Make sure you collect enough information.  After going back and trying to use the App at a swim meet I realized that you didn’t really collect enough information to make the number mean anything (assuming you were able to type the correct information in using that itty bitty keyboard).  I was missing the Swim Course type (Yards or Meters, Long or Short) among other information.
  3. Make sure you give them a way to export the data so, you know, you can use it later.  I let the user enter the swim times (kinda, without enough info and probably wrong from the itty bitt….well you get the idea) but never ever let them get it out again.  Sure they could look at it on their phone but not DO anything with it.  What good is that?
  4. Don’t allow free form text.  Going back to that that darn keyboard again I wasn’t clever enough yet to limit input.  Did you know with Swim Tracker you could swim the “FRED Freestyle” race rather than the “400 Freestyle”?  Of course it could be 400 inches as we don’t let you indicate what the measurement was (see point #2).  Don’t let them enter the wrong stuff!!!!  Knowing that little Johnny swam the “FRED Freestyle” in “00:45.xl3f3”is not useful, is it?
  5. Don’t forget to polish up the app.  A lousy Tile and keeping the default splash screen should be banned.  It makes it look unprofessional.
Other than that, it was pretty cool!

What I Should Have Done (And DID do!)

After developing another three Apps for the Windows Phone marketplace and after attending some “Metro” design workshops I started to have a clearer idea of what I needed from design.  I also wasn’t under a hard deadline so could definitely spend more time designing and less time coding.  And sometimes you just have to write crap and try it to find out that it is not useful so you have a better feel for what IS useful. 
  1. Keyboards are EVIL.  So get rid of them all.  An App that tracks swims is pretty predictable in what information you need to collect.  Use selection boxes and date time controls (I call them spinners) that let you flick through the options will let you do pretty much everything you want in a big beautiful easy to Tap interface.  I changed from the traditional tiny combo box to the full screen selection list.  What a difference!
    Tip: Big is Beautiful!
  2. Include the right data!  Design, Design Design.  This time I took my time and went through what I REALLY needed and what format it should be in.  I decided that WHEN the swim was, was almost as important as WHAT the swim was.  So I added the course type and a date of swim.  Then I went through the existing fields and changed the data time from “varchar” or string) to meaningful types like integer (length) and DateTime (swim times).
    Tip: Spend as much time on design as you can BEFORE you code.
  3. Export of Data.  I added a save button to the main screen application bar.  There were several different options for saving the data, none of which was ideal.  What I really would have like to have done is create an Excel Spreadsheet and send it as an attachment in email.  Unfortunately, at this time, the Windows Phone API doesn’t let you do that.  You can neither generate Excel spreadsheets OR add attachments to emails.  I see this as a major oversight and I hope that it is corrected in Windows Phone 8 or whatever comes next.  So the next best thing I had was to send an email with a comma separated list as the body of the email.  Kind of clunky but it worked.  There is a pretty nice SkyDrive integration available with the SkyDrive API for Windows Phone. (http://msdn.microsoft.com/en-us/library/live/hh826521).  The only problem there was that it won’t support *.CSV as a file type.  Pretty much an Office document or TXT.  So TXT it was.  With very little code you can now save to SkyDrive or email your list (by date) to anywhere!
    Tip: SkyDrive is your friend.  USE IT!
  4. Don’t allow bad data.  This one sort of connects with #1 and #2.  Wherever possible don’t allow the entry of bad data.  Get rid of the keyboard and direct the user to what you want.  Make sure the data types restrict the data.  Put validation into your code to block bad code.  In the new Swim Tracker you CAN’T enter anything I don’t want you do.  No keyboards.  All select lists.  There cannot be any more bad data… EVER.
    Tip: Don’t assume the user will enter the correct data… Trust No One!  The Truth is Out There!
  5. Polish the Apple!  You just can’t underestimate the value of look and feel.  I cleaned up the Tile to use the phone theme.  I used Tiles for the Export functions.  I customized spinners for stopwatch style time entry (The default is AM/PM time.  I create a custom spinner page.)  In the Phone Toolkit there is a TimePicker control that lets you create your own TimePicker page.  Use the PickerPageUri property to redirect to your own page.  I then used the RadLoopingList from Telerik to duplicate the spinning number selection for the time entry. 
    Tip: Telerik Controls Rock!  (http://www.telerik.com/products/windows-phone.aspx)
I fully realized when I published the App that it was not all that it could be.  The experience of going back and “upgrading” it was worthwhile and allowed me to delve into some very different areas of the rich Windows Phone SDK.  My next blog will dive a bit more into the code as I realize that just changing the database was going to create big problems.  How to upgrade a database was going to be part of this blog but it took on a life of its own and was THE major undertaking in this upgrade.

See how I did it in Part 2

  

No comments:

Post a Comment