다음을 통해 공유


Windows Phone 8.1 for Developers–Choose your Weapons

This blog post is part of a series about how Windows Phone 8.1 affects developers. This blog post details how we can use different languages for creating apps and is written by Alexander Persson from Jayway (@alexanderpersso) and was originally published here.

Introduction

With the introduction of Windows Phone 8.1 we are no longer limited to using C# or VB for creating native Windows Phone app. As a result of converging Windows Phone and Windows Store we are now able to develop native apps with Javascript and C++.

In this post we will try to explain what the languages are good at and when you should pick one over the other. But first we will give a short description of the two new ways to create native apps.

 

Javascript (WinJs)

Javascript is widely used on the web, with node.js it’s starting to gain popularity as backend in servers and on Azure. It’s a very flexible language which are now available for us when creating Windows Phone apps.

 

C++

C++ has long been the language for maximum performance and if written correct it is unstoppable. Now we are able to combine the power of C++ with XAML to create awesome apps.

 

Platform interoperability and third party libraries

All platforms supports full access to the device API and resources, this means you won’t lose functionality just because you choose to use C++ instead of Javascript. That said, every language has their set of third party libraries that might or might not matter in you implementation and should be taken into consideration.

 

Performance

As said before C++ is able to produce code with great performance, but it comes at a cost – knowledge of the language. Without knowledge of C++ your app could easily be draining memory and soon run into OutOfMemoryExceptions.

It’s possible to build fast app in both C# and Javascript but in the end our devices today has so much power that it won’t matter what to choose if you are only building a app that just present some data. But if you are building graphic intense apps or games, there is no choice but to use C++ and DirectX if you want performance.

 

Pros and cons

So what’s the pros and cons of the different options we now have?

It’s impossible to list pros and cons of the languages. Some will say that the garbage collector in C# is an advantage of C# compared to C++ but another might say it is not as they want full control of their objects. Different languages has different set of features that will suit different kind of apps.

Before you start your next project discuss with the team about what language to use in this particular case and set your pros and cons when determining what language to use.

 

What to choose?

First off, neither language are better than another. I would say it depends on what you are developing and who you are as a developer. As a C# developer I would continue with using C# for my apps that I create because that’s where I feel comfortable. If I was a Javascript developer I would be happy to finally be able to develop native apps for Windows Phone in Javascript and continue use that. If I was a C++ developer I would most likely choose C++ as my weapon of choice.

In the end there is so much more that you have to take into consideration when you are choosing what technology you shall use. The experience and skill level of the team, if the team has more experience in Javascript – maybe we should go there instead of C#. If we are building a resource heavy app we might head another direction and pick C++. If we are migrating a website we probably should use Javascript to be able to reuse as much as possible.

 

Summary

I won’t say that any language is better or worse than the other, it depends on what your goals are, how the team looks like and many other things.

But a few thing are sure, now we are able to choose from multiple languages when developing a Windows Phone app and we are able to select the one that will give us the best benefits for our app. It also opens up for more developers to be able to develop native app for Windows Phone as they can develop in their preferred language and utilize the skills they already possesses.