Dissertation Submitted to the Graduate Faculty of Auburn University in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy
Total Page:16
File Type:pdf, Size:1020Kb
Repatterning: Improving the Reliability of Android Applications with an Adaptation of Refactoring by Bradley Christian Dennis A dissertation submitted to the Graduate Faculty of Auburn University in partial fulfillment of the requirements for the Degree of Doctor of Philosophy Auburn, Alabama August 2, 2014 Keywords:Refactoring, Code Smells, Patterns, Non-functional Requirements, Verification Copyright 2014 by Bradley Christian Dennis Committee: David Umphress, Chair, Associate Professor of Computer Science and Software Engineering James Cross, Professor of Computer Science and Software Engineering Dean Hendrix, Associate Professor of Computer Science and Software Engineering Jeffrey Overbey, Assistant Research Professor of Computer Science and Software Engineering Abstract Studies of Android applications show that NullPointerException, OutofMemoryError, and BadTokenException account for a majority of errors observed in the real world. The technical debt being born by Android developers from these systemic errors appears to be due to insufficient, or erroneous, guidance, practices, or tools. This dissertation proposes a re- engineering adaptation of refactoring, called repatterning, and pays down some of this debt. We investigated 323 Android applications for code smells, corrective patterns, or enhancement patterns related to the three exceptions. I then applied the discovered patterns to the locations suggested by the code smells in fifteen randomly selected applications. I measured the before and after reliability of the applications and observed a statistically significant improvement in reliability for two of the three exceptions. I found repatterning had a positive effect on the reliability of Android applications. This research demonstrates how refactoring can be generalized and used as a model to affect non-functional qualities other than the restructuring related attributes of maintainability and adaptability. ii Acknowledgments As all journeys must come to an end, my decade long journey towards a doctorate is finally coming to a close. The many struggles, detours and failures were too great to overcome alone, and as such, I am eternally indebted and grateful to those that supported me on this effort. First, I would like to thank my wife, Katya, and son, Josey, their patience and tolerance has proven much greater than mine. Second, without the gracious support of my father, brother, and father-in-law, John “Dad”, Brian, and Vlad, and their wives, Brenda, Shannon, and Sasha, I never could have completed this work. I extend a special acknowledgement to my advisor, Dr. Umphress; his support for me never wavered and over the years he has become a valued mentor and role model. A warm thanks is also extended to my committee, Dr. Cross, Dr. Hendrix, and Dr. Overbey, as their insights and guidance have expanded and improved my research greatly. I would like to thank Hasanur Rahaman, who helped build and collect the initial application catalog, Dr. Paul Stermer who helped with the experimental design and methodology, and finally, Joseph Douglas (aka Sylvan Kills), for his many hours editing and proofreading my dissertation. iii Table of Contents Abstract ........................................................................................................................................... ii Acknowledgments.......................................................................................................................... iii List of Figures ............................................................................................................................... vii List of Tables ................................................................................................................................. vi Chapter 1 – Introduction ................................................................................................................. 1 1.1 Background ........................................................................................................................... 1 1.2 Framework ............................................................................................................................ 2 1.3 Statement of the Problem ...................................................................................................... 4 1.4 Purpose of the Study ............................................................................................................. 5 1.5 Limitations, Assumptions, and Delimitations ....................................................................... 6 1.6 Definition of Key Terms ....................................................................................................... 7 Chapter 2 – Literature Review ........................................................................................................ 9 2.1 Introduction ........................................................................................................................... 9 2.2 Android Mobile Operating System (MOS) and Application Architecture ......................... 10 2.3 Android Reliability Issues ................................................................................................... 13 2.4 Impact on the Developer of Failures ................................................................................... 20 2.5 Application Quality Guidance ............................................................................................. 21 2.6 Android Books .................................................................................................................... 29 2.7 Android Verification Tools ................................................................................................. 29 Chapter 3 – Research Description................................................................................................. 35 3.1 Introduction ......................................................................................................................... 35 3.2 Developer Perceptions......................................................................................................... 36 3.3 Developer Adoption ............................................................................................................ 37 3.4 Refactoring as Part of a Larger Process .............................................................................. 38 3.5 Bad Smells in Other Abstractions ....................................................................................... 40 3.6 Refactoring the Restructuring Activity ............................................................................... 40 3.7 Refactoring Limitations....................................................................................................... 42 3.8 Repatterning ........................................................................................................................ 45 3.9 Conclusion ........................................................................................................................... 47 Chapter 4 – Methods & Results .................................................................................................... 49 4.1 Introduction ......................................................................................................................... 49 4.2 Exploratory Studies Framework.......................................................................................... 50 4.3 Smell Study Methodology ................................................................................................... 54 iv 4.4 Smell Study Results ............................................................................................................ 55 4.5 Corrective Pattern Study Methodology ............................................................................... 61 4.6 Corrective Pattern Study Results ........................................................................................ 61 4.7 Enhancement Pattern Study Methodology .......................................................................... 69 4.8 Enhancement Pattern Study Results .................................................................................... 69 4.9 Reliability Experiment Methodology .................................................................................. 73 4.10 Reliability Experiment Results ......................................................................................... 81 Chapter 5 – Summary, Conclusions & Future Work .................................................................... 87 5.1 Summary ............................................................................................................................. 87 5.2 Conclusions ......................................................................................................................... 90 5.3 Future Work ........................................................................................................................ 96 References ................................................................................................................................... 100 Appendix A – Application Catalog............................................................................................. 109 Appendix B – Pre-test Results .................................................................................................... 131 Appendix C – Data Collection Instruments ...............................................................................