Native vs. Hybrid Mobile Applications
Objectives of this chapter:
Let’s get started by understanding different ways to develop mobile applications. There are three ways to build a mobile application:
For the remainder of this book, we will not be focusing on the web application part, because it operates from the point of view of building an application on the Web and using the mobile device just as a front end. We will keep the discussion limited to the other two types. Let’s start with native mobile application development.
Native Mobile Application Development
In native mobile application development (NMAD), mobile applications are developed using languages supported by the mobile OS technology stack. Before Nokia started the mobile application trend, cell phones could do only two things: make calls and send text. When a mobile application is created using the mobile OS technology stack exclusively, it is called a native application. These applications are built by using only the tools and technologies (including programming languages) suggested by the mobile application stack vendors, such as Google (Android), Apple (iOS), and Microsoft (Windows Phone).
Mobile devices have been in existence since 1973, when Martin Cooper of Motorola made the first cell-phone call to Joel Engel of Bell Labs. But for many years, the only benefit of such a device was that it allowed a person to be mobile while making the phone call. Starting in 1993, Short Message Service (SMS) was added to the device.
Serious work on making the device a personal tool (rather than a phone) for a user started back in 1996, when the Palm OS was released for a personal digital assistant (PDA). Application development for the Palm OS was more like Windows programming, which included events and loops. Applications used to be driven by a user’s actions. Application development used to happen in C. The Palm OS is now the Garnet OS. Some applications such as the calculator, date book, and notepad were famous on the Palm OS.
In 1996, Microsoft launched Windows Embedded Compact (Windows CE). It was made as a plain vanilla system, and flavors were created for the Pocket PC and later for Windows Mobile. Microsoft in 2010 launched Windows Phone 7 with a tile-based UI. Application development for Windows CE used to happen using Visual Basic and C++. Windows Phone prefers development with C#, VB.NET, and Extensible Application Markup Language (XAML). The latest edition of Windows Phone (version 10) was launched by Microsoft in 2015.
After Palm OS and Windows CE, Symbian became one of the most popular mobile operating systems in the last decade. Owned by the Symbian Foundation, it was licensed by Nokia. Symbian was a favorite of developers because of its Series 60 User Interface, a software development platform for Symbian smartphones. Developers used to code in Java, C++, Python, and Adobe Flash to create Symbian applications. In 2011, Nokia declared the Windows Phone OS as its primary OS, pushing Symbian aside.
In 1999, Sun Microsystems created a Java-flavored platform called Java 2 Platform, Micro Edition (J2ME) for small devices including cell phones. Java was the obvious choice for application development.
BlackBerry launched the 850 device in 1999 and has had a variety of devices to date. It is more popular in corporate environments because of its secure e-mail functionality. BlackBerry development moves around C++ and the BlackBerry SDK.
The current market and application scenario has changed. Now the market is moved by three popular ecosystems: Google, Apple, and Microsoft. Just like the old platforms, the current popular platforms also have preferred language stacks for application development. Android has Java, iOS has Objective C, and Windows Phone has C# and VB.NET.
To summarize, the following are important milestones in mobile history:
Native mobile application development on any platform has pros and cons.
The advantages are as follows:
Here are the disadvantages:
For the second quarter of 2015, the International Data Corporation (IDC) indicated the following share of the smartphone market (see www.idc.com/prodserv/smartphone-os-market-share.jsp):
Although these market details are based on the number of devices sold, application development still remains a problem. How are applications developed for all popular platforms today? As we discussed in Chapter 1, native application development is being overshadowed by hybrid application development. Figure 2-1 shows the basic differences between native and hybrid applications:
Figure 2-1. Basic differences between native and hybrid applications
Hybrid Mobile Application Development
In hybrid mobile application development (HMAD), mobile applications are developed using a technology stack and are packaged to deploy on many mobile devices with different screen sizes and manufacturers. Hybrid applications allow an application developer to build an application by using simple technologies such as HTML, CSS, and JavaScript. Sometimes developers use C# and VB.NET.
Hybrid mobile applications try to mix the best of both approaches; they use the power of server-side computing but don’t treat the device only as a front end. These applications have a native component that resides on the device and can use the local features as if it’s a native application. That is why hybrid applications are becoming more popular than other approaches.
Why HMAD?
Being able to develop once and deeply is often a motivation for using HMAD. Although we’ve discussed using the same code base, which seems easy, you still might need to change about 20 percent of the code, based on the platform. Why? Let’s assume you are targeting Android and iOS at the same time. Sometimes the APIs used for the accelerometer, for instance, differ with respect to the platform. Some devices may not have the capability or sensor itself. Acceptance guidelines from Apple, Google, and Microsoft stores are different. Finally, UI consistency can still allow for differences on different platforms. Yet even this 20 percent of the code effort is much better than creating 100 percent of the code again. Because of this code reusability, HMAD is always better.
In 2008, Lee Barney, vice president of BDI, published a blog at https://tetontech.wordpress.com/ about communication between Objective C and JavaScript. Barney published code on the blog under the name UIWebView. In 2009, the iPhone 2 was launched along with WebView and SQLite database support.
In the same year, Nitobi (later acquired by Adobe) developed PhoneGap. PhoneGap became popular because of its capability to target iOS and Android. After PhoneGap, many platforms arrived on the market, making hybrid application development easier. This progress was built around JavaScript.
Meanwhile, plug-in-based web applications were as popular as mobile application(s). Adobe Flash and Microsoft Silverlight are popular plug-in-based approaches for the Web. Novel and Microsoft partnered to produce an open source flavor of Silverlight named Moonlight, based on the Mono .NET framework. Later Attachmate (a parent company to Novel) made a partnership with Xamarin. Xamarin as a product supports hybrid application development using C# for Windows Phone, Android, and iPhone. Xamarin hybrid applications use the Mono runtime.
Microsoft also offered universal applications for Android and iOS-based device(s) along with Windows Phone on the .NET platform. The Community edition of Visual Studio (IDE) is available for free with all features.
In June 2015, Apple announced Delphi for hybrid applications during the Apple Worldwide Developers Conference (WWDC).
Technologies and Frameworks Used in HMAD
Although, HTML and JavaScript are frequently used for HMAD, the following frameworks are used to communicate with device-based sensors, SD cards, cameras, and so forth:
Based on the features required, costs, deadlines, expertise availability, and learning curve, you will decide which framework to go with. Xamarin is a new one that’s been added to the list. However, it is yet to attain the same fame as the others. Xamarin also comes with an IDE and cloud-based testing features including performance analysis.
Hybrid mobile application development has pros and cons.
Here are the advantages:
The disadvantages include the following:
Summary
This chapter presented two ways to create a mobile-based application. One is native and the other is hybrid. This chapter also covered the frameworks available for building hybrid mobile applications.
3.12.162.37