Blog

On 17 January 2017

Xamarin vs Apache Cordova: Which One Is Better?

0

Too often in life the good is the enemy of the best. Instead of seeking to know the best choice from the good ones, people tend to settle for making things merely good. So, what is ‘the good’ and what is ‘the best’ when it comes to choosing the most suitable cross-platform mobile app framework? There might not be a definite answer, as it all depends on your specific application requirements along with many other factors, like budget, timing, purpose, etc. Yet, two of the most popular mobile tech stacks – Xamarin and Apache Cordova – should be given serious thought before any decision is made. (There’s also been quite a lot of buzz around React Native lately, a rising rock star in multiplatform mobile development, and it’s definitely worth the hype. Just stay tuned for our blog updates!).

So, what do these two cross-platform environments have to offer? How do they even compare? Here’s our take on the differences between Xamarin and Apache Cordova and the benefits that each solution brings to the table.

Apache Cordova (also known as PhoneGap, which is the most widespread distribution of Cordova) is an open source solution for building apps using standard web technologies (HTML5, CSS and JavaScript) for cross-platform development. With Xamarin, apps are written entirely in C# (and XML for markup and styling), sharing code on all major platforms. What’s noteworthy is that last year Microsoft announced acquisition of Xamarin as well as their decision to go open source. Xamarin tools and code are now available free of charge, though for non-commercial use only. There are also several types of licenses you can choose from to best suit your business’s needs.

Now let’s take a look at some of the strengths and weaknesses of each tool. With Cordova, the developer only needs to create one app and it will appear the same on multiple device platforms, which is both a blessing and a curse. While it may be a huge plus if the same UI is desired on all platforms, Cordova loses some of its value for code sharing when the UI is supposed to be different across platforms. By contrast, one of the key advantages of Xamarin, is the ability to generate reusable code – up to 80%. However, the same code-sharing levels in Cordova can be achieved through the power of CSS frameworks.

Xamarin also offers considerably better UX, functionality and performance. It compiles to a native code and grants access to native APIs through C# wrappers, thus making Xamarin apps, if well written, look and feel fully native, much like their native counterparts. Too much of a challenge for Cordova! With all native controls represented, Xamarin is generally believed to be the closest thing to native when no native language is there. It also provides ongoing support for adding new features and making modifications as the underlying native technology changes. It’s quite a toughie to react to constant changes, though Xamarin has been really good at it most of the times.

Although, on the face of it, Xamarin might seem like a silver bullet solution, there is a steep learning curve for programmers (especially newbies to multi-platform mobile development). Along with C# .NET and XML, they also need to be well familiar with the iOS, Android and Windows platforms. Highly trained developers with such a vast skillset are usually not easy to find. So, assuming people on a dev team are fluent in HTML/CSS and JavaScript and need to build a fairly simple app, Cordova proves to be a more viable option. However, if a high performance application is required, Xamarin is a better fit.

What’s actually really great about Apache Cordova is that it has a large community of techies always ready to answer all your questions. The level of interaction and support within Xamarin community does not come even close to that of Cordova, though it is also growing fast, almost exponentially.

Let’s delve deeper and compare these two side by side.

Xamarin vs Apache Cordova Comparison

Criteria

Xamarin

Apache Cordova/PhoneGap

Language

C#, XML

HTML5/CSS, JavaScript

Platform support

iOS, Android, Windows Phone

iOS, Android,,Windows Phone, Blackberry

Opensource

Community licence
Free for non-commercial use
Professional and Enterprise licences for businesses
Fast-growing community

Free to use
Large community for support (Github, Stack overflow)
Lots of plugins available

Developer skillset needed

C# .NET, XML + iOS, Android and Windows platforms

HTML/CSS, JavaScript

UI

Native UI
Ability to create individual UI for different platforms
Applications capture the correct look and feel for each platform
All native features are supported and can be implemented
More responsive UI

No native look for different platforms
Capturing the correct look and feel for each platform requires extra work
Plugins available

Code sharing

High – reusable code up to 80%

High – if UI is the same on all platforms
If UI is different across platforms, the same 80% can be easily achieved using CSS frameworks

Multithreading is possible using plugins or Objective C/Java to make parallel execution
Large lists or grids render slow

Native performance

Stable high performance on iOS, Android and WinPhone devices, if implemented correctly

May be slow on older Android devices and iPhone 4, but, if implemented correctly, high on new devices

Access to Device API

Full

Full (using plugins)

Execution speed on the device

High speed launching

Long initial app startup time

By sharing our brief insights into Xamarin vs Apache Cordova comparison, we have just scratched the surface – there’s so much more to it. What really matters here is the awareness that the best tool is the one that best serves the purpose of your project. Neither is perfect. Neither is a wrong choice. Each has its own share of features and support. It’s just that one alternative may be better than the other depending on your specific situation, application requirements, budget, time to market and many other variables.