Thursday, 21 August 2014

Going Universal - Lifelines

Over the last month I have been writing a Windows 8.1/Windows Phone 8.1 App.  I am a lazy programmer by nature... aren't we all?  And my preference is to stick with what I know.  However, sometimes something else comes along that you just have to try out.  The benefits of write once (mostly) and deploy to multiple platforms (mostly) was too tempting to pass up.  I also decided that writing using the MVVM pattern only made sense as the whole Universal App concept works much better with the full separation of View and Model.  For the most part, historically I have stuck with more of a traditional programming model having come from a VB background.  As recently as 2011 I simply loaded a bunch of controls that didn't quite do what I wanted on a form and then wrote a bunch of code behind those controls to make them bend to my will.  But this is not the way to go in the modern world of mobile apps for the Windows Platform.  Most developers need some help to start with in the new world and want to gather all necessary information sources and resources into one place so they can really go to town.  Fortunately Microsoft has provided lots of help here, some directly and some indirectly by supporting those that can help you.  So here are my suggestions on where to start.

Phone a Friend (MVP and Ambassadors)

The plan is to start out with "How to Begin".  This was no easy task as beginning is always the most difficult part.  When I first start something new that I have not done before I go to my friend and mentor Jan Hannemann, your friendly neighbourhood Nokia Developer Ambassador and fellow Microsoft MVP.  One of the topics he is VERY strong on is the MVVM pattern  he is definitely a go-to guy in that area.  I've done it before haven't really focused on it until now.  You should visit his blog (http://janhannemann.wordpress.com/) if you want some detailed info yourself or just contact him.  He's always happy to help.  That goes for pretty much any Microsoft MVP I've ever met.

Ask the Audience (Microsoft and it's forums)

While there are many similarities to developing for Windows Phone with Silverlight there are differences.   This old dog is constantly learning new tricks.  On the Windows 8.1 side of the equation it actually works out pretty similarly.  However Microsoft has introduced quite a number of new features into the Universal App model, most of which are huge time savers for developers like me.  I used to have to either use 3rd party controls or brute force my own solution.  Microsoft has provided lots of samples to help you out.  Information in places like Stack Overflow is still pretty thin as the platform is still fairly new.  It will grow.  The sample pack currently contains at least 65 different Universal App samples covering everything from File Access to Geolocation to some Direct 3D gaming stuff.  Something for everybody.

Microsoft's Universal App Samples: http://code.msdn.microsoft.com/windowsapps/Universal-Windows-app-cb3248c3

You can also ask the audience by visiting Microsoft's developer forums.  They have endless answers to questions and the nice part is many experts are constantly monitoring the forums and will find you the answer you need if nobody else has asked it before.  I found more than a few answers in there.

50/50 (Visual Studio/Blend)

Do you use Blend?  Do you even know it's included in Visual Studio?  I must confess at first I didn't use it much purely from an ignorance point of view.  But PLEASE PLEASE PLEASE learn what it can do and get on with it.  It will make  you better, it will make your apps better and it will make you
happier (really).  If nothing else, Blend's abilities to edit templates to make XAML controls do almost anything and look almost any way you want them to is gold.  For example, I had a customer that wanted a toggle switch on their app.   Normally a toggle switch looks like this picture.  But Blend lets you do more.  If you haven't used Blend just load it up and right click and select select Edit Template or Edit other Template and you can do almost anything with it.  Basically what it does is make a copy of the underlying XAML that makes the control hum
and you can change anything.  You can then take that template pack it up and re-use it anywhere you like.  In my case I like psychedelic pink white and green.  But you can change all the little things, remove stuff you don't want and reposition things around.  Don't be intimidated by the pages of XAML created.  Just start with small things and you will learn so much in a short time.  Before you know it you'll be going after animations and other fun stuff.

Because Universal Apps are so knew there aren't the myriad of 3rd party controls so you need to make the ones provided work for you.  There are lots of really cool controls that do amazing things.  You don't need  that pesky Windows Phone Toolkit anymore.  It's all mostly included now. 

Next Up

So, what's next...  That's right, time to write some code.  Now that I have all my advisers handy, it's time to use it.  Write my first Universal App!