Mobile App Development: Native vs. Hybrid
The debate between Native and Hybrid application development still rages on between cost and superior performance. In this article we take a fresh look at the discussion in 2016.
Join the DZone community and get the full member experience.Join For Free
Developing your mobile application for multiple platforms is a process involving many trade-offs. While writing your application as a pure web app using HTML5 or similar technology is a quick-and-easy way to gain superficial cross-platform support, it doesn’t allow you to leverage native functionality to create a device-consistent user experience. Below we’ll look at two ways of adding native support to your application—hybrid and native development—and evaluate how to choose which is right for your application.
Native applications, as the name suggests, are applications with code developed for each relevant platform. Applications for Android devices have their code written in Java, while iOS apps have their code written in Objective C or Swift, as appropriate. By using the native libraries and device APIs, you get full access to each platform’s functionality. Additionally, as the application code is developed in the languages expected by the platform, the resultant applications can be more highly optimized and, as a result, more performance while also leveraging the latest and greatest features available on each device.
However, one of the major pitfalls of native-first development is the complexity of the development itself. While you can use tools like NativeScript or React Native to get a fairly reliable cross-platform development environment, these libraries by their nature are somewhat restricted in terms of the functionality that can be exposed. This means that at some point, you’ll be faced with the single largest detriment to native-first development: having the same logic in multiple programming languages being delivered to separate platforms. Maintaining feature parity in this type of environment can be challenging, and requires some level of specialization amongst your developers that may result in higher development cost and lower productivity.
Hybrid applications, as opposed to their native counterparts, focus on trying to create a coherent development environment that minimizes the specialization necessary while still leaving developers the option of diving into native code for specific portions of an application that need either enhanced performance or expanded feature set of the native libraries. Hybrid applications can be developed in a number of ways—either with a custom hybrid framework that provides the context in which shared code operates (such as putting application logic into web views, as opposed to native device components), or with a tool such as Ionic, allowing you to truly write platform-independent applications. This allows most of the code—and almost all of the critical business logic—of an application to be written in a single place, then adapted to any new platforms desired quickly.
Hybrid applications tend to fall short when it comes to pure performance. Due to the nature of Hybrid applications focusing on cross-platform functionality, optimizing code for things like execution speed and library usage is complex, where it is possible at all. It’s possible to expand an application by adding platform-specific components into the hybrid application itself, but that relies on introducing potentially fragile integrations between native and non-native components, somewhat increasing application complexity.
Comparing the Two
The most important thing to use as a criterion for choosing between either Native or Hybrid development is the end goal of your application. If blazing fast speed and performance is a goal, then Native wins hands-down. However, outside of a few specific applications such as graphics rendering and other processor-intensive applications, the vast majority of applications simply won’t need this kind of performance—optimizing a native function to save 10 milliseconds of execution time will pale in comparison to the server calls surrounding it that take in excess of 100 milliseconds to fetch data from the application’s back-end over the web.
In those cases, the performance benefits of a native implementation are effectively nullified. This means that, unless you have a need for your application to be as close to the metal as possible in terms of performance, the primary concern of which approach to take should likely hinge upon the potential throughput of your development team on a given platform. With this in mind, given that specializing in multiple languages can fracture your organization’s development expertise and reduce overall productivity of your team, the vast majority of mobile apps – and particularly those with a significant web-based component – would greatly benefit from a Hybrid-development approach.
The choice between hybrid and native development ultimately comes down to one question: Is application speed or developer throughput your primary goal? While Native applications can be written to be a lot more performant than their hybrid cousins, these speed gains can be effectively negated due to the I/O costs of interacting with an application server or a remote database. Thus, while there are many cases where Native development is the right choice, if your application is focused on communicating with remote servers, Hybrid development will often be the best choice for your cross-platform application.
Get a free backend-as-a-service for your Angular and React mobile applications with Backand.
Published at DZone with permission of Itay Herskovits, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.