Windows 8 is almost released, a lot of companies started already to develop application for Windows 8 – Metro Applications.
In a Metro Application we have three technologies to render the UI:
On the first level we have DirectX for the UI. This can be used only from C++. Of course we can define libraries that can be consumed by C# and JavaScript code.
The second way to create UI is using XAML. We can use XAML in C# (VB) and C++. The big difference in comparison with DirectX is that we cannot use an XAML controller in a JavaScript application. In this moment we don’t have a JavaScript component that permits us to display a XAML (and I don’t think that we will see soon).
On the same level as XAML we have HTML5 and CSS. This can use only JavaScript and don’t permit to create WinMD libraries that can be consumed by C# and C++. We don’t have any kind of support of JavaScript in C++/C#.
What nice things we can do? We can have a DirectX library and over it an XAML as overlay. This is a very powerful for game industry that can use XAML for data binding and interface and in the same time to use DirectX for the game UI.
After 4 months working with JavaScript and C# on Metro Application on Windows 8 I can say:
In a Metro Application we have three technologies to render the UI:
- JavaScript
- C#
- C++
On the first level we have DirectX for the UI. This can be used only from C++. Of course we can define libraries that can be consumed by C# and JavaScript code.
The second way to create UI is using XAML. We can use XAML in C# (VB) and C++. The big difference in comparison with DirectX is that we cannot use an XAML controller in a JavaScript application. In this moment we don’t have a JavaScript component that permits us to display a XAML (and I don’t think that we will see soon).
On the same level as XAML we have HTML5 and CSS. This can use only JavaScript and don’t permit to create WinMD libraries that can be consumed by C# and C++. We don’t have any kind of support of JavaScript in C++/C#.
What nice things we can do? We can have a DirectX library and over it an XAML as overlay. This is a very powerful for game industry that can use XAML for data binding and interface and in the same time to use DirectX for the game UI.
After 4 months working with JavaScript and C# on Metro Application on Windows 8 I can say:
- XAML can bind to everything (we have in JavaScript and HTML – but the performance is not the best)
- Dependency property – we can bind 10.000 properties to the UI without any problem (I saw a HTML/JS implementation and it took over 20 seconds to bind and render all the data)
- OOP – is nice to work with a functional programming language (but I miss OOP)
- MVVM – in this moment this pattern is well defined for XAML solutions and a lot of MVVM frameworks already support it
- Debugging – full debugging support as intellisense, code analysis and symbolic refactoring
- Vectors – can be done in HTML5, but I prefer to work with them from XAML
- Resolution independence – don’t need to say more
Interesting - anyway, about "What to use?" - the answer is simple - what your team has more experience in. Very, very few developers are equally experienced in XAML and HTML5/JScript, or in both C# and C++.
ReplyDeleteFor a programmer that used C++ and MFC for the last 10 years, getting up to speed with C# and XAML in 5 days is not an option.
I would not say to use only the language that you know. A technology can be learned, is not so hard. We need to realize that there is some limitation when we use one HTML/JS or XAML/C# or DirectX/C++. We need to take this account before starting the project and see also what language can make us happy.
DeleteOf course - I meant to say - what technology to use when a team of let's say 10 people is asked by a client to start to implement an application _now_, and have it released in production in 2 months - in such cases, which are the norm in most companies, the developers are happy if they have 4 days before the project starts to get up to speed with some new technology.
DeleteSure, when somebody has plenty of time before a project starts (months), it will also have time to switch platforms, learn something new etc..
To give you a clearer example:
DeleteYou cannot do dynamic loading of code (assembly) in XAML/C# metro application. But using JavaScript and HTML5 this is possible. In the same time it is easier to use C++ and DirectX in a XAML application than in HTML5 and JavaScript. And you don’t want to have 1000 bindings in a HTML/JavaScript application; you will need more than 2 seconds to load the page.
What is the scope of your application? What you will do in it? What we need to in our application? This is the most important question. Quality software cannot be developed only because we know a technology. We need to know a lot of technologies and know what is the most suitable for our application. You don’t want in version 2 or 3 to have a blocker because you didn’t use a suitable technology.
Indeed, this is the best approach - when possible, evaluate the most appropriate technology and use that.
DeleteIf you have developers skilled in multiple technologies, or time to train them in advance, it's best.
Otherwise, when a company has only 20 developers, and 10 or them have just finished working 4 years for a big project in WPF, then the company finds another project that must be developed for Win8/Metro, and the company has won the bid against other companies because they promised to finish it in 3 months, what do you do? :)
Turn down the client because maybe JS/HTML5 is more appropriate in some cases, or use the technology that the developers know?
About: "You cannot do dynamic loading of code (assembly) in XAML/C# metro application" if it's true, this is a very strange limitation, because it was possible until now. Anyway, the cases when this is needed, are rare in normal applications.
“Anyway, the cases when this is needed, are rare in normal applications.”
DeleteIn a LoB application dynamic loading is a have to in many cases. They don’t allow this for security reason and I try to understand them (only try). Maybe a Prism for Metro Application will be launched soon and all our problems will be solved
Somehow it's logical - since a Metro app is a sandboxed app that must be pre-approved by Microsoft in order to run (usually), and dynamically loading is usually used for plugins/extensions that are not installed in advance, such a restricted application can't use plugins that are not yet verified by Microsoft.
DeleteMaybe in future they will develop a MEF version for Metro that allows this (http://mef.codeplex.com/wikipage?title=MetroChanges).
I'm waiting this version of MEF for Metro Apps and also I hope that they will support HTML and JS.
DeleteAlso you'll have to take in consideration what type of application you're developing, what features need to have and the complexity of the app. Based on these things you'll decide the right solution to use.
ReplyDeleteThis is the path of decision making in my company.