insanelab.com insanelab.com

March 16, 2017 - Mobile Development

Why is Xamarin Vs. Cordova the Wrong Question to Ask?

by Antoni Żółciak
More by this author

Cross-platform development is incredibly popular today as application developers seek to gain access to the largest user-base they possibly can. Solutions like Xamarin or Cordova are one way to do it – but while on paper they seem similar, in reality, they’re not.

“Native” is a term that’s being tossed around much lately.

“Cross-platform”, on the other hand, is overvalued in our minds.

You surely can do an app in a cross-platform approach, but will it be sufficient in terms of performance? Will the user interface be polished and neat?

Or will it be something that just serves as a placeholder?

Let’s find out.

Here’s what you’ll learn from this article

  • Xamarin is basically native
  • Cordova is something for quick and easy app development
  • Xamarin requires .NET, Android, MacOS, and iOS knowledge
  • Cordova is perfect for teams familiar with front-end development
  • Xamarin has Test Cloud (which is amazing)
  • Xamarin can be used for both startups and enterprise
  • Cordova is more of a MVP-suitable environment

The reason we’re even writing about this is that we came across a thread on Quora titled Which one is better: Xamarin or Apache Cordova?.

This is interesting, since – as pointed out by Keith Rome on the forum – the correct answer depends upon your specific application requirements.

Find out more about Xamarin!

At Insane Lab, we think that Cordova is simply not enoughwhen it comes to mobile development.

We believe that if you want to build an app, it’s best to do it properly. A proper workaround for the cost/quality ratio would be to invest in Progressive Web Apps.

Quoting CSSReflex, “if you feel you will attract users mainly through an original idea and not complexity, or if you need to quickly deliver a temporary version of your project to the market – feel free to go for Cordova.”

But hey, I don’t want to say that it’s useless. Absolutely not. It’s simply a matter of finding the right solution for your needs.

Xamarin, on the other hand, is much more versatile, better in terms of performance, responsiveness, and looks. It’s the closest thing to native.

Okay, so how exactly does Xamarin compare to Cordova?

It is far easier to build applications on Cordova as the developer only needs knowledge of HTML/CSS and JavaScript – unlike the advanced skill set required for Xamarin.

There is a steep learning curve for Xamarin programmers as the applications built on the platform are typically far more complex and capable.

What’s worth pointing out is that nowadays both the environments are open source.

Yep, Xamarin is open-sourced as well, but only for non-commercial use. Developers require a community license for Xamarin, and businesses, like ourselves, require enterprise and professional licenses.

There is, though, a commercial license for small dev teams.

Applications developed on Xamarin are superior as they offer substantially better performance, UX, UI, and functionality. Xamarin replicates native performance via its C# wrappers, and the platform is the closest you can get to native through a cross-platform environment.

With the source code, developers can create radically different interfaces for different platforms, and Cordova does not even come close to such native-level performance.

Also, the user interface is far more responsive on Xamarin applications. What’s more, Xamarin provides an extensive degree of hardware support. Developers can write new features and make changes with ease.

Cordova applications share one UI across platforms. You can have different UIs across platforms, but this only serves to decrease performance and the value of code sharing, so it is almost never recommended.

You can reuse up to 80% of the source code on Xamarin, and you can achieve a higher re-usability percentage on Cordova if the UI is the same across platforms.

If the UI differs across platforms, developers will need to use CSS frameworks to reuse the source code, and the levels of re-usability achieved are similar to Xamarin.

All good, but what should you go for as a business?

On the face of it, Xamarin is one of the very few platforms that are capable of delivering on the promise of cross-platform application development. Developers are capable of creating better software than is possible through Cordova.

Xamarin apps will provide a stable degree of high performance on all devices irrespective of the version of Android, Windows Phone, or iOS whereas Cordova equivalents are considerably slower on older Android and iOS models.

With that said, Cordova is useful for companies and developers working on tight budgets. It’s also worth to check out PWAs as an alternative.

To put in a plain language, Cordova gives you the ability to make simple apps fast. If your team is more oriented in the front-end development, Cordova will be a good choice.

But…

Cordova is not native. Period

Xamarin is perfect for companies that seek native-level performance while decreasing the associated development and maintenance costs.

The tech is surpassing any hybrid mobile development tool available today, and Xamarin is recommended for enterprise mobile solutions where the core logic can be easily shared across platforms.

In addition, the continued development of Xamarin.Forms will provide an even finer performance in the near future and allow developers to reuse up to 96% of the source code.

Plus, with Xamarin.Forms, the time to market will be similar to native iOS and Android apps. They can also be used for prototyping and applying for simple MVPs.

Still, we’re not using .Forms just yet. While the idea itself is brilliant, the technology is not mature enough. “We kept the native front-ends approach”, our Xamarin team explained in this article. “It takes more time and effort to develop, but the end result is bulletproof.”

But you know what? As community support grows for Xamarin, and the idea itself becomes more widespread, the idea of .Forms might have a chance of dominating the market completely.

True cross-platform mobile development

Let’s take it step by step.

Both Xamarin and Cordova possess unique features, and they offer differing levels of functionality and performance based on application requirements.

Xamarin is one such cross-platform development tool that has its origins in the .NET and Mono frameworks.

Mono is for Linux what .NET is for Windows, and Miguel de Icaza, the founder of Mono, is one of the individuals who also came up with the idea for Xamarin.

In order to develop an application with Xamarin, one must possess knowledge of Xamarin, C#, IDE, Android platform, iOS platform, and all the app models on both platforms.

As of now, Xamarin’s three main commercial offerings are:

  • Xamarin.iOS
  • Xamarin.MacOS
  • Xamarin.Android.

All of these services are written on top of the open-sourced Mono which runs smoothly on every conceivable platform.

The utilization of runtime is critical to the success of Xamarin applications on Mac, iOS, and Android. This allows for:

  • Memory allocation
  • Underlying platform interoperability
  • Waste collection
  • Mobile cross platform assistance
  • Access to the massive base class library (BCL)
  • Modern language constructs
  • Complete integration of all the underlying SDKs in Windows, Android, and iOS.

What, exactly, is Xamarin?

It’s something that we love.

Something that we trust will help us to build an even better company.

Something that, as .NET developers, are really happy to have in our arsenal.

It’s a mobile application development environment that basically consists of native SDK and C# libraries wrapped in the .NET layer.

Any program that is written using the .NET framework can be executed in a common language runtime environment. This shared code typically involves business logic, data access, and network communication. The applications developed on Xamarin are essentially built on this trifecta.

To develop apps based on Xamarin, developers require at least an Apple Macintosh running on OS X Yosemite. This is if you require an iOS or Mac OS application as irrespective of IDE you need a Macintosh.

Xamarin applications are completely written in C#. Xamarin.iOS requires the iOS SDK and Xcode for applications. You will need Xcode so you can download iOS SDK.

With Microsoft’s purchase of Xamarin in early 2016, the platform went open source albeit for non-commercial use. It was at Build 2016 that Microsoft announced Xamarin Software Development Kit would be open-source, and that it would be available with Visual Studio.

Xamarin compiles to a native code, and it grants access to native APIs via the C# wrappers. This is what provides applications developed on Xamarin with a near complete native look.

It’s the closest thing you can get to native without compromising on performance, UX, and functionality. As of now, native languages are still superiors, but advances in Xamarin will render this minute difference irrelevant in the very near future.

Xamarin speeds up the development process, saves you up money, and delivers on the quality

Suppose you need applications for iOS, Android, and Windows. If you use the conservative approach such as Swift or Java, you will need to write and develop three distinct applications from the ground up.

Xamarin for Visual Studio allows you to build a common base for all the three platforms as it creates a standard technology stack that can be coded for all platforms.

Originally, we illustrated it here. I’ll post the graphic below; those of you who have already seen it, forgive me.

Now, this source code can speed up the development process, and it does not require the user to switch between development environment as it functions with IDE as well.

It is claimed that nearly 90% of the source code can be reused with Xamarin.Forms, but this is still some ways away. As of now, it is believed that up to 80% of the base source code can be reused.

With Xamarin, businesses and developers can save up to two-thirds of their application development and maintenance budget. Once the base has been built on Xamarin, the applications for different platforms can be customized by using platform specific-UI elements.

One of the most critical advantages of Xamarin is that it can take advantage of Java Android and Objective-C libraries, and the integration of Swift libraries is an ongoing process.

This is a huge deal as some of the most important native components are already integrated with Xamarin, further boosting functionality and performance.

In addition, Xamarin.Forms is based on the concept of using XAML to develop a single, unified user interface that can be directly translated into three native user interfaces.

However, the functionality has not been completely developed as yet, but once it is, there will be no need to use the native front-ends approach.

The Xamarin Test Cloud revolution

Did you hear about a company called Slack? They, for one, are using the Xamarin Test Cloud.

What’s so great about Test Cloud is that it allows you to automate your app testing on 2,000 real devices in the cloud. The team at Xamarin gathered a collection of real devices from around the world. You can select the one you want based on the form factor, manufacturer, operating system, or even popularity in your target market.

Monthly, Xamarin is adding over 100 devices to its libraries. For more technical details please head over here.

How does Xamarin compare to native?

The performance of cross-platform applications is already similar to those of Swift for iOS and Java for Android, even for high-performance applications.

With Xamarin, the developer can create a near perfect app using the different UI elements of each platform.

The Xamarin.Forms tool can convert application UI components to the platform-specific UX elements when the application is running. This abstraction layer causes a small drop in performance when compared to native, but this line is constantly decreasing.

Something worth pointing out – at Insane Lab, we’re sticking to the native UIs for each platform.

However, there is no drop in hardware support. Through Xamarin, your application will receive native-level functionality without any hardware compatibility problems.

The platform uses specific plugins and APIs to function smoothly across platforms as the interface allows the application to link up with native libraries. This allows the application to enjoy native-level performance and functionality.

If you want native, go for Xamarin

In the end, it’s about going for what you know. If the team at your disposal is skillful at web development but not really familiar mobile app development, choose Cordova.

While it won’t be as high-performing as apps made with Xamarin, it will be a start.

If you work with a bunch of .NET devs, then by all means, go for Xamarin. When executed properly, it doesn’t differ from native applications.

You’ll see.

What is your challenge?

Tell us with any means provided. We'd love to hear from you!