Native vs Hybrid

What is Native?

A native application is one which is written using the platform's own language and (most probably) their SDKs. To develop a native Android application, you'd use Java and the Android SDK; to develop for iOS (or OS X for that matter) you'd need to use Swift, a new programming langauge built on top of C and Objective-C.

|              | Android        | Apple |
|--------------|----------------|-------|
| Language     | Java           | Swift |
| Official IDE | Android Studio | Xcode |

What is Hybrid?

A hybrid application is simply a website embedded inside a 'web view', which can be seen as a simple browser that comes bundled with the platform. On Android, you create web views by instantiating the WebView class; the iOS equivalent is the UIWebView (or WKWebView in iOS 8) class.

When developing, you simply write your website using HTML, CSS and JavaScript, ensuring it is responsive, and then use PhoneGap, Cordova and/or similar tools to package it into a native application.

Web views are more common than you think. If you use the Facebook, or Twiiter app, and you click on a link, the link will open inside the application inside a web view.

When a user opens up the mobile application, they are, in effect, just browsing a full-screen version of your HTML application.

However, it's a little bit more advnaced than that. Tools like Cordova provides a set of JavaScript APIs that allows the application to interact with device-native functions such as the camera, accelerometer, geolocation, contact list and much more.

The allure of hybrid applications is that it allows you to write using a stack most developers are already familiar with - HTML, CSS, JavaScript. This means the learning curve is shallower, you can write and maintain one code base for both website, Android and iOS, and maybe even other platforms.

But of course, nothing is always better than something else, so which is better for which jobs?

Why Hybrid?

Rapid Development

With a hybrid application, you write one set of code and deploy it on mulitple platform. This can reduce the development time by many factors.

Maintainability

On top of rapid development, having one code base also means it's easier to maintain.

Easier to Find Developers

The number of developers who are comfortable with HTML, CSS and JavaScript is much much higher than the number of develoeprs who are comfortable with Java, or Objective-C.

If your budget is low, it also means you can hire a single developer to code the website, the Android app, as well as the iOS app. Otherwise, you'd need to hire three different developers.

A Plethora of Libraries

There's a JavaScript library for everything. That's one of the great things about JavaScipt - almost everything that you need have probably been written by someone, somewhere, some time in the past.

Want to display dynamic graphics (maybe part of a game)? You can develop using HTML5 Canvas with libraries like paper.js, fabric.js or EaselJS. Need 3D graphics? Try WebGL using libraries such as three.js.

Why Native?

Performance

Performance, or the lack of it, is, by far, the biggest criticism of hybrid applications. With native apps, the code is compiled into machine code (Dalvik in Android), which means it runs efficiently. There's a lot more layers of execution for a hybrid app, and that means it can often be laggy.

The web view is a rudimentary browser, so many of the web performance optimizations and features you find in modern browsers are lacking in the web view. However, as web views continues to improve, features such as application cache, localStorage, indexedDB have already been incorporated.

From the WebView for Android page:

The WebView shipped with Android 4.4 (KitKat) is based on the same code as Chrome for Android version 30. This WebView does not have full feature parity with Chrome for Android and is given the version number 30.0.0.0.

However, with each improvement, the PhoneGap and Cordova platforms will need time to be updated to use to new web view, and so there will always be a delay before you can make use of improvements to the Android platform.

But to balance the scale, unless your application is memory-intensive (display a lot of graphics, animations and/or videos), you will hardly notice any performance difference.

User Experience

User Experience (UX) is something that ties in with performance, but also includes User Interface design.

If you simply package a responsive version of your web application in Cordova and ship it, the User Interface will not be the same as a native application.

However, there are a whole host of mobile UI frameworks available like Ionic, Framework 7, Ratchet and Onsen UI that can provide you with native-looking UI components, so this can be less of a problem.

Native vs Hybrid

For most startups, I would highly recommend the hybrid approach. I'd advise startups to get a Minimum Viable Product (MVP) out there as soon as possible, so that you can validate your idea, and test whether it fits into the market as well as you had planned.

If your idea and application carries a lot of value for the users, most users would not mind a not-so-perfect or not-so-performant app. That's much better than making sure the interface is perfect and performant, but your later discover your idea doesn't fit the market.

Everyone thinks their idea is the next big thing, but the harsh truth is that for every successful app, there are thousands of unsuccessful ones. Spending years on a flop is simply not sustainable.

Develop in hybrid, get the MVP out there, get some traction going. By that time, you may even be in a position to get venture capital funding, or other forms of funding that allows you to hire people to develop the native apps.

If, however, the application doesn't take off, you'd have spent only a few weeks or months - no big deal.

The only time I'd advise to develop natively straight away is if you have the budget, a large and experienced enough development team, and you are sure that the idea works.

Cross-Platform Native Platforms

But before you jump on the hybrid bandwagon (which you should), there's actually a 'third' type of frameworks you can consider. Appcelerator Platform, Xamarin, React Native and NativeScript are platforms which allows you to code with one codebase, and then deploy it to different platforms with native UI components. All apart from Xamarin uses JavaScript as its programming language.

comments powered by Disqus