Metro App: XAML/C# vs HTML/Javascript ? RRS feed

  • General discussion

  • Hi Community,

    I am planning to dive into Metro app world and after my preliminary studies i am bit confused which path to take? i mean either go by XAML/C# way or go by HTML/Javascript way?

    I am good at C# but totally new to XAML, where as for HTML/JS frankly speaking i don't like java script programming. So really confused which way to take. Also not sure as of now which one will have more better place in job market.

    Any guidance in this regards will be helpful to me. Also if any pros and cons for both this path are listed somewhere?

    Thanks & Regards

    Pinal Bhatt

    From the desk of Pinal Bhatt | http://www.PBDesk.com

    Friday, March 16, 2012 1:08 PM

All replies

  • Hi Pinal,

    if you have a Background of C#, I would go with XAML/C#. HTML/JS is for opening the platform to other developers and most of the (cool) functionality would be done in JS. If you don't have a lot of experience with XAML tools like Blend will help you.

    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Friday, March 16, 2012 2:11 PM
  • Thanks for the response. But what do mean by "most of the (cool) functionality would be done in JS" ?

    From the desk of Pinal Bhatt | http://www.PBDesk.com

    Friday, March 16, 2012 5:09 PM
  • I mean that every WinRT functionality would be done through JavaScript (like with C# or VB if you're using XAML) and if you haven't worked with some concepts, like  promises in JS, it would be hard to become a foot on the ground.

    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Friday, March 16, 2012 9:41 PM
  • Do yourself and your users a favor and use C#/XAML or C++/XAML. My reasons?

    - All javascript/html/css are stored human readable in the app folder (everybody can look there and see your code)

    - UI performance is order of magnitude worse in HTML/Javascript than in the XAML world (look at the Apps in the Marketplace: Music App (html), Maps (XAML)

    - Better performance and ressource consumption in general

    - More rebust tooling in C#

    - etc.

    Saturday, March 17, 2012 11:41 AM
  • If you an C# Developer then use XAML.

    HTML and Javascript is the hell :)

    Thursday, March 22, 2012 7:56 PM
  • Hi Paul,

    I love .NET as well but you are not correct that it is more secure.  Reflector will let you see it all!


    Jeff Sanders (MSFT)

    Friday, March 23, 2012 1:28 PM
  • Hi Jeff,

    I think I need to further explain what I meant. You are right that CIL code is not very secure but it is still more effort. Not intending to fight with people who prefer Javascript over C# or C++.

    C++ Apps: Compiled to native code. Really difficult to steal the IP.

    C# Apps: Compiled to CIL (.dll or exe). Easier to reverse engineer than native code (using tool like Reflector). Devs are used to obfuscators to increase security.

    Javascipt Apps: Interpreted Language. Open files with Notepad. See all comments, assets with zero effort. All CSS/HTML/Javascript is human readable with just a simple text editor. I can open the source code and alter it after I installed the app.

    Just navigate to %Programfiles%\WindowsApps and see for yourself. Example:

    - Bing Weather app (Javascript)

    - Solitaire app (C#)

    - Bing Maps (C++)

    Personally, I would suggest everyone to use C++ (or atleast for the IP critical stuff). Just advice to fellow devs.

    - Paul

    Friday, March 30, 2012 9:26 AM
  • Almost right Paul!

    There are minifiers and obfuscators for javascript as well which puts it in the same category as .NET.


    Jeff Sanders (MSFT)

    Friday, March 30, 2012 11:49 AM
  • Does doing it in HTML/Javascript give any advantage for porting an app to Android?

    • Edited by PuzzledGeek Wednesday, June 6, 2012 11:55 AM
    Wednesday, June 6, 2012 11:54 AM
  • It depends on how much you are doing in real HTML and JS instead of using WinRT. I think it is a good way if you don't use device native things and want to port your app to different platforms.

    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Thursday, June 7, 2012 10:46 PM
  • Here you can see what is the differences.

    Giorgio Sardo - Windows 8 Apps with HTML5 and JavaScript: from zero to hero!
    Billy Hollis - Introduction to XAML in Windows 8/Metro

    The past is mainly ASP. NET Forms.
    Telerik Controls.
    C# programmer.
    JQuery I know quite well.

    I chose JavaScript. Is it a good decision remains to be seen.

    Why? Larger "resource developers", greater opportunities to expand.

    • Edited by rafal.t Thursday, July 19, 2012 9:34 AM
    Thursday, July 19, 2012 8:45 AM
  • I know this reply is late but we've been dealing with the same issue. I not a fan of JavaScript but it appears that the whole world is headed that way. Microsoft WinJS is probably one of the best libraries of JS I've tried because it doesn't feel like JavaScript. Unfortunately, we don't work with anything MS puts out that is less than version 3.0 so we are sticking with XAML and C# until Window 8 has a more robust tool set. But the bottom line looks to me like JavaScript will eventually win and if you want to be in the game, learn JS really well. Cheers.
    Saturday, December 8, 2012 3:20 PM
  • Charlie,

    You are not late. You are right on time. Only earlier adopters are looking at the page now and soon a lot of people will be looking at this so your coments will help a lot of people.

    I don't trust JavaScript as the language to base the success of applications on. Sorry, I have crappy web experiences daily with it. It is easy to code wrong. Hard to code correctly. It is hard to unit test.

    I still believe in the thin UI idea for cross platform over HTML and JS. So I would use XAML and C# for Windows 8 not only "for now" but I will probably still be choosing XAML and C# in windows 9 and windows 10.

    Also, you don't control your own destiny if you use a HTML5/CSS/JS. You are at the mercy of the browser written by somebody else.

    So why not control your own destiny and have a nice architecture: 

    [Backend in C# fully tested] | [Presenter in C# ] - [ Thin UI for each supported platform ]

    .NET for Windows, Mono for Mac and Linux/FreeBSD, MonoDroid for Android, MonoTouch for iOS.

    You have one set of unit tests for most your code and it works everywhere. You have have native looking UIs everywhere.

    The first argument I get from HTML/CSS/JS people are that I have to write multiple UIs. However, they fail to mention that they have to do work for each UI too. You have to have separate Views and CSS stylesheets for different sized screens. Since the UIs are thin, it may actually be less work to write 5 user interfaces with the language for each OS than to write one UI in HTML5/CSS/JS that supposedly fits them all. Not to mention the ugliness and unmaintainability of HTML5/CSS/JS code that tries to work everywhere  is atrocious; where next thing you know developers have to add code to their servers (either in PHP, ASP.NET, Ruby, etc...) just to make life maintainable. 

    Selling the idea of a web application for a local app is tough. For an application that doesn't require a server on the cloud, I would never risk the future of my company on HTML5/CSS/JavaScript.


    • Edited by Rhyous Saturday, December 8, 2012 7:40 PM
    Saturday, December 8, 2012 7:39 PM
  • if you have a Background of C#, I would go with XAML/C#. HTML/JS is for opening the platform to other developers and most of the (cool) functionality would be done in JS. If you don't have a lot of experience with XAML tools like Blend will help you. 

    Friday, December 14, 2012 7:44 AM
  • Like a few other people have  noted, I've been debating the same thing for a while...

    I'm not an advanced programmer in really any language, but I have good deal of experience in assorted C-derived languages. I've been coding in C# for just under a year and have done a great deal with it. I think C# is probably my personal favorite, simply because it maintains many of the C-fundamental concepts, but it's modern and refined.

    However, being a successful developer involves being with the times. Like others mentioned, web-based platforms are not as powerful and can vary across browsers, however, Javascript, HTML5 and CSS are still evolving at a rapid rate with a large support community. The reality is, applications and platforms are progressively becoming more and more web-based with the key-advantage being support across so many platforms. 

    Learning Objective-C for iOS, C# for Windows, and Python or C for Linux apps (if you ever venture down that realm), and Javascript for websites is a pretty significant hassle. Now granted, if you're a large company like Facebook, you can allocate developers to exclusively create apps for certain platforms to perform great. However most of us probably are single developers or fall into a small organization. So switching across languages hinders productivity (I was working on a project with C# and PHP [not ASP because I didn't want to setup an MS Server with MS-SQL and whatever else], but I kept having so much trouble because PHP and C# have lots of minor differences that I would have to recall [for example, I kept wanting to put $ in front of C# variables]).

    It's not that I dislike Windows or favor iOS or Android, it's simply nice to have options. So if I want to develop a Windows 8 App and then a website the next day, I won't have many differences to work with. A few years ago, learning C# and XAML probably would've been a good idea for Windows apps, but now, Microsoft has tied the HTML/Javascript platform directly to WinRT, meaning there's not additional layers you're getting through that may hinder speed and performance of apps.

    If I understood correctly, HTML/Javascript apps are powered by Internet Explorer at a pretty low level, so unless you're doing something with complex graphics and need DirectX with C++, I don't see an advantage to choosing C# over Javascript.

    Now, I will admit that Javascript makes thing a little too easy. And by that I mean it's quite relaxed with syntax and isn't as structured as C#, which in some cases might make things difficult. Like I said before, C# is quite refined and nice, but Javascript is clearly evolved with some bizarre bits.

    In summary, however, Javascript can be used across many platforms, while C#/XAML is proprietary to Microsoft. So for the sake of helping you as a better developer for a broader range of platforms, I would have to suggest Javascript. However, if you're a hardcore Windows developer, by all means, C# and XAML are the way to go. I'm just quite happy that Microsoft made the whole process easy for developers to choose a platform they like. I know for some Objective-C is second nature, but it's such a bizarre language that differs from almost anything else that there's really no shortcut for it, making iOS developing a bit of a pain for newer developers. But simply because of Microsoft's well-developed system for Windows 8 Apps, it'll be my first choice for making apps for a while at least.

    Monday, December 24, 2012 6:47 PM
  • I too am in the same boat.  Long time .NET developer and just now coming around to learning the newer Win8 development areas like WinJS, XAML etc.  I am reluctantly leaning toward the HTML5/JS route.  Having been a long time web developer, Javascript is not new to me.  However, after going through several demos/tutorials, my first impression was it was just like building a web app using a combination of html & jquery.  Ive been doing MVC off and on over the last 2 years or so and I was constantly complaining about how much less productive I was using MVC vs ASP.NET web forms.  However, that seems to be the trend- stateless web apps.  Now I am complaining about how much slower I am with Windows/Desktop apps under Win8 using either XAML or HTML5 - vs Winforms.  Yes, I know Winforms are old school, but dang it they worked and you could be productive with half or less of the steps involved.  Maybe as time goes on, the Visual Studio tools will get better, and I have not yet tried VS 2013, so maybe I am off base here.

    Long and short of it, I am leaning toward HTML5/Javascript for Windows 8 and Phone 8 apps.  You can still call your C# class libraries directly from WinJS code and debug both in the same solution.  
    Monday, December 2, 2013 2:09 PM
  • For me use C#,XAML , ( you can watch video from Channel 9 say why C#,XAML not JS,HTML5
    Saturday, April 12, 2014 8:26 AM