.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Articles >> Metro Apps >> Post New Resource Bookmark and Share   

 Subscribe to Articles

What to Choose between XAML and JavaScript for Windows Store apps development.

Posted By:Ravi Ranjan Kumar       Posted Date: November 28, 2013    Points: 200    Category: Metro Apps    URL: http://www.dotnetspark.com  

This article give you idea what to choose between XAML/C# and HTML/JavaScript to make Windows Store apps development.

If you are novice in windows store app development then it is obvious to get stuck on the question which platform is best for metro apps development or which one is suitable for you to code and build metro apps ? As developers new to Windows 8, we're having a hard time choosing between C#/XAML and JS/HTML for our upcoming app development.
I still remember the day when I started to learn coding in .Net framework 2.0 and an overarching question was echoes about new application development C# or VB.NET ? Now from .NET Framework 4.5, developers have a new rivalry to choose: XAML/C# or HTML5/JavaScript ? and its quite fact that Making this new choice has farther reaching implications than the prior C# or VB.NET decision.

The Landscape of Modern App Languages
You can use many languages to create Windows 8 apps and to interact with WinRT. Here are the available language sets for Windows Store app development:

Language Familiarity
To develop Windows Store apps, language will probably be the biggest factor in decision. If you have no experience with web development then C#/XAML will be easier for you. XAML developers will see a lot of familiarity to Silverlight or WPF in Windows Store development but there are plenty of difference as well.
In same way if you are good on web development, love to code using JavaScript, and are just more comfortable on the client-side of things then HTML5/JavaScript is for you. A HTML developers will be familiar with how the markup looks but will need to learn theWinJS specific classes and data attributes.

Concept of HTML and JavaScript in Windows Store apps.
HTML5 and JavaScript are open web standards and that's why they work in nearly every browser in the same way. That is the reason why you can develop HTML5 applications for Mac OS and port it without writing numerous lines of coding to Windows. There are a lot of JavaScript functions, that are only supported by IE10(Internet Explorer 10) (in fact, nearly every function you can find in the WinJS-File).
If you want to port Win 8 Application to any other Operation System, you have to review your code and need to write extra codes in order to target the desired platform.

Concept of XAML and C# in Windows Store apps.
XAML( Extensible Application Markup Language) is an XML-based markup language developed by Microsoft. XAML is the language behind the visual presentation of an application that you develop in Microsoft Expression Blend, just as HTML is the language behind the visual presentation of a Web page. Creating an application in Expression Blend means writing XAML code, either by hand or visually by working in the Design view of Expression Blend. XAML is .NET and so it is fixed to this Framework. You cannot easily port a XAML Application to a other platform. Therefore, XAML and C# is very good implemented into Visual Studio (Intellisense,Blend and Design-Views) and has some nice features like LINQ(Language-Integrated Query), DataBindingResolution Independence,Debugging. whereas C# is nothing more than a language which is used to write code behind file to manipulate and make UI(User Interface) in actions.

When and Why I should choose HTML/JavaScript or XAML/C# for Windows Store apps ?

Personal Experience and your Interest
I am repeating again, If you have no experience with web development but you know how to code using C# then C#/XAML will be easier for you. XAML developers from both the Windows Presentation Foundation (WPF) and Silverlight camps continue to write the same declarative XAML for the UI layout alongside C#, Vb.Net. In sameway if you have Interest in web development, love to code using JavaScript, and are just more comfortable on the client-side of things then HTML5/JavaScript is for you. A HTML developers will be familiar with how the markup looks but will need to learn the WinJS specific classes and data attributes.

Tooling Support
Blend for XAML offers a lot of the standard XAML editing features XAML developers/designers have come to expect but doesn't offer much beyond that. Since WPF, designers and developers have enjoyed Expression Blend. Expression Blend provides a visual and designer interface to accomplish complex actions and interactions in XAML UIs.

Note : Blend for Visual Studio 2012/2013 provides visual authoring for Windows Store apps, with support for both XAML and HTML.

The XAML functionality is similar to previous versions of Blend, so if you've used previous versions you'll feel right at home. In addition to rich support for Windows Store app development, Blend for Visual Studio 2012/2013 also supports enhanced compatibility with the XAML Designer in Blend.
whereas, Blend support for HTML represents a new and innovative kind of authoring environment for HTML, So If you are new to blend then it would be tedious task to work.

For more details and differences : Design Windows Store apps using Blend for Microsoft Visual Studio 2013

Third party library support
You can find lots of libraries that is written for C# and Javascript. Many of these libraries will work just fine with no change necessary. so if your concern is for third party library support then you don't need to worry.
Read more : Code libraries, toolkits and other sources of help

If your app target OOP(Object Oriented Programming)
The key part of OOP Inheritance, Polymorphism, Abstraction and Encapsulation, unit testing architectural reuse, and pervasive design patters are completely supported by OOPL like C++, C#, and VB.net. XAML/C# is best option to make apps that targets OOP in comparison to HTML/JavaScript. C#/Vb.Net has everything and full set of features including symbolic refactoring, complex metrics and superior code analysis.

Resolution Independence
Your app can have resolution Independence either you choose to write code in C#/XAML or HTML/JavaScript, but the prime factor is that HTML does not get to resolution independence as quickly as XAML (or as transparently) does but you can certainly accomplish it in HTML.
XAML is cool because XAML's resolution independency, it looks completely the same - just clearer, sharper. Size values in XAML are not pixels, they are device-independent units.

JavaScript lover always claim that JavaScript is better in terms of Interoperability because it can cross communicating with other applications. Just because of Dynamic features, JSON and being light in nature we shouldn't say HTML/JavaScript is better than XAML/C#.
C# can speak in same way! In other words C# can do all of that too. :) We shouldn't forget C# has DLR(dynamic language runtime). Any of the C# objects are one small serialization step away from becoming the same JSON object that a JavaScript app uses and likewise in the other direction. Just because C# application is fat and little bit complex with business logic, it does not mean it can't communicate lightly with the outside world.

Platform Target
If you are making apps that need to be targeted only for Windows 8 then C#/XAML is best option but if you are looking to make an app that is targeted to run on more than one platform then HTML5/JavaScript option would be worth.
Read for more details : Building Cross-Platform Apps with HTML5

Functionality of Bind to anything
Data Binding is one of the greatest and most powerful features of XAML (WPF, Silverlight, Windows Phone or Windows 8) compared to other traditional web and Windows app technology in .Net. The power of XAML really starts at its native ability to data bind. Nothing data binds like XAML - one way, two way, one time, and to almost any property. Not only is it built-in, not only is it powerful, not only is it fast, but it's simple.
For JavaScript lover - They Can use WinJS Framework and KnockoutJS both support ObservableLists that allow you to do the same but the performance is not the best.
Read more : 2 Great JavaScript Data-Binding Libraries [ For HTML/JavaScript ]

Raw Graphics
If raw graphics performance is a concern for your app, then going C++/DirectX ends up being your only real choice.
still have doubt ? If yes read below the feedback from www.wirestone.com Labs
We've been developing highly interactive graphical applications using markup languages like XAML and HTML for some time. But when there's a demand for high performance, we turn to DirectX. And to test the limits, we developed a proof of concept shown in this video under Windows 8 as a DirectX app.
Read more-Gain maximum graphics performance with DirectX.

Which is good between C#/XAMl and C++/XAML ?
First let be clear that the XAML rendering engine is pure C++ / COM whether you're using C++ or C#. Since .NET and C++ use the same WinRT framework, there probably won't be too much difference in interacting with the XAML/WinRT platform.
From a XAML perspective it becomes a language choice. The XAML UI stack is the same regardless of which code language you choose here. Depending on your goal of the app it might make more sense to use C++ or C#.
The great advantage of using C++/XAML is if speed is important to your project. The advantage of C#/XAML is that is much more easier to code.

What Should I do ?

I should first ask: "What are my needs?"

Target - Multi-Platform
Choice - HTML5/JS

if your needs are to target the mobile world, and to get your mobile application to as many people as possible, I'd suggest going HTML/JavaScript instead of XAML/C#/VB.Net.More of your core logic will translate across the platforms when you start looking at Android or WebOS or Blackberry development using tools like phoneGap, etc.

Target - Windows Ecosystem
Choice - XAML/.Net

if your app is only targeting windows platform. I would suggest XAML. XAML gives you full access to what Microsoft has to offer. HTML5 has some limitations that XAML does not have. XAML does have a learning curve, but its worth it, if your target is windows.

Tatget - High Performance
Choice - Native (XAML/WinRT)

if your app target 2d,3d graphics and need great performance. I would suggest You should go native. Which in this case is XAML + C++/Cx (though you may be able to get away with mixture .Net managed code depending on need). Even if you were to look at porting your app to other devices in the future, you'd probably go native on each of those platforms, for performance.

Some Feedback to give more ideas to make better decision

Windows 8: Top 10 Reasons Why I Choose HTML5 Over XAML
Windows 8: 15 More Reasons why I choose XAML over HTML5
Why I Prefer to Build My Windows Store Apps in HTML
Windows 8: Top 10 Reasons why I choose XAML over HTML5

For me, I love both language(C#/XAML and HTML/JavaScript) equally and here I am not underestimating the power of JavaScript and HTML5 but when matter comes to choose a platform to make a Windows Store app, personally I would definitely choose C#/XAML because of my skills is more familiar than JavaScript. :) If you have same question for language opting then don't worry. Many have same query. You are in an interesting situation, where your mind is on blank slate. Your choice may be different. If it is, make sure that you have valid reasons for your choice. Not all choices are equal. You can choose platform as per your skills familiarity and based on app requirement.

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend