Investigating Source Code Reusability for Android and Blackberry Applications Group G8 Jenelle Chen Aaron Jin 1
Outline Recaps Challenges with mobile development Problem definition Approach Demo Detailed Design Results References 2
Challenges in Mobile App Dev [1] 1. Application must run on different platforms 2. Code is SDK and language dependent 3
Problem Description How to maximize source code reusability between Java development platforms? 4
The Approach 1. Develop a mobile application App should run on Android and Blackberry App should represent most commonly used features 2. Evaluate component reusability What areas are SDK dependent How can these areas be decoupled from SDK? Does decoupling really reduce development & maintenance effort? 5
The Approach 1. Develop a mobile application App should run on Android and Blackberry App should represent most commonly used features 2. Evaluate component reusability What components are SDK dependent How can these components be decoupled from SDK? Does decoupling really reduce development & maintenance effort? 6
Create notes Edit notes Save notes Share notes Basic Collaboration on notes 7
8
Detailed Design Diagrams 9
Mobile App Architecture Presentation Layer Application Logic Database Layer 10
Web Application Architecture Web Browser Caching URL Handler Template View Model Database 11
Big Picture send request receive response ANDROID / BLACKBERRY APP DJANGO FRAMEWORK 12
Web Application Architecture Web Browser Caching URL Handler Template View Model Database 13
Application Diagram Register Login Home Edit Share View API Service Note Provider JSON Parser Utility HTTP Helper API Helper SQL Manager Logging Web Services SQL Helper Note DB Model 14
Results 15
Outline of Expected Results % of reusable source code Identification of reusable source code Observations on ease of development Set of principles to use when designing CBSEcentric mobile applications 16
% of Purely Reusable Files Total # of java files: 16 # of reusable files: 5 % of reusable files: 31 % 17
Which Areas are Reusable? Register Login Home Edit Share View API Service Note Provider JSON Parser Utility HTTP Helper API Helper SQL Manager Logging Web Services SQL Helper Note DB Model 18
However. Some files can be abstracted into interfaces. Logging.java HTTP Helper.java SQL Helper.java This decouples code and improves maintainability. 19
Which Areas are Reusable? Register Login Home Edit Share View API Service Note Provider JSON Parser Utility HTTP Helper API Helper SQL Manager Logging Web Services SQL Helper Note DB Model 20
Reusability Conclusion? 21
Most of the Business Logic is Reusable! Register Login Home Edit Share View API Service Note Provider JSON Parser Utility HTTP Helper API Helper SQL Manager Logging Web Services SQL Helper Note DB Model 22
Android / BB SDK Observations Android Blackberry Abstraction Lvl High Medium Ease of Dev Easy Not so easy Documentation Excellent Fair 23
Principles for Maximizing Source Code Reusability 1. Separate UI from application logic. 2. Be aware of how your design is affected by differences between J2ME and J2SE. 3. Search for functional areas that can be abstracted. 4. Know when to quit. 24
Separate UI from App Logic UI source code must be separated from application logic Problem: UI code is heavily SDK dependent Solution: Decouple application logic from UI logic Budget more time in the dev/testing cycle for UI related work 25
Differences b/w J2ME and J2SE J2ME contains a subset of J2SE functionality Problem: J2ME cannot access a lot of useful J2SE functions string manipulation functions data structures (arraylists) 26
Differences b/w J2ME and J2SE Solution: Design application using only J2ME functions Ensure 3 rd party classes support J2ME (example: JSON parsers) Don t fall in the MIDLet Trap 27
Creating Abstract Classes Problem: Some functionality is needed by both applications (eg: logging/debugging) But the code to implement the functions is SDK dependent Solution: Create interfaces and abstract methods. 28
Source Code Demonstration 29
Knowing When To Quit Problem: Blackberry and Android UI are completely different. Example: Keyboards vs. touch screens Different user interaction paradigms Different UI components 30
Example Menus [2][3] Android Menu Blackberry Menu 31
Solution: Stop trying to abstract or reuse components that are clearly not reusable Trying to reuse prevents devs from taking full advantage of the SDK. 32
References [1] P. Abrahamsson, et al. Mobile D: An Agile Approach for Mobile Application Development, Conference on Object Oriented Programming Systems Languages and Applications, pp.174 175, 2004 [2] The Android Developer s Guide http://developer.android.com/guide/index.html (Accessed June 20, 2010) [3] Blackberry Java Application Guide http://na.blackberry.com/eng/developers/ (Accessed June 20, 2010) 33
QUESTIONS? 34