locked
language choice : C++ or Javascript for developing rich Windows store app ?

    Question

  • Hi, 

    I need some input in choosing the language (C++/XAML or HTML/JS) for a windows-store-app given the following criteria.

    1. the app is a generic photo editing app, so there will be quite bit of UI panels. 

    2. Allow image manipulations - like cropping  and adding effects ( like instagram ) and basic painting and adding text to the image layer etc.

    3. has an organizer - which shows images in a grid and allow things like sorting etc. 

    4. i already have some existing C++ libraries and i wish to leverage them (its a blocker to me if i am unable to use these libraries)

    5. i am expecting the app to be "not-basic" but a professional average app when it comes to amount of source code that would go into development. - so i am concerned about the future maintenance ( of code ) part as well. 

    6. Performance is an important factor. 

    i am basically a C++ developer, i dont have much knowledge about XAML. i have fair/good understanding of javascript/HTML/CSS.

    I have following thoughts in my mind - 

    HTML/Javascript  : 

    PROS 

    1. Easy to use. Can quickly bring up things easily and get the basic things working. 

    2. has a rich HTML/JS community, so easy to get questions answered. 

    CONS

    1. Performance  (  ? ) - i am worried about the final app performance, the initial basic version might not have any performance bottleneck but i am worried that given the functions are loaded and keeping everthing in dom - things would be slower when i have the overal app and when user use the app for long time.

    2. Modularity and maintenance : difficult to structure javascript code in a flexible extensible manner - (this is my understanding - might not be true  maintaining the code would be tougher ? 

    For C++ :

    Cons : 

    1. Need to write more code : I need to write way more code than javascript. manipulating DOM  by changing HTML/CSS properties is such an easy task. eg: by just changing the classname of an element we can have it work differently in different situation easily.  Do we have the same thing available on C++/XAML as well ?

    Questions :

    i have some grey areas and i need some information to get more clarity

    how rich is XAML compared to HTML version ? - i guess the number of controls offered is the same ( or there is difference? ) .. also, how easy to order elements within containers ? like say i have screen and place different UI panels at different places - typically, for HTML , i end up using display:-ms-grid on a div element to order elements withing a container , thins like placing an inner element at center or end or start. how easy to do these with XAML ? 

    are there any caveats in XAML that i need to be aware of ? how easy is it to define UI in XAML - in the sense does it provide finer control over positioning of elements in a relative way (so that the UI fits correctly when taken to different screen etc)

    In terms of flexibility , meaning ability for the developers to easily tweak and tailor something (lets say , AppBar element or adding new custom UI element) to his needs, does both language provide same support ? 

    Are there any things are available in one language and not other (wrt to my app ) that i need to be aware of  ? 

    Is threading available on Javascript ? which language has better support ? 

    i haven't played with lambads yet on C++ and since WinRT APIs are mostly async, how easy/difficult is it on C++ compared with JS. in general which language is good when it comes to dealing with WinRT APIs. 

    how is the community support for C++/XAML based questions ? i worked a bit on this (a small C++/XAML ) earlier and didnt find the support encouraging. 

    I guess these are the questions that typically haunt the entry level developers to windows-store-apps world and this would really benefit other developers as well, so would really appreciate some concrete answers to the above.

    thanks,



    Raj


    • Edited by naiveCoder Friday, March 15, 2013 11:26 AM
    Friday, March 15, 2013 11:19 AM

Answers

  • Hi Raj,

    My vote would be C++/XAML although I could be biased; I'm a C# developer and have been working with WPF for a number of years (Windows, Silverlight, Phone).  There is not much you can't do in regards to layout and design - the return on investment (of your time) will be huge and you won't be disappointed.

    I'm in the process of learning C++/CX and am still performing TDD on the framework API (IOC container and MVP-VM - blogging my adventures HERE).  So I haven't had the opportunity yet to dabble in the XAML side of things as far as compatibility with what I am accustomed to.  I am cautiously optimistic I will feel right at home from what I'm seeing.

    You might be interested in the HILO project from the Microsoft P&P folks.  It demonstrates Image handling (cropping, turning, saving, etc.) and could help you in your decision.

    Best regards

    Bill


    MCAD.NET C# - http://www.Global-webnet.com/Blog


    • Edited by BillKrat1 Friday, March 15, 2013 12:59 PM fixed hyperlink
    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Friday, March 15, 2013 12:58 PM
  • Hi Raj,

    You can select C++ /XAML .

    In your case you want to perform image manipulation and you could do it by using Direct2D,Direct3D.

    Please see DIRECT2D built in effcts here - Effects

    As you know these libraries are written in C++ and you can use it diaractly in your app if you go for c++.

    Otherwise  you have to write a WinRT component.

    thanks,

    Bhash


    • Edited by BhashTech Friday, March 15, 2013 1:50 PM
    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Friday, March 15, 2013 1:49 PM
  • For the second question, there is canvas control in XAML, you can easily control the layout in it. Also there are other control like stackPanel or grid, please take a look of this
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465337.aspx

    Also, there is  most function control in XAML
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465345.aspx

    Generally speaking, we can separate the UI and data, we can write UI with JavaScript and do the control codes with C# or C++/CX. In JavaScript we can call the Windows Runtime Components to do this.
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh441572.aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Monday, March 18, 2013 3:02 AM

All replies

  • Hi Raj,

    My vote would be C++/XAML although I could be biased; I'm a C# developer and have been working with WPF for a number of years (Windows, Silverlight, Phone).  There is not much you can't do in regards to layout and design - the return on investment (of your time) will be huge and you won't be disappointed.

    I'm in the process of learning C++/CX and am still performing TDD on the framework API (IOC container and MVP-VM - blogging my adventures HERE).  So I haven't had the opportunity yet to dabble in the XAML side of things as far as compatibility with what I am accustomed to.  I am cautiously optimistic I will feel right at home from what I'm seeing.

    You might be interested in the HILO project from the Microsoft P&P folks.  It demonstrates Image handling (cropping, turning, saving, etc.) and could help you in your decision.

    Best regards

    Bill


    MCAD.NET C# - http://www.Global-webnet.com/Blog


    • Edited by BillKrat1 Friday, March 15, 2013 12:59 PM fixed hyperlink
    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Friday, March 15, 2013 12:58 PM
  • Hi Raj,

    You can select C++ /XAML .

    In your case you want to perform image manipulation and you could do it by using Direct2D,Direct3D.

    Please see DIRECT2D built in effcts here - Effects

    As you know these libraries are written in C++ and you can use it diaractly in your app if you go for c++.

    Otherwise  you have to write a WinRT component.

    thanks,

    Bhash


    • Edited by BhashTech Friday, March 15, 2013 1:50 PM
    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Friday, March 15, 2013 1:49 PM
  • For the second question, there is canvas control in XAML, you can easily control the layout in it. Also there are other control like stackPanel or grid, please take a look of this
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465337.aspx

    Also, there is  most function control in XAML
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465345.aspx

    Generally speaking, we can separate the UI and data, we can write UI with JavaScript and do the control codes with C# or C++/CX. In JavaScript we can call the Windows Runtime Components to do this.
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh441572.aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Jesse Jiang Friday, March 22, 2013 1:28 AM
    Monday, March 18, 2013 3:02 AM
  • You can always do the heavy work in C++ WinRT components and use HTML/JS for the layout and business logic. I would always favour a HTML5/CSS separation over this XAML mess and hope that MSFT will eventually drop XAML like Silverlight and give C++ developers easier access to the IE HTML render engine. In fact you can already do that today, have your app be the backend and let IE render its controls. That's what wwahost.exe does. It injects the WinRT COM components into the JS Engine of IE.

    Performance is really not an issue with JS apps. It will be often fast enough if you do it right. Doing it wrong will also slow down C++ apps. The IE renderer facilitates the GPU for some fancy stuff like transitions. If you take care of that, JS apps will most likely be even faster than XAML based apps. It will be also less binary code.

    Wednesday, March 20, 2013 10:37 AM
  • [phil_ke] "I would always favour a HTML5/CSS separation over this XAML..."

    When Windows 8 came out I had to assess what would be my new direction (I have been a C# developers since .NET emerged), it was time to look at everything and choose a route.   Because HTML5/CSS was cross platform and was the big buzz word I opted for that direction until I saw the following:

    http://www.itweb.co.za/index.php?option=com_content&view=article&id=58428:zuckerberg-says-html5-bet-was-a-mistake

    Facebook has far more experience and resources in the matter than I do (and it looks like they invested a lot into it) so I saw this as an authoritative source suggesting that Native is the best way to go.   Thus I chose C++/11 and Microsoft as the platform - since C++/CX and XAML is the only option (for Windows 8 application store development) it seemed the best/logical choice.

    Has something changed since then that makes Html5/CSS and javascript a viable option?

     


    MCAD.NET C# - http://www.Global-webnet.com/Blog

    Wednesday, March 20, 2013 1:25 PM
  • I assume Zuckerberg was referring to X-Browser compatibility, which is not an issue for Win8 JS apps since they only run on the IE engine. Beside that, someone checked the Fakebook HTML5/JS app and found that it was badly programmed from the start in the first place and had nothing to do with HTML5 or JS in general.
    Wednesday, March 20, 2013 3:17 PM