Bridging the Gap: Investigating Device-Feature Exposure in Cross-Platform Development
Total Page:16
File Type:pdf, Size:1020Kb
Proceedings of the 51st Hawaii International Conference on System Sciences j 2018 Bridging the Gap: Investigating Device-Feature Exposure in Cross-Platform Development Andreas Biørn-Hansen Gheorghita Ghinea Faculty of Technology Department of Computer Science Westerdals Oslo School of Arts, Communication and Technology Brunel University Oslo, Norway Uxbridge, United Kingdom [email protected] [email protected] Abstract iOS are used to develop apps specific to a given platform [2]. If targeting multiple platforms, such as Android, iOS and By traversing academia and developer communities, two Windows Phone, the increase in development cost is almost predominant approaches to cross-platform mobile devel- linear for each new platform added to the specification [3]. opment have been identified, specifically Hybrid and In- This is due to inherent and strong platform heterogeneity terpreted. Previous research has established the use and [4]. integration of platform- and device-specific features to be In this study, we present a technical comparison of how core requirements for cross-platform frameworks. In this two popular cross-platform app development approaches, study we assess and discuss how the Hybrid and Interpreted Hybrid and Interpreted, communicate with- and leverage approaches facilitate the use of native device features from device features. We base the comparison on two techni- within a JavaScript context, and how custom communication cal implementations, in our context being mobile apps. bridges are both developed and integrated. Our research Specifically, the study investigate how the approaches, and motivation lies in data from an industry survey, stating that associated frameworks, facilitate the creation and use of developers perceive device communication as a real pain- bridges to access native functionality from the app-side to point. While both approaches exist to ease development of the native-side. Thus, we extend and draw from studies such mobile apps, they are fundamentally different at a techni- as [5]–[7] by deeper investigating how platform-specific cal level. The article takes a technical approach, drawing code is executed via bridges from common JavaScript envi- evaluations and discussions from two app implementations. ronments. Additionally, we present preliminary results from Our findings indicate that implementation and development a conducted performance test, thus enabling us to draw from of communication bridges are non-complex tasks, and that an empirical foundation for the sake of comparison and execution-time performance varies greatly. discussion. Throughout this article, we refer to two sides of our app 1. Introduction implementations. The native-side refers to platform-specific code, effectively the code that communicates directly with Within cross-platform mobile development, different ap- the given platform SDK and device features. This code is proaches and associated technical frameworks exist to facil- Java/Kotlin for Android, and Swift/Objective-C for iOS. The itate the development of apps that execute and work across app-side refers to the codebase of our implementations a platforms, often depending on just a single codebase. As cross-platform developer would spend the majority of their such solutions are effectively layers of abstraction between time working with, in our context being JavaScript-based. the developer and the native part of an app, bridges are Based on our literature review in Section 2, we find that the enabler for communication between the native side and when discussing cross-platform mobile app development, abstraction (app) side. The bridges and bridging system are we tend to sort technical frameworks into five particular integral parts of several development approaches, including development approaches. Cross-platform is thus used as the popular Hybrid and Interpreted ones. The bridging sys- an umbrella term rather than to describe a specific tech- tem facilitates the use of native device features including, but nology or way of development. Research seem to agree not limited to, Bluetooth, device storage and camera access that included in this pool of approaches we find Hybrid, [1]. These are features normally accessed through platform- Interpreted, Cross-Compiled, Component-Based and Model- specific code using the native development approach [2]. Driven development [1], [3], [5], [6], [8]–[11], where the two In native development, platform-specific languages such as latter approaches are less frequently discussed in literature Java or Kotlin for Android, and Objective-C or Swift for than the former three. While they all have a common goal URI: http://hdl.handle.net/10125/50605 Page 5717 ISBN: 978-0-9981331-1-9 (CC BY-NC-ND 4.0) of easing mobile app development compared to traditional 2. Related Work native development [11], how they do so differs on a technologically fundamental level. An extensive body of research has been identified on the The Cross-Compiled approach does not depend on a subject of cross-platform app development. The majority of device communication bridge due to its nature, where a well-cited papers discuss framework-level differences as a common language is compiled into platform-specific bi- vehicle for comparing development approaches [1], [3], [5], naries [8], thus eliminating the need for bridges between [6], [8]–[10]. languages. Thus, the Cross-Compiled approach was left Technical artefacts and implementations are frequently out of this study. For the Component-Based and Model- included, substantiating the research and providing data Driven development approaches, we find academic con- where suitable [1], [5], [8], [12], [13]. In this study, we tributions to be prevalent, with less industry efforts and use technical artefacts to better understand and communicate adoption. Both Heitkötter et al. [3] and Perchat et al. the complexity of feature-access bridging on cross-platform [8] are examples of academic efforts increasing awareness development. However, implementations are used also for of respectively Model-Driven and Component-Based app studies such as comprehensive performance tests (e.g. [14]) development. These approaches do not require device com- and comparison of development approaches (e.g. [13]). munication bridges either, and are thus left out of the study. In Puder et al. [15], the authors propose their own The Hybrid and Interpreted approaches both rely on Cordova-like alternative for exposing device features to bridges for communication between the app-side and native- what they refer to as web apps, in our context being the side. Most Hybrid apps rely on Cordova, an open-source Hybrid approach. While the proposal is seemingly novel and library for easy facilitation of bridge communication and interesting by itself, the authors present Cordova in a rather app packaging. No such library has been identified for opinionated fashion, stating that platform restrictions impose the Interpreted approach. An in-depth explanation of both a negative impact towards the end-user without providing approaches are presented in Section 4. any additional proof of such. We are unable to find the pro- posed framework implemented in any production-released Our research question and motivation is based on an tool or framework. A similar alternative was presented in online survey questionnaire conducted on- and targeted to- Bouras et al. [16], scrutinizing a technical implementation wards industry developer communities. The survey included using their own Cordova-like framework. While being an 101 respondents, and focused on different aspects of cross- interesting contribution, it lacks real-world adoption and platform development. When questioned regarding typical testing, making it more a research effort than of direct developer experience pain-points, 32 respondents identified relevance to industry and practice Nevertheless, both studies and answered that “Hard to integrate with device APIs (cam- contribute greatly to the understanding of possibilities within era, Bluetooth, file system, etc.)” was an issue they related the Hybrid approach, but less so for understanding real- to cross-platform development. Based on these findings, we world solutions. formed the following We identified Heitkötter et al. [2] to be part of the Research Question: "How programmatically complex is fundamental research on cross-platform development. The the development and use of communication bridges allowing study extensively scrutinize different perspectives of cross- for access to platform-specific device features in Hybrid and platform development, including such as distribution plat- Interpreted apps?". forms, Graphical User Interface designs, scalability and As this article is more of a technical nature, the survey will access to platform-specific features. The latter perspective, not be presented in any further detail. However, presenting or criteria, is of great interest to us. Whereas the authors the survey is part of our planned future work, and will compare frameworks and approaches using their proposed provide extensive insight into the status quo of developers set of criteria, we extend their findings by presenting imple- perception of cross-platform tools, frameworks, issues and mentations focusing on access to platform-specific features, interest. using Cordova and React Native modules. The same criteria The rest of this paper is structured as follows. Section is also proposed by Gaouar et al. [6] in their article on cross- 2 presents a discussion of related