UC San Diego
Tooling and Language Support for Robust and Easy Network Programming of Mobile Applications
- Author(s): Jin, Xinxin
- Advisor(s): Zhou, Yuanyuan
- et al.
Most of today’s mobile apps rely on the underlying networks to deliver key func- tions such as web browsing, file synchronization, and social networking. Compared to desktop-based networks, mobile networks are much more dynamic with frequent con- nectivity disruptions, network type switches, and quality changes, posing unique pro- gramming challenges for mobile app developers.
As revealed in this thesis, many mobile app developers fail to handle these inter- mittent network conditions in the mobile network programming. Consequently, network programming defects (NPDs) are pervasive in mobile apps, causing bad user experiences such as crashes, data loss, etc. Despite the development of network libraries in the hope of lifting the developers’ burden by providing flexible fault-tolerant APIs, we observe that many app developers often ignore such APIs or lack the capability to use them correctly and therefore still introduce NPDs.
In this thesis we make three contributions towards robust network programming for mobile apps. In the beginning, we study the characteristics of 90 real-world NPDs in Android apps towards a deep understanding of their impacts, root causes, and code patterns. This study exposes the common mistakes and pitfalls made by app developers when dealing with intermittent network. It also reflects that NPDs are pervasive despite the availability of fault-tolerant API from third-party network libraries.
Driven by the study, we build NChecker, a practical tool to detect NPDs by stat- ically analyzing Android app binaries. NChecker has been applied to hundreds of real Android apps and detected 4180 NPDs from 285 randomly-selected apps with a 94+% accuracy. Shockingly, NChecker detects network bugs in 99% of the evaluated apps. Our further analysis of these defects reveals the common mistakes of app developers in working with the existing network libraries’ abstractions, which provide insights for improving the usability of mobile network libraries.
Besides NPD detection, a more fundamental way to eliminate NPDs is to pro- vide developers easy-to-use interfaces for network programmings. We argue that the difficulty of avoiding NPDs can be mitigated through an annotation language that al- lows developers to declaratively state desired and actual properties of the application, largely without reference to fault-tolerant concepts, much less implementation. A pre- compiler can process these annotations, replacing calls to standard networking libraries with customized calls to a specialized library that enhances the reliability. The last com- ponent of the thesis presents ANEL, a declarative language and middleware for Android that enables non-experts. We demonstrate the expressiveness and practicability of ANEL
annotations through cases studies on real-world networked mobile apps. We also show that the ANEL middleware introduces negligible runtime performance overhead.