It’s 2017, and arguably the biggest fight after “iOS vs Android” is “Native vs Cross platform app development”. And it is showing no signs of slowing down. Many big organisations like Google, Facebook, Airbnb, Skype have already built their applications on a hybrid platform such as React Native, and Xamarin.
Cross platform solutions are either oversold or an under sold in most cases and many developers and entrepreneurs even fail to make informed decision. So, here’s our take on the current state of cross platform solutions.
What is cross platform app?
In the most simple terms, each platform recommends a specific language to build your apps – For Android it is Java, and for iOS it is Objective -C. When an app is not written in a platform recommended language and runs on multiple platforms, it is called a cross-platform application.
React Native bring us the opportunity to build apps that feel native without using native code. React native also brings some limited support for Swift on Apple devices, but more support is likely to be slow for the following reasons:
- Swift API is currently unstable, and Apple makes major breaking changes in every release.
- Swift runtime doesn’t ships with iOS, so it needs to be embedded within each application which significantly bloats app’s size.
The main focus of React Native’s team currently is on improving app performance, that being said the current performance won’t be an issue for the majority of apps built on top of it. React native also updates frequently, which is kind of both good and bad thing for developers. For some it brings the news of fixed patches they requested, for others they need to match their existing code with the newly pushed changes.
Kotlin is a statically typed programming language developed by JetBrains, the team behind World’s most popular IDEs. In case, you’re wondering — Statically typed languages are faster because they check and validate the codes at compile-time rather than at run-time.
Kotlin has a multi-OS engine and a cross-platform serialization library, which increase the code shareability. Moreover, the multi-OS engine allows developers to build cross-platform applications for Android, and iOS using Java.
Why Kotlin is better than whatever language you’re using:
Kotlin is concise
The developers coming from a Native(Java) background can understand how many boilerplate codes they had been dealing with. For instance, just look at their extension.
Java had a four-letter extension(.java) when most of the languages keep it to only three letters.
Kotline takes it further and reduces it only two letters(.kt). Boilerplate codes not only slow the performance but add additional load in the runtime.
Pinterest have used Kotlin in their application, and one of their engineers said:
Went back and removed all my for loops. Really liking changed operations (firstOrNull) with an expression brought down one of our models from 115 to 54 lines and I would argue it’s a lot easier now what the class is doing.
Kotlin has an upper hand with its 100% interoperability with Java. The developers have the privilege to use any frameworks, or Native libraries that they want.
Coding error safety
Every once in awhile, the developer gets frustrated with common programming errors like null pointers and other syntax errors. With Kotlin, if you are not sure about a syntax or null function, then put a ? at the end, and it will return a default value when found the thing.
For Instance, if you’re making a server call to get some data, and the function couldn’t execute, then Kotin will use a default instead of showing an error.
Kotlin wasn’t just built on academic theories. But to solve real problems of modern developers who are working with large databases, and complex architectural applications.
Many startups including Pinterest, Evernote have already integrated Kotlin in their applications. And we are going to see a much more rapid adoption in the coming years.
Flutter is a UI framework based on Dart, developed and maintained by Google. Fluther is definitely promising with its React Inspired development model and native-like UI for pixel perfect design.
With Flutter, you can do fast iterations and instant UI updates with hot reloading. The architecture is far superior to React Native, which allows developers to put everything in a single codebase and build a high performing application.
Aside from other languages, Flutter promises to be a more interesting framework for developers, as it allows to write apps for ios, Android, and the new unreleased OS, Fuchsia by Google.
At this moment, we are not sure about Google plans, but what if Google replaces Android with Fuchsia, and put Flutter as its app development framework.
However, Here are few things about Flutter that’s promising:
- You can build anything on the UI side, that means it’s highly customizable. You have not limited to OEMs widget anymore.
- Flutter is blazing fast, and use a single codebase for both Android and iOS.
- Java codes can be copied and run in Dart Framework without any complexity. It gives you more Native flexibility.
- Flutter has built-in native ios widgets, which drastically reduces the engineering burden.
Kotlin vs Flutter vs React Native
|Community and Support||Backed by JetBrains||Backed by Google||Backed by Facebook|
|Platform Support||Android, iOS(coming soon) with its multi-os engine||Android, iOS, and Fuchsia||Android, iOS, and Windows|
|UI||Native UI widgets, and libraries are supported.||In-built UI widgets, and library support.||Native UI support through adoptive|
|Native features Support||Direct access to Native features.||Mostly supported||Through binding or Native wrappers|
|Security||It supports most of the security implementations of Android.||Authentication, and authorization supported along with oAuth for social logins.||Authentication, and oAuth 2.0 supported.|
|Licensing||Open source(Apache 2.0 license)||Open Source||Open Source|
Xamarin app development
Xamarin is said to be the closest thing to Native when you are not using any native language. People love Xamarin and it has evolved as one of the most successful cross-platform solutions today.
Some common myths about Xamarin are:
- It’s buggy – Xamarin isn’t full of bugs as many reports. Often these reports are a result of a code optimized for local values. To deal with any uncaught expressions, Xamarin allows stack trace with the number line.
- Xamarin.Forms == Xamarin. Actually, Xamarin.Forms != Xamarin. There’s a flying misconception about Xamarin Forms as being the primary UI library for building apps. Xamarin facilitates a more comprehensive set of libraries to build native UI codes.
- Xamarin doesn’t cover many native features. Xamarin actually covers almost 100% of the native APIs and provide access to almost all native features.
- Limited documentation – Xamarin actually has a complete set of documentation with 300 example apps to help you.
Xamarin is not just a FAD, it’s a real thing, so what’s bad about it? Well, there’s a serious concern about memory management stemming from a disposable C# wrapper around native objects.
Which brings us to the question “When should one use Xamarin?”.
The first and most obvious case for using Xamarin is when you are low on resources and you still wish to publish on all major platforms. Secondly, if you are developing a Windows app it does makes a lot of sense to use Xamarin, it works seamlessly with Windows ecosystems.
Lastly, if your business is already using Microsoft based technologies, using Xamarin could bring in a lot of ease.
Cordova and PhoneGap
PhoneGap is an Adobe-owned cross-platform solution that helps developers to launch their apps on all platform. PhoneGap runs on top of Apache Cordova. Most of the developers using HTML5 apps are now utilizing the Ionic framework to get performance focused and well-designed components. Ionic relies on Angular-JS and Sass and provides UI components that you can use in your apps, reducing any need for to optimize UI in most cases.
Most of the problems that developers face arise from the fact that they are either using 3rd party libraries or are doing things synchronously instead of doing it asynchronously.
The thing about using these two platforms is that a developer should try to do his best, otherwise he would end up with an app that has choppy and slow animations. And while testing code on computer browsers seems okay, the code would not perform comparably on real mobile devices.
While there has been some support for Apple Watch and Android Gear, PhoneGap and Cordova clearly doesn’t fit properly for this wearables right now.
Cross-platform vs native apps performance comparison
The following charts sum up the performance of some of these cross-platform computing tools.
Performance of Xamarin vs Java on Android.
The results below illustrate cross platform vs native code performance.
Run J2ObjC J2ObjC/ARC Swift 1.1 Swift 1.2 Swift 1.1/J2ObjC Swift 1.2/J2ObjC Xamarin RoboVM RubyMotion 1 0.676 1.047 2.704 1.003 1.310 0.906 1.164 0.712 20.732 2 0685 1.049 2.801 1.009 1.193 0.878 0.662 0.707 21.856 3 0.682 1.006 2.686 1.014 1.203 0.871 0.476 0.705 21.435 4 0.681 1.008 2.684 1.005 1.194 0.870 1.378 0.695 21.111 5 0.677 0.968 2.692 1.008 1.195 0.874 0.983 0.711 21.651 6 0.676 0.958 2.683 1.000 1.197 0.871 1.189 0.709 20.929 7 0.681 0.977 2.684 1.009 1.201 0.870 0.954 0.700 22.189 8 0.673 1.022 2.681 1.004 1.197 0.869 1.182 0.710 21.275 9 0.674 0.953 2.680 1.004 1.196 0.870 0.813 0.699 21.100 10 0.687 0.956 2.684 1.002 1.195 0.900 0.813 0.698 21.825 Average 0.679 0.994 2.698 1.006 1.208 0.878 1.015 0.705 21.810
An enterprise’s best friend – Cross-platform apps
Imagine an enterprise whose mobile strategy is web and mobile only, they are an iOS-focused organization. Two years later they re-assess their mobility needs and find that cost-effective Android handsets could bring a lot more savings. They look into the costs of porting their iOS apps to Android which brings additional costs. Now as you can imagine a native app would mean a lot of lost opportunities in this case, while having a cross-platform based app would allow them the flexibility of easy migration to Android, thereby being truly beneficial.
Best Multi-Platform apps running on these solutions
- React native app – Discovery VR
- Apps using Xamarin – Down JonesWatch(iOS) and Trello
- PhoneGap based app – Pacifica
And there’s the “But”!
But when cross-platform apps are this awesome, Is there a need for this discussion?
Well, apart from the performance, costs, and availability a true mobile strategy requires much more to be successful. Other significant parts of a successful mobile strategy include:
- User experience
- Frequency of updates
- SDK Integration
- Other situational parameters
We will now discuss these one at a time.
No doubt that you can develop and replicate almost any user interface, but how well that UI performs is very important. A user perceives a system that has a response time of 0.1 seconds as a responsive and continuous system. Third party development platforms do suffer from this issue of Jank or Lag.
The frequency of updates
With each release of a feature in mobile phones and wearables, the cross-platform tools always find themselves chasing deadlines and fixing a number of bugs. Which could be a huge missed opportunity. As it often takes days if not months to come up with a solution, let alone a perfect one.
Often underlooked on mobile strategies, especially by small developers, it is one of the most important parts of your future mobile growth. Often many cross-platform solutions are way too immature to accept or to bind with the new SDKs. We have often seen cases when the entire app had to be redeveloped natively to allow growth critical SDKs to be integrated with them.
Both native and cross-platform apps have their own type of security concerns. But native app development provides us the opportunity to bring more and more natively built solutions that could make the work of attacker comparatively very difficult. More specifically when cross-platform apps are coded by a Rookie, they are more prone to JS injections, weak SSL implementations, and caching issues.
We have no multithreading on the hybrid app development platforms, which is always an option when you are doing native app development. Some solutions like Titanium allows multi-threading and some don’t.
Cross-platform solutions are very good for what they are made. But when you face a complex problem that hasn’t been solved yet, going native is the preferred way. You cannot bet on wrappers to accomplish what a native code can when it comes to complexities
While these are just some of the factors that should be considered before selecting a cross-platform technology, but many of them are unique that requires close inspection. For example, if the OEM’s brought in some changes that would render a particular cross-platform solution unsuitable.
What does 2018 hold for cross-platform application development?
Apple has already released Swift 4, which holds great promises for the developer community. Google’s Flutter is still in Alpha, and we are not too sure about them releasing it next year.
Aside from some performance issues, React Native and Xamarin offers excellent code sharability, faster shipping time, third-party libraries, and Native UI components to build scalable hybrid applications.
Ionic, on the other hand, is still immature, and not suitable for Enterprises.