Develop an App Using Native Code or Use a Hybrid/Web Framework – by Shuki Lehavi, Sr. Director of Engineering at J2

After PhoneGap and Titanium/Appcelerator, Ionic /Drifty is the latest to offer a Hybrid framework for developing cross-platform apps. I thought this is a great opportunity to revisit the fundamental question of "what is the best way to build your app? use Native code or a Hybrid framework?", and see if the recent evolution of these Hybrid frameworks my change your decision.

Hybrid frameworks promise to solve two problems: 1) allowing Web developers with HTML/JavaScript experience to build apps; and 2) allowing developers to code the app once, and deploy it to many platforms, such as iOS and Android.

In the early years of Android and iOS development, building an app was a pain. Android apps were easy to code using Java, but creating an appealing user experience took a great deal of effort. In contrast, iOS allowed you to create a beautiful user experience, but the coding language (Objective C) was cumbersome and illegible. Hybrid framework sounded like the right idea at that time.

But after I coded my first commercial app using a Hybrid framework, I noticed the following issues:

1) Hybrid was great for 'Hello World' apps, but not for full-featured apps: Using the Hybrid framework, we got our first 10 screens up and running in no time. But the problem started when we wanted to do complex tasks such as running threads in the background to load data, gracefully recover from network disconnects, control data caches and more. The app started crashing and we soon realized that no Hybrid framework is as efficient as managing threads and tasks like Native code.

2) There are not enough good Developers (and resources) to support Hybrid framework: When something goes bad with a Native code, there are many developers and online resources you can call. Search oDesk.com for "iOS" and you get 7,731 developers or "Android" and you get 13,770 developers. But if you search for "Titanium" you get 561 developers, and "Ionic" returns 126 developers, 9 of which are in the US.

A search on stackoverflow.com shows similar results. "Objective C" returns 112,000 questions answered, "Android" shows 649,000 questions answered. But a search for "Titanium" returns 11,000 results (most are old) and "Ionic" returns 6,000.

I specifically selected stackoverflow.com and oDesk.com as I regard them as independent sources and when I looked at the websites of some of the Hybrid platforms providers I have noticed very creative numbers. One platform provider claimed "Make your code part of other great mobile apps by publishing them in the Marketplace and sell to the 1.5 million developers", which is troublesome.

So when your project goes south, and the deadline is approaching, you will be hard pressed to find the experts or resource that can help you. Now, most of these Hybrid platform providers have a Professional Services group, but now we are talking very high hourly rates.

3) Hybrid frameworks aren't easy to debug: Most Hybrid framework wrap around your HTML/JavaScript code and this code runs inside the Hybrid container. When your app starts having performance or stability issues such as memory leaks or thread locking - debugging becomes a nightmare. Identifying if it's your app that causing the problem, or the Hybrid container (or the specific way you wrote your app to conform to the Hybrid container) will cost you a lot of time, and money.

For years it seems like Hybrid frameworks were the lesser of all evils.

And then came Swift and Android Studio.

With Swift, Apple made it incredibly simple to build stunning iOS apps. Swift's syntax is very similar to JavaScript or Java, add the latest improvements of XCode and the extensive online tutorials and you have a winning combination for iPhone development.

With Android Studio, Google finally delivered a fantastic development tool that makes it easy to build user interface and test it on many devices. Add the superb code editing functions of Intelij IDEA and Android development is now also easy.

But what if my app is just a combination of HTML pages altogether? First, you should know that section 2.12 in the App Store Review Guidelines states "Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected". Next, I would still suggest that building a simple app with one WebView and your web pages is a better solution than being tied to a Hybrid platform and it's complexity and release cycles.

But what about cross-device development? one code that runs magically on all devices? Well, depends on how extensive is your app. You see, even the best Hybrid framework, have certain features that may work or not based on the platform. So unless you are building a VERY simple app, you are most likely designing and coding for both iOS and Android.

This was only my experience, to see what others are doing, let's take a look at the industry. As I looked at the "Showcase" section of these Hybrid platform providers, and searched the app store for reviews of these apps, it became clear that these apps are not well accepted by the users.

Conclusion: as long as there are developers and multiple platforms, there will be developer tools and Hybrid platform. But with the app economy explosion, both Android and iOS are keeping their promise of providing superb tools for developers and are quickly surpassing the Hybrid platforms in today's market. Will that always be the case? will someone develop a Hybrid platform that is better than Native code? I will let you be the judge of that.