Thursday, February 21, 2013

WinRT - Coding in XAML vs HTML5


WinRT has so many choices for developers in term of language for Windows Store app development, that you have to really think which one is better (if not the best) among the all equals.

Functionality wise there is not much difference, all of them ( C++, JavaScript & HTML5, C# and  XAML) runs on the same run time (theoretically) i.e. WinRT. But every language projection has its own set of advantages and disappointing in the context of app you are developing. For example HTML5 and JavaScript can be a bad choice, if your application need 3D rendering of images similarly XAML can be very painful is your dealing with lot of HTML content.

I have listed down some basic guideline which can help you decide between XAML (.Net developers Favourites) and HTML5 (the game changer)


  • Learning Curve: There is a famous saying "A sword never kills anybody; it is a tool in the killer's hand", so if you have to make a choice, consider your team strength in terms of XAML vs. HTML5.  If you are starting with a clean slate then in my opinion HTML & java script is quick to learn as compared to XAML, but this does not mean that you should ignore XAML, because if it benefits you in long run you might still want to spend that extra time in learning XAML.

  • Use Case : If you know that you are going to deal with lot of HTML content and RSS feeds, then HTML5 should be the way to go, XAML webview has many issues and is not as efficient in handling HTML content. And you might want to consider XAML if you dealing with lot of animation and 3D rendering
  • Portability: If you considering porting your application to other platforms outside Microsoft eco-system like iPhone and Android HTML5 will be your friend.  However if you do not have any plans for migrating/porting this app outside Microsoft platform ( and not dealing too much with HTML content) XAML might be a better choice because of rich tool set support like Blend and VS.
  • Maintainability: XAML and C# being the first class citizens of .Net framework has better support for debugging in Visual Studio and Expression blend.  And since C# has support for OOPS your code will become much cleaner to maintain and debug while maintaining huge set of JavaScript file can be very error prone and tedious task. So if your app tends to grow and need on-going support and feature enhancement you might want to consider XAML & C#.
  • HTML5 and JavaScript (WinJS) does not have support for SQLite, and you have to live with index DB. Based on your need, this can also become one of the consideration.
  • XAML has more controls out of box as compared to HTML5 (WinJS) controls, but this again depends on the need to project

Choosing between WinRT and Windows 8 app


As the market share of Windows RT OS based devices is picking up, it’s kind of a tough call (somewhat confusing to many people) to create the road map for their product and application i.e. which one to choose (Windows RT OS or Windows 8 OS) and why? And is there really any difference between these?


Window 8/RT is an OS, designed for devices running on ARM Architecture
WinRT is a framework/runtime for application development on Windows RT

Windows 8 desktop applications and WinRT native applications are two different breeds targeted for different devices and you need a different design approach for each.

Windows 8 desktop application: It is essentially a desktop app built using .Net Framework and WPF. It will run without any issues on previous Microsoft OS (windows 7, Vista ) as long as there is support for .Net framework on these OS.  What is interesting is that this desktop app will not run on Windows RT mobile devices like Microsoft Surface with Windows RT.

WinRT apps or Windows Store app:  It is a modern Windows 8 style app (previously aka Metro style) built to run on Windows RT OS, targeted for devices (e.g Microsoft Surface) with ARM Architecture.  Typically these apps either come pre-packaged with Windows RT devices or can be downloaded from Windows App Store.  Idea is to have a consistent experience across different tablets from different device manufactures.

Now having said that, both types of application are going to stay in the market and it’s totally dependent on the business need, where you want to spent the money.

When to - Choose Windows RT 
  1. Most of your application users are going to be on mobile devices (ARM based).
  2. You want the best of both worlds i.e  ability to run the same app on x86 based devices like laptops and desktops running Windows 8 and on Windows RT mobile devices.
  3. Reach wider audience, by putting it on Windows App store, you would reach markets you might not have ever been able to reach before.
  4. You are creating a new app and you do not have any legacy code/ app.
  5. You have data on the cloud, and you want to create connected application with anytime, anywhere access
Choose Windows 8

    1. Most of your users are going to work on Windows 8 and will use mouse and keyboard for most of the time.
    2. You need to support previous Operating Systems like Windows 7 and Windows vista.
    3. You have legacy .net based code (yeah .net becomes legacy now for WinRT) that you want to reuse to bring down the development cost.