Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Should You Develop Native Cross-Platform Mobile Apps?

DZone's Guide to

Should You Develop Native Cross-Platform Mobile Apps?

Learn why there are so many advantages to developing cross-platform applications, and the most popular frameworks to help get you started.

· Mobile Zone ·
Free Resource

The days when users were satisfied with only owning a single device are long gone. Today, businesses that invest in mobile applications need to think about countless mobile devices with different OS. If you want a seat at the table, your mobile application needs to support iPhones, Android phones, iPads and various other tablets, Windows Phone, Amazon Kindle, etc.

When asked for advice, developers are faced with a dilemma: developing a native mobile app or going cross-platform? The answer is not only up to them. Businesses know which type of device their customers are used to, and are ready to invest in a mobile app that needs to run smoothly in the world where Android and iOS dominate the market. However, developers can recommend one or the other, and we've outlined the benefits for both.

Image title

Introducing Cross-Platform Apps

Ideally, cross-platform apps function on multiple OS's with a single code base. We distinguish two types of these apps: Native and Hybrid "HTML5" cross-platform apps.

Creating Native Cross-Platform Applications

Big mobile OSs have their own SDKs for creating mobile apps. These Software Development Kits state their preferred programming languages. For example, for iOS, the languages supported by Apple are Objective-C and Swift, Swift being the most popular one. When it comes to Android OS, Java is the way to go, according to Google. Mobile applications created with these supported languages using the official SDK are referred to as "native apps."

Be that as it may, one can use Application Programming Interface or APIs provided by the native SDK in a different programming language, which the OS doesn't support. This is the idea behind creating cross-platform native apps. A third-party vendor selects a programming language and produces a unified API over the native SDK. With this API, supporting other OS with a single code base is possible. This vendor provides an Integrated Development Environment, an IDE which controls the process of producing the native app bundle for Android and iOS from the single cross-platform codebase.

As the app produced still utilizes the native APIs, the cross-platform native apps can attain near-native performance.

The State of Implementation Today

Although creating these applications is fairly easy, the state of implementation is not complete. Many mobile apps are heavy on Graphical User Interface (GUI) implementation side. Having in mind that the UI (User Interface) and UXD (User Interface Design) differ for both Android and iOS, it's a challenging task to create a uniform GUI. An application designed to work within the framework with all its limits will be successful, however, anything that doesn't fit will require additional hard work in writing platform-specific code.

For example, in Xamarin forms, a simple change such as custom colored borders to text field requires additional coding work. Xamarin Labs are working to provide better cross-platform UI components, and they just might do that by the time you're reading this article.

There is a very popular approach which involves writing web service calls and business logic using cross-platform libraries and writing GUI related code with platform-specific libraries. This allows for a higher percentage of the code to be reused.

The Most Used Native Cross-Platform Frameworks

Appcelerator Titanium: As of today, this open-source framework has over 950 000 registered users who enjoy using its cross-platform API for UI components such as menus, navigation bars, and dialog boxes, but also native device functionalities such as the network, accelerometer, geolocation, and maps. It uses JavaScript as the main language for development. In its beginnings, it had issues that might have influenced its adoption. However, after being acquired by Axway it became a global software company, present in over 100 countries around the world and since then, the Indie plans are free, including native API access with Appcelerator Hyperloop.

Xamarin: Xamarin has been under the ownership of Microsoft since 2016. The platform prefers C# as a language for development and since many large companies have in-house C# programmers they tend to favor Xamarin as a great investment.

NativeScript: Since 2014, Native Script, launched by Telerik who was already well known for its suite of GUI components for enterprise applications, has made web-like programming available to app developers. Its main language is JavaScript, but it supports Angular, TypeScript, and CSS for styling. Even though it's relatively new it has a lot of potential, especially since they expanded into AR.

Why You Should Develop Cross-Platform Mobile Apps

  • Reusable code - Rough estimates are that around 70% of the code can be reused across-platforms.

  • Easier maintenance - If a bug appears in the common codebase, once it's fixed, it's fixed everywhere.

  • Budgeting - Since unit tests only need to be written once for the common code, the budget can be saved and repurposed to writing detailed unit tests. Maybe even practice test-driven development.

  • Availability - It's possible to use existing in-house developers rather than acquiring new talent.

  • Speed - Cross-platform apps are ideal for B2B use cases where time to deployment and use of resources are more important than sleek design.

Some Cons to Take Into Consideration

Native cross-platform app SDKs are not "there" yet. GUI needs to be re-coded many times to attain platform-specific look and feel.

Creating an app for multiple platforms with requirements for platform-specific UX is challenging. Each of them has defined their own human interface guidelines and it's difficult to support them with a single code base.

Mobile OSs are evolving on a daily basis, with more and more features added each year. This prompts the cross-platform SDK vendors to offer new versions of their SDK shortly after the release of a new Android or iPhone OS version. The app developers then need to work additionally to upgrade the app to newer versions of the SDK.

Is It Worth It?

Yes. Even though native app development is 100% compatible with the platform, ensuring smooth performance, there are use cases where native-cross platform apps can offer adequate performance at a lower price.

Topics:
mobile app development ,mobile ,cross platform ,html5 ,native

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}