Pros and Cons of Cross-Platform Mobile App Development
The world has gone mobile. It has become a “must have” element for any organization, regardless of its size. Undoubtedly, some organizations can concentrate on only one mobile OS (operating system) and avoid all the other ones, yet it is important for many businesses to focus on a myriad of mobile devices with various operating systems. Gone are those days when you were satisfied with only having a mobile app. Today, it is important that the app must support Android gadgets, iPads, Windows Phone, Amazon Kindle, Tabs, BlackBerry, etc.
One of the most challenging situations for app developers is, whether to develop a native mobile app or go for cross-platform. Of course, as a business, you require dealing with different types of customers who possess different types of devices. Therefore, you'd need to have a mobile app that could work seamlessly on almost all the platforms (i.e. Android, iOS, Windows, etc.)
What are cross-platform apps?
In ideal scenario, cross-platform apps work on multiple operating systems with a single code base. There are 2 types of cross-platform apps:
- Native Cross-Platform Apps
- Hybrid ‘HTML5’ Cross-Platform Apps
Native Cross-Platform Apps
Every major mobile operating system has its own SDK (Software Development Kit) to create mobile apps. These SDKs also have preferred programming languages which are supported by the OS vendor. For example, for iOS, Objective-C and Swift are the preferred programming languages supported by Apple, whereas for Android, Java is the preferred language supported by Google. Generally, apps created with these languages using the official SDK are called as “native apps”.
However, it is possible to use APIs (Application Programming Interface) provided by the native SDK, in other programming languages which are not supported by the OS vendor. This is how “cross-platform” native apps are created. Generally, a third party vendor chooses a programming language and creates a unified API on top of the native SDKs provided by the various OS vendors. Using this unified API, it is possible to support multiple operating systems with a single code base. The third-party vendor generally provides an IDE (Integrated Development Environment) which handles the process of creating the native application bundle for iOS and Android from the single cross-platform codebase.
Since, the final app produced still uses the native APIs, the cross-platform native apps can achieve near native performance without any visible lag to the user.
Current State of Implementation
Though creating cross-platform native applications is possible today, the current state of implementation is far from complete. Most of the mobile apps are heavy on the GUI (Graphical User Interface) implementation side. Almost all the critical business application logic resides on the server which is accessed by the mobile via web services.
Since the User Interface (UI) and User Experience Design (UXD) of iOS and Android are quite different from each other, it’s not an easy task to create a uniform GUI wrapper on top of it. Though Xamarin and others have put in significant work on this front, it is far from perfect. It works well if you design your application to live within the framework’s limitation, however, if you need anything that doesn’t fit with the framework’s vision, it requires a lot of work to implement and requires writing platform specific code. To give you an example, in Xamarin Forms, it takes a lot more work if your designer chooses to give custom colored borders to text fields. As this is not obvious to the designer, once you have settled in on the design, the programming team needs to put in a lot of efforts to pull off this seemingly simple design. Xamarin is working hard to provide more advanced cross-platform UI components under their Xamarin Forms Labs project. But many components of this project are still under beta status.
One popular approach taken in native cross-platform development involves writing business logic and web service calls using cross-platform libraries while GUI related code is written with platform specific libraries. Depending on the application, this can allow 30% to 60% code reuse.
Popular Native Cross-Platform Frameworks
- Xamarin: A California-based software company, which now is backed by Microsoft, founded in 2011. Xamarin uses C# as the main language for the cross-platform development. C# is a statically typed language with mature tooling and IDE support. Also, many big companies have C# programmers already in their in-house IT departments. So, enterprises tend to regard Xamarin as a good investment.
- QT: QT is one of the oldest cross-platform desktop development libraries around, released 21 years ago, in the year 1995. They added support for cross-platform iOS and Android applications in 2013. QT uses C++ along with QML (Qt Meta Language or Qt Modeling Language- it’s a markup language similar to HTML) to create cross-platform applications. However, QT GUI components, by default, don’t follow the look and feel of iOS and Android. Also, C++ is not an easy programming language because of its huge syntax, manual memory management and standards compatibility issues. However, in the hands of experienced C++ programmers, QT can be quite productive.
- RubyMotion: RubyMotion is the main language for the development. One of the early players in this domain. When first announced in 2012, it was for iOS only, but supports both iOS and Android, since 2014. Rubymotion requires separate GUI code for iOS and Android, however, business logic can be reused across-platforms.
Hybrid ‘HTML5’ cross-platform Apps
Mobile apps are essentially GUI applications. Most mobile apps depend on backend web services for large parts of their business logic. Roughly speaking, in mobile apps, especially in the business process automation domain, almost 60% of the code deals with creating and managing the GUI.
The image below shows the architecture of a typical hybrid application:
Cordova / PhoneGap
Apache Cordova which was originally named as PhoneGap (launched in early 2009) is the most popular hybrid cross-platform framework. It supports most of the major modern smartphone operating systems. Since in hybrid cross-platform frameworks HTML and CSS are used to create GUI, almost all of it can be used across different operating systems. With libraries like framework7 (http://framework7.io/) it is also possible to support the underlying operating system's default look and feel using CSS-based themes.
The image below which will help to put all the mobile app development options in single perspective:
To summarize, here are the pros and cons of the cross-platform mobile app development:
Pros of cross-platform mobile app development
- With careful planning around 50%-80% code reuse can be realized across-platforms. This results in faster development and reduced costs.
- Cross-platform development provides more benefits during the maintenance period. If a bug is found in a common codebase it needs to be fixed only once.
- Unit tests are required to be written only once for the common code, hence the saved budget can be used to write more thorough unit tests.
- It is possible to use existing programming talent rather than learning platform specific development language.
- Ideal for B2B apps and business process automation apps, where time to deployment and efficient utilization of resources is more important than sleek look and feel.
Cons of cross-platform mobile app development
- In general, phones are not as powerful as desktops when it comes to raw processing power. Many mid-level and entry level phones don’t have enough hardware power to perform smooth HTML5 animations. Because of this HTML5 hybrid apps can lead to sluggish UI on low and mid range phones. Also since browser components have evolved with the operating systems, it’s relatively painful to support operating systems which are more than three years old.
- Rendering modern HTML and CSS which uses advanced features like gradients requires a lot of CPU and GPU resources. Thus, HTML5 based apps consume significantly more battery compared to native apps or native cross-platform applications.
- Usually, HTML5 hybrid apps depend on callback-style programming to communicate with native plugins, which makes the code unnecessarily complicated. Also for some tasks, this might lead to impractically slow solutions.
- Native cross-platform app SDKs are not mature yet. GUI needs to be coded multiple times to obtain platform specific look and feel.
- Many successful apps are developed as native apps (either Android or iOS) because designing and building an app for multiple platforms with platform-specific user experience is too difficult. This is due to all platforms defining their own human interface guidelines and supporting them with a single code base turns out to be very challenging.
- Mobile operating systems are evolving at a very rapid rate. Every year there are more and more features being added. This creates more work for the cross-platform SDK vendors who need to bring out new versions of their SDK within a short time after the release of a new operating system version. Sometimes, it also requires a lot of work on the developer’s part to upgrade an app to newer versions of the cross-platform SDK.
To conclude this in one line, even though native app development offers 100% platform compatibility and smooth performance, for B2B solutions and for business process automation projects, native cross-platform or HTML5 hybrid application development techniques can offer good enough performance in a more cost effective manner.
About the Author
Ritesh Patil is the co-founder of Mobisoft Infotech that helps startups and enterprises in mobile technology. He loves technology, especially mobile technology. He’s an avid blogger and writes on mobile application. He works in a leading android development company with skilled android app developers that has developed innovative mobile applications across various fields such as Finance, Insurance, Health, Entertainment, Productivity, Social Causes, Education, Taxi development and much more and has bagged numerous awards for the same.
In the move to mobile people forgot the other approach
QT effectively takes this route as well and has proven some of it's abilities.
To all reading this, it's got wrong info
React Native not on the list?
Re: To all reading this, it's got wrong info
To create custom components most of the times, one needs to write platform specific code (It is possible to write platform specific code in C#, but that doesn't mean it's reusable on both platforms). We did a social network type of app with Xamarin. The app had a lot of custom UI components, the code reuse we saw in that app was only 50-60%. For B2B apps and in house business process management apps, Xamarin is good. How much code reuse is possible, depends on the UI design and the type of the app you are developing.
Re: React Native not on the list?
Thank you for letting us know. Soon I will update in the post.
Re: To all reading this, it's got wrong info
I agree with Ritesh's comments, but would add that we use Xamarin.Android and Xamarin.iOS for B2C apps so that we have absolute control of the UI. Xamarin's SDKs provide 100% coverage of the platform SDKs.
Using an MVVM framework such a MVVMCross has helped us achieve code sharing of 80% across the two apps.
Re: React Native not on the list?
The Qt framework
Measuring Pros & Cons of Cross-Platform
I wish the confusion will be resolved after looking at this article. Xamarin is an all time great platform along with PhoneGap which I feel is rightly mentioned in this article.
Thanks for a great post.