Hybrid or NativeScript—Choosing the Path for You

When you create an app in Telerik Platform, you need to choose between hybrid development with Apache Cordova and NativeScript development. Both approaches are cross-platform and build apps for multiple mobile platforms from the same source code. How to make the right choice?

Hybrid: The Breakdown

Origin of the Term

The term hybrid development reflects the nature of this approach—it combines the best characteristics of native and web development. A hybrid mobile app developed with Apache Cordova is basically web code running inside a native webview and wrapped as a native app. Such apps carry more web characteristics than native ones. Typically, hybrid apps have a consistent, responsive web-like user interface and browser-like performance across platforms. Contrary to web apps, hybrid apps can access some native capabilities of the device such as the accelerometer and compass sensors, the camera, the geolocation features and others.

At the core of hybrid mobile apps is the webview—a native minimal chromeless browser. Apache Cordova, the hybrid mobile framework integrated in Telerik Platform, embeds HTML5 code in the webview and then provides an interface to access the native resources on the device via JavaScript code. Out of the box, Apache Cordova provides support for the file system and the basic hardware sensors. With the help of additional plug-ins, developed by the community and Telerik, Apache Cordova greatly expands on the supported device capabilities.


Source: Globetrotter

Hybrid Strengths

The hybrid approach provides multiple benefits.

  • Cross-platform approach: You write one codebase and then build it for for iOS, Android or Windows Phone.
  • Almost complete code reuse: You can easily transform your web app into a mobile app for iOS, Android or Windows Phone.
  • Almost complete skill reuse and a minimal learning curve: If you have JavaScript, HTML and CSS knowledge, you can quickly get on track with Apache Cordova.
  • Reduced development time and cost: Because of the extensive code reuse and the short learning curve, you can quickly reach the production-ready stage of app development.
  • Responsive and consistent user interface across platforms and devices: The web-based user interface ensures responsive behavior and consistent look and feel across all your target platforms.
  • Established development ecosystem with multiple resources: Apache Cordova is a mature open-source framework with great flexibility. The core framework provides access to a limited number of native capabilities but the community has developed a wide range of custom plug-ins to tap into additional device functionalities.
  • Ability to push minor app updates to your users without republishing the entire app: The major mobile platforms allow minor updates to content over the air, as long as these updates do not add or remove contents in the application package and do not modify the original purpose of the app. The Apache Cordova ecosystem already provides a number of services which let you publish such updates to Apache Cordova-based apps. One of these is Telerik AppManager LiveSync.

Hybrid Challenges

Both webviews and Apache Cordova pose a few development challenges for hybrid development.

  • Differences in behavior and performance across devices: Because webviews differ from platform to platform and even from platform version to platform version, you might need to apply additional tweaks and optimizations to your code to ensure that your app runs as expected on all devices.
  • Performance issues with heavy graphics and transitions: Webviews have some issues when processing demanding graphics and transitions (typical of games and other UI-heavy apps).
  • Additional development required for platform-specific user interface or features: To tap into unique platform features, you usually need to write additional code or use a plug-in. In some cases, you might need to create the plug-in yourself.
  • Limited maintenance for custom plug-ins: In many cases, although you might be able to find a plug-in for the feature that you want to implement, this module might be outdated and might require additional development. The Telerik Verified Plugins Marketplace aims to remedy this issue.
  • Slow adoption of new platform versions: When a new mobile platform version becomes available, you need to wait up to a few months before Apache Cordova introduces verified support for the new version and its features.

NativeScript: The Breakdown

Origin of the Name

The name NativeScript reflects the nature of the framework—it lets you create truly native apps using JavaScript. A mobile app developed with NativeScript is basically JavaScript code which is executed on the native mobile platform. Such apps are truly native apps with the performance, user interface and access to device capabilities to match.

At the core of NativeScript mobile apps are the modules and the runtimes. The modules expose the native device capabilities and user interface components via JavaScript code. The runtimes interpret, compile and execute your JavaScript code on the native mobile platform and in addition, let you tap into unique platform APIs from inside your code. Some additional functionality is also available via custom NativeScript plug-ins from npm.


Source: NativeScript Documentation

NativeScript Strengths

The NativeScript approach provides multiple benefits.

  • Cross-platform approach: Most often, you can write one codebase and then build it for iOS or Android. In some cases, when you want to implement platform-specific functionality, you can quickly tweak your code.
  • Great skill reuse and many opportunities to learn: If you have JavaScript, XML and CSS knowledge and some understanding of the native iOS and Android frameworks, you are ready to deepdive into NativeScript. While you implement your app ideas, you will have the opportunity to learn fundamental concepts related to NativeScript and the native frameworks.
  • Native user interface and performance across platforms and devices: Because your apps use native components, they look and behave natively on iOS and Android. If you take advantage of the iOS and Android runtimes, you can even implement unique platform features with minimum effort.
  • Quick access to native libraries: NativeScript provides out-of-the-box support for native libraries, including CocoaPods and Gradle.
  • Open-source development ecosystem: You can shape the present and future of the framework. The NativeScript team accepts feedback and feature requests and greatly welcomes contributions.
  • Day One support for new versions of the platforms: When a new mobile platform version becomes available, the NativeScript quickly provides support for the new version and its features.
  • Ability to push minor app updates to your users without republishing the entire app: The major mobile platforms allow minor updates to content over the air, as long as these updates do not add or remove contents in the application package and do not modify the original purpose of the app. Telerik Platform provides the Telerik AppManager LiveSync service which lets you publish such updates to NativeScript-based apps.

NativeScript Challenges

The main challenge that the NativeScript framework poses is its relatively young age. The community is growing fast but the resources of the ecosystem in terms of additional plug-ins are still limited.

Comparison Between Hybrid and NativeScript Development

Apache Cordova NativeScript
Required skills and knowledge
  • JavaScript
  • HTML
  • CSS
  • JavaScript
  • XML
  • CSS
  • Basic understanding of the native iOS and Android frameworks
Supported devices and platforms
  • Android 2.3.3 and later
  • iOS 5.0 and later
  • Windows Phone 8.0 and 8.1
  • Android 4.2 and later
  • iOS 7.1 and later
User interface Based on web components, relatively consistent across platforms Based on native components, unique across platforms
Performance Browser-like Native
Telerik Platform services
Supported frameworks
  • Kendo UI
  • Ionic
  • JavaScript frameworks which rely on browser APIs
  • Telerik UI for NativeScript
  • JavaScript frameworks which do not rely on browser APIs
  • Android native libraries
  • iOS native libraries and CocoaPods
  • Angular 2
Supported package managers Bower npm
Extensibility model Apache Cordova plugins NativeScript plugins

Conclusion

Hybrid development with Apache Cordova and cross-platform development with NativeScript share much in common.

  • Both frameworks provide extensive code reuse—one source code compiles to apps for various mobile platforms.
  • Both frameworks provide integration with powerful JavaScript frameworks and package managers.
  • Both frameworks are first-class citizens in Telerik Platform.
  • Both frameworks are flexible and can be extended by third-party plug-ins and modules.
  • Both frameworks are open-source and accept contributions.

The hybrid approach is the better choice for you in the following cases.

  • You are a web developer with extensive JavaScript, HTML and CSS knowledge.
  • You want to benefit from an established framework and ecosystem.
  • You want to develop your user interface with Kendo UI or jQuery Mobile.
  • You want to develop your app using Bower packages.
  • You want to reuse your code for an identical web app.
  • You have very tight development deadlines and require a shorter learning curve.
  • Your app must run on Android, iOS and Windows Phone.
  • Your app must run on older and newer devices and operating systems alike.
  • Your app does not require access to many native capabilities of the device.
  • Your app does not rely on top performance. For example: a productivity app.
  • Your app does not rely on consistent user experience and performance across devices.
  • Your app does not rely on platform-specific functionality and user interface.

NativeScript is the better choice for you in the following cases.

  • You are a developer with some JavaScript, XML and CSS knowledge and some understanding of the native iOS and Android frameworks.
  • You want to become an early adopter and contribute to the ecosystem.
  • You want to develop your user interface with Telerik UI for NativeScript.
  • You want to develop your app using npm packages.
  • You have sufficient time for learning and development.
  • Your app must run only on Android and iOS.
  • Your app must run only on newer devices and operating systems.
  • Your app requires access to many native capabilities.
  • Your app relies on top performance. For example: a game.
  • Your app relies on consistent user experience and performance across devices.
  • Your app relies on platform-specific functionality and user interface.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.