Code sharing between web and mobile applications

University essay from KTH/Skolan för elektroteknik och datavetenskap (EECS)

Author: Willy Liu; [2021]

Keywords: ;

Abstract: For developers aiming to create a cross-platform application that runs both in the web browser and on mobile phones, hybrid mobile app frameworks have sometimes been recommended in the past, but hybrid apps have often been shown to have numerous downsides. Interpreted mobile app frameworks (e.g. React Native, NativeScript) have been rising in popularity lately. This work aims to investigate the feasibility of using an interpreted app framework to share code between web apps and mobile apps and to see if it is a better alternative to the hybrid app approach. This was done by designing a code sharing method and implementing it in a real-world React-based web application, enabling it to run as a mobile application using React Native from the same codebase as the web app. The interpreted mobile app was compared against a hybrid version of the same app using a source code analysis, user testing, and performance measurements. Using the code sharing method outlined in this paper, around 60% of the codebase was shared between the developed applications. The method required non-trivial source code modifications and put limitations on the application code – most notably within styling, animations, navigation, and modules utilizing third-party libraries. UI components that did not use HTML/DOM elements directly, and other logic code such as state management, data fetching, etc. could be shared with little to no modification. Both the interpreted app and the hybrid app were rated well in the User Experience Questionnaire, with the interpreted app showing slightly better results. 20 out of 30 testers preferred using the interpreted app, saying it was more “smooth”. Both apps achieved good performance results, with the hybrid app performing better in some metrics and the interpreted app performing better in others. Using an interpreted app framework may result in an overall higher quality app compared to the hybrid approach, but further research is needed to draw stronger conclusions. The user testing results for iOS differed slightly compared to the Android results, but there were overall no other significant differences between the platforms in other aspects. 

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)