
Extensibility Design Patterns From The Initial Stage of Application Life-Cycle An Empirical Study Using GoF Patterns and Swift Programming language Theepan Karthigesan Thesis submitted for the degree of Master in Programming and Networks 60 credits Department of Informatics Faculty of mathematics and natural sciences UNIVERSITY OF OSLO Spring 2018 Extensibility Design Patterns From The Initial Stage of Application Life-Cycle An Empirical Study Using GoF Patterns and Swift Programming language Theepan Karthigesan © 2018 Theepan Karthigesan Extensibility Design Patterns From The Initial Stage of Application Life-Cycle http://www.duo.uio.no/ Printed: Reprosentralen, University of Oslo Abstract We consider extensibility in software development as an essential characteristic due to the fast growing technologies that demand a quick response from the developers. This study will therefore mainly focus on achieving extensibility from the beginning of an application life-cycle, the design phase. During this study, we explored and discussed the GoF (Gang of Four) patterns and pointed out those we considered as extensibility patterns. Afterwards, we picked six patterns from the pointed out list and implemented using a case-study application to demonstrate how they provide support for extensibility in a real-world application. We used iOS development platform and Swift programming language in the case-study. To limit the scope of this study, we decided to only look into GoF design patterns. Evaluation of the case-study is done by putting the patterns up against some extensibility characteristics based on our subjective view, data from the self-designed extension scenarios tables and the lessons from implementation of the six patterns using the case-study. Decoupling and encapsulation are also taken into consideration as evaluation criteria, but advanced measurement of these criteria are out of the scope; thus, we rely on our subjective view on decoupling and encapsulation. We divided the found extensibility pattern into two groups, one with the less complex patterns where extension generates less work than the other group in which contains more challenging pattern when it comes to extending. The results also show that in some cases the complexity grows by increased decoupling, which in turn will lead to more amount of work when extending, that is the case in the second group. i ii Acknowledgements I am using this opportunity to express my gratitude to Professor Eric Bratley Jull who supported me through the learning process of this master’s thesis. I am thankful for his guidance, amazing motivational speech, and useful critiques. iii iv Contents Abstract i Acknowledgements iii I Introduction 1 1 Introduction 3 1.1 Designs Patterns . .3 1.2 Motivation . .4 1.3 Goals . .4 1.4 Approach . .4 1.5 Scope . .4 1.6 Research/Work Done . .5 1.7 Evaluation . .5 1.8 Results . .5 1.9 Contributions . .6 1.10 Limitations . .6 1.11 Conclusion . .6 1.11.1 Less complex patterns . .6 1.11.2 Challenging patterns . .7 1.12 Further work . .7 II Background 9 2 Introduction 11 2.1 Outline . 11 3 Literature Review and Related Works 13 3.1 Introduction . 13 3.2 Primary Studies . 13 3.3 Summary . 15 4 Extensibility in Software Development 17 4.1 Introduction . 17 4.2 Design Phase of Software . 19 4.2.1 Decoupling . 21 v 4.2.2 Encapsulating . 21 4.3 Summary . 21 5 Design Patterns in Software Development 23 5.1 Introduction . 23 5.2 Categorization . 25 5.2.1 Creational . 26 5.2.2 Structural . 27 5.2.3 Behavioral . 28 5.3 Summary . 29 III Research 31 6 Introduction 33 6.1 Outline . 33 7 Pointing out Extensibility Design Patterns 35 7.1 Introduction . 35 7.2 Extensibility Design Patterns . 36 7.3 Scenarios tables . 38 7.3.1 Creational . 39 7.3.1.1 Factory method . 39 7.3.1.2 Abstract Factory . 41 7.3.1.3 Builder . 44 7.3.1.4 Prototype . 46 7.3.1.5 Singleton . 47 7.3.2 Structural . 48 7.3.2.1 Adapter . 48 7.3.2.2 Bridge . 49 7.3.2.3 Composite . 51 7.3.2.4 Decorator . 52 7.3.2.5 Facade . 53 7.3.2.6 Flyweight . 55 7.3.2.7 Proxy . 56 7.3.3 Behavioral . 57 7.3.3.1 Interpreter . 57 7.3.3.2 Template Method . 58 7.3.3.3 Chain of Responsibility . 60 7.3.3.4 Command . 61 7.3.3.5 Iterator . 63 7.3.3.6 Mediator . 65 7.3.3.7 Memento . 67 7.3.3.8 Observer . 68 7.3.3.9 State . 70 7.3.3.10 Strategy . 71 vi 7.3.3.11 Visitor . 73 7.4 Summary . 75 8 Implementation of Extensibility Design Patterns 79 8.1 Introduction . 79 8.2 eFuel application . 80 8.3 Building eFuel . 81 8.3.1 Creational . 83 8.3.1.1 Factory method . 83 8.3.1.2 Builder . 85 8.3.2 Structural . 88 8.3.2.1 Bridge . 88 8.3.2.2 Facade . 90 8.3.3 Behavioral . 92 8.3.3.1 Template Method . 92 8.3.3.2 Iterator . 95 8.4 Summary . 97 IV Evaluation 99 9 Introduction 101 9.1 Outline . 101 10 Evaluation of the Extensibility Patterns 103 10.1 Introduction . 103 10.2 Creational . 104 10.2.1 Result introduction . 104 10.2.2 Evaluation . 104 10.2.3 Review of the implementation . 105 10.2.4 Summary . 106 10.3 Structural . 107 10.3.1 Result introduction . 107 10.3.2 Evaluation . 107 10.3.3 Review of the implementation . 108 10.3.4 Summary . 108 10.4 Behavioral . 109 10.4.1 Result introduction . 109 10.4.2 Evaluation . 110 10.4.3 Review of the implementation . 111 10.4.4 Summary . 111 11 Conclusion 113 11.1 Summary . 113 11.1.1 Less complex patterns . 114 11.1.2 Challenging patterns . 114 11.2 Further work . 115 vii V Appendix 117 Appendix A Code 119 viii List of Figures 4.1 Relational between calling and data model components . 18 4.2 Tightly coupled software . 20 4.3 Loosely coupled software . 20 7.1 Sample UML class diagram used for explanation . 36 7.2 Factory Method - Class diagram . 39 7.3 Abstract Factory - Class diagram . 41 7.4 Builder - Class diagram . 44 7.5 Prototype - Class diagram . 46 7.6 Singleton - Class diagram . 47 7.7 Adapter class diagram . 48 7.8 Bridge - Class diagram . 49 7.9 Composite class diagram . 51 7.10 Decorator - Class diagram . 52 7.11 Facade - Class diagram . 53 7.12 Flyweight - Class diagram . 55 7.13 Proxy class diagram . 56 7.14 Interpreter - Class diagram . 57 7.15 Template Method - Class diagram . 58 7.16 Chain of Responsibility - Class diagram . 60 7.17 Command - Class diagram . 61 7.18 Iterator - Class diagram . 63 7.19 Mediator - Class diagram . 65 7.20 Memento - Class diagram . 67 7.21 Observer - Class diagram . 68 7.22 State pattern class diagram . 70 7.23 Strategy - Class diagram . 71 7.24 Visitor - Class diagram . 73 7.25 Extensibility.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages139 Page
-
File Size-