ebook img

Master's Thesis Cross-Platform Development for Mobile Applications Anna Troedsson Almér PDF

141 Pages·2013·5.79 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Master's Thesis Cross-Platform Development for Mobile Applications Anna Troedsson Almér

Master’s Thesis Cross-Platform Development for Mobile Applications Anna Troedsson Almér & David Karlsson Department of Computer Science Faculty of Engineering LTH Lund University, 2013 ISSN 1650-2884 LU-CS-EX: 2013-17 Cross-Platform Development for Mobile Applications Master Thesis Anna Troedsson Almér and David Karlsson Supervisors: Martin Dahl [email protected], Kim Weyns [email protected] Examiner: Kim Weyns [email protected] 2 Chapter 1 Abstract Mobility is becoming increasingly important for many companies. The markets for mobile applications have been growing tremendously the last decade. It is therefore of great interest to reduce the costs of development and maintenance of these applica- tions. When developing native applications for multiple platforms some parts of the code will likely implement the same functionality. This functionality is then implemented in different programming languages, for different platforms. Functionalities that are typi- cally the same on all platforms are network communication, data parsing and business logic. These functionalities can account for a large part of the code when developing large and complex applications. Duplication of the code, for these functionalities, could be avoided if common functionality could be extracted from the applications and put in a shared code base. The aim of this project is to investigate possible solutions to the problem of code duplicationinthecaseofaspecificbusinessapplication, developedforiOSandAndroid. It consists of a mobile client which performs some transformation of data acquired from a business system and presents it in the native UIs. This thesis first discusses the requirements and constraints which are inferred from the application type and the company wishing to apply cross-platform development. It also maps existing cross-platform development methods for this type of application and investigates to which extent the different cross-platform development methods fulfil the requirements. Finally the most suitable method is used in a practical context. 3 1. Abstract The objectives of this project are to provide the company with a recommendation of a method as well as a prototype proving the concept of this method. The focus of the project lies on finding possible solutions for mobile business applications with native UIs. The conclusion of the project is that native C++ is the most suitable method for this type of application. It fulfils all requirements, but further research is needed regarding performance. Keywords: Cross-Platform Development, Android, native, iOS 4 Contents 1 Abstract 3 2 Acknowledgements 9 3 Introduction 11 3.1 Disposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 Division of Labour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4 Background 15 4.1 The Stakeholder Company . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.2 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.3 Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.4 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5 Methodology 19 5.1 Goal Question Metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.3 Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.4 Action Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.5 Software Development Process . . . . . . . . . . . . . . . . . . . . . . . 21 5.6 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.6.1 Reliability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.6.2 Objectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.6.3 Representability . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.7 The Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5 CONTENTS 6 Theory 25 6.1 Cross-Platform Development . . . . . . . . . . . . . . . . . . . . . . . . 25 6.2 Client-Server Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.3 Mobile Application Development Models . . . . . . . . . . . . . . . . . 27 6.4 High Level Programming Language . . . . . . . . . . . . . . . . . . . . 28 6.5 Very High Level Programming Language . . . . . . . . . . . . . . . . . 30 6.6 Model-View-Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6.7 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 6.8 Abstraction Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 6.9 Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.10 Sandboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.11 Mobile Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.11.1 Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.11.2 iOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.11.3 Windows Phone 8 . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.12 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.12.1 Mobile Platform Languages: Java, C# and Objective-C . . . . . . . . . . . . . . . . . . . . . 36 6.12.2 C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.13 Bytecode Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.14 Dalvik Executables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.15 Distributables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.15.1 app-format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.15.2 apk-format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.16 Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.17 Common Language Runtime, CLR . . . . . . . . . . . . . . . . . . . . 40 6.18 Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 6.18.1 Xamarin Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.19 XMLVM Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.19.1 Bytecode Engineering Library, BCEL . . . . . . . . . . . . . . . 41 6.19.2 Microsoft’s Bytecode Engineering Library, MBEL . . . . . . . . 41 6.19.3 Extensible Markup Language . . . . . . . . . . . . . . . . . . . 41 6.19.4 Extensible Stylesheet Language, XSL . . . . . . . . . . . . . . . 42 6.20 JavaScript Object Notation . . . . . . . . . . . . . . . . . . . . . . . . 42 6.21 Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.21.1 Least Recently Used . . . . . . . . . . . . . . . . . . . . . . . . 43 6.21.2 Time Based Expiration . . . . . . . . . . . . . . . . . . . . . . . 43 7 Technology Selection 45 7.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 7.1.1 General Limitations . . . . . . . . . . . . . . . . . . . . . . . . . 45 7.1.2 General Requirements . . . . . . . . . . . . . . . . . . . . . . . 46 7.1.3 Ranking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6 CONTENTS 7.2 Possible Tools and Methods . . . . . . . . . . . . . . . . . . . . . . . . 48 7.2.1 Mapping and First Selection . . . . . . . . . . . . . . . . . . . . 48 7.2.2 The Native Development Kit . . . . . . . . . . . . . . . . . . . . 50 7.2.3 Titanium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 7.2.4 Xamarin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 7.2.5 XMLVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 7.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 7.4 Discussion of methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 7.4.1 Discussion Common for all four Methods . . . . . . . . . . . . . 60 7.4.2 NDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 7.4.3 Titanium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 7.4.4 Xamarin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 7.4.5 XMLVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 7.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 7.6 Prototype for Testing Method Feasibility, Native UIs and Unit Testing 64 7.6.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 7.6.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 7.6.3 Native Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 7.6.4 C++ NDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 7.6.5 Titanium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 7.6.6 Xamarin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 7.6.7 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 7.6.8 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 8 Prototype 77 8.1 General Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 8.2 C++ Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 8.2.1 Boost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 8.2.2 POCO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 8.2.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 8.3 JSON Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 8.3.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 8.3.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 8.3.3 Company’s Version . . . . . . . . . . . . . . . . . . . . . . . . . 83 8.3.4 C++ NDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 8.3.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 8.3.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 8.3.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 8.4 Network Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 8.4.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 8.4.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 8.4.3 Company’s Versions . . . . . . . . . . . . . . . . . . . . . . . . 95 8.4.4 C++ and NDK . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7 CONTENTS 8.4.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 8.4.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.5 Cache Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.5.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.5.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 8.5.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 8.5.4 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 8.5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 9 Conclusion and Future Work 107 9.1 Conclusion and Recommendation . . . . . . . . . . . . . . . . . . . . . 107 9.2 The Contribution of the Project . . . . . . . . . . . . . . . . . . . . . . 108 9.3 Future Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 10 Summary 111 Glossary 115 Bibliography 116 Appendix 127 A Building and Using: POCO C++ Static Libraries 129 A.0.1 Build process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 A.0.2 Adding the library to a project . . . . . . . . . . . . . . . . . . 130 B Repository 135 C Data sheets 137 C.1 Samsung Galaxy Nexus . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 C.2 Samsung Galaxy Gio . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 C.3 Apple iPhone 3GS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 8

Description:
also maps existing cross-platform development methods for this type of .. and David conducted the programming for native iOS and iOS with C++ as well .. Windows Phone 8 enforce sandboxing by requiring that all apps run in a
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.