ined in the context of the programming languages Python, JavaScript, C#, Go and Multiple inheritance was used in the Python and JavaScript implemen-
Previous PDF | Next PDF |
[PDF] Object Inheritance without Classes - Web Home ECS Victoria
It does not support multiple inheritance, but there is a logical extension to do so Constructors have a special role in JavaScript, and must have their prototype
[PDF] JavaScript Inheritance and Object Programming - Martin Rinehart
JS Inheritance and OP Prototypes for Methods 79 JSWindows Inheritance 85 Coding OOP Inheritance 86 6 Inheritance Alternatives 91 Multiple Inheritance
[PDF] Module 5 Data Abstraction and Object Orientation:-Encapsulation
In multiple inheritance, a class is defined in terms of more than one existing class Perl and Ruby join Scheme, Python, JavaScript, and R in providing first-class
[PDF] How Implementation Language Affects Design Patterns - UiO - DUO
ined in the context of the programming languages Python, JavaScript, C#, Go and Multiple inheritance was used in the Python and JavaScript implemen-
[PDF] Creating and using JavaScript objects - IBM
custom-built JavaScript objects and their properties and methods This tutorial inherit the properties and methods of another, and how to alter the structure of an object after In some situations, one property holds multiple pieces of data
[PDF] multiple inheritance python
[PDF] multiple inheritance swift
[PDF] multiple inheritance typescript
[PDF] multiplexeur et démultiplexeur exercice
[PDF] multiplexeur et démultiplexeur exercices corrigés
[PDF] multivariable unconstrained optimization
[PDF] munich to mumbai lufthansa flight status
[PDF] municipales paris 2020 sondages
[PDF] musculoskeletal system
[PDF] museum of the city of paris
[PDF] music festival expenses
[PDF] music festival marketing campaigns
[PDF] music festival target market
[PDF] music fun let's learn about notes answer key
How Implementation Language
Affects Design Patterns
A Comparison of Gang of Four Design
Pattern Implementations in Different
Languages
Kristian PedersenThesis submitted for the degree ofMaster in Programming and Networks
30 credits
Department of Informatics
Faculty of mathematics and natural sciences
UNIVERSITY OF OSLO
Spring 2019
How Implementation Language
Affects Design Patterns
A Comparison of Gang of Four Design
Pattern Implementations in Different
Languages
Kristian Pedersen
© 2019 Kristian Pedersen
How Implementation Language Affects Design Patterns http://www.duo.uio.no/Printed: Reprosentralen, University of Oslo
Abstract
In the present work the impact of implementation language on code quality for implementations based on the Gang of Four design patterns is examined. These are used by many developers and system architects to improve their development process. The patterns Composite, Prototype, Adapter and Decorator are exam- ined in the context of the programming languages Python, JavaScript, C#, Go and Smalltalk. A case was designed and implemented in these lan- guages for each pattern and then analyzed based on a gauntlet of metrics. Itwasfoundthatthereweredifferencesbetweenthelanguages. Having mechanics solving problems similar to the problem the design pattern is solving was positive. In addition it was positive for a language to have flexible typing schemes, little overhead and attribute visibility control. No language was found to be clearly best suited, but individual strengths and weaknesses are discussed. i iiContents
I Introduction 1
1 Introduction 3
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2 Scope and Problem Statement . . . . . . . . . . . . . . . . . .
41.3 Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41.4 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41.5 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51.6 Work Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51.7 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61.8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61.9 Thesis Outline . . . . . . . . . . . . . . . . . . . . . . . . . . .
7II Theory 9
2 Background 11
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
112.2 Design Patterns Implementation . . . . . . . . . . . . . . . .
112.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
112.2.2 Implementation Description . . . . . . . . . . . . . .
112.2.3 Implementation Studies . . . . . . . . . . . . . . . . .
122.2.4 Implementation and Language . . . . . . . . . . . . .
122.3 Individual Papers . . . . . . . . . . . . . . . . . . . . . . . . .
132.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
132.3.2 GoHotDraw . . . . . . . . . . . . . . . . . . . . . . . .
132.3.3 Empirical Study of Github . . . . . . . . . . . . . . . .
132.3.4 On the Issue of Language Support . . . . . . . . . . .
14III Method 15
3 Methodology 17
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
173.2 Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
173.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
183.4 Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
193.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
193.4.2 Metric Selection . . . . . . . . . . . . . . . . . . . . . .
19 iii3.4.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . .20
3.4.4 Lines of code . . . . . . . . . . . . . . . . . . . . . . .
213.4.5 Cyclomatic complexity . . . . . . . . . . . . . . . . . .
233.4.6 Object Oriented Measures . . . . . . . . . . . . . . . .
243.4.7 Shallow References . . . . . . . . . . . . . . . . . . . .
263.4.8 NCLOC aggregation . . . . . . . . . . . . . . . . . . .
273.4.9 Code as Data . . . . . . . . . . . . . . . . . . . . . . .
283.5 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
293.5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
293.5.2 Definition . . . . . . . . . . . . . . . . . . . . . . . . .
293.5.3 Need For Validity . . . . . . . . . . . . . . . . . . . . .
293.5.4 Design and Implementation Philosophy . . . . . . . .
293.5.5 Well defined requirements . . . . . . . . . . . . . . . .
303.5.6 Model Design . . . . . . . . . . . . . . . . . . . . . . .
303.5.7 Visibility Relaxation . . . . . . . . . . . . . . . . . . .
313.5.8 Order of implementation . . . . . . . . . . . . . . . .
313.5.9 Agile selection of patterns . . . . . . . . . . . . . . . .
313.5.10 Pseudocode . . . . . . . . . . . . . . . . . . . . . . . .
323.5.11 Adapting Metrics to Go . . . . . . . . . . . . . . . . .
323.5.12 Further threats to validity . . . . . . . . . . . . . . . .
334 Cases 35
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
354.2 Composite . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
354.2.1 Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . .
354.2.2 The case . . . . . . . . . . . . . . . . . . . . . . . . . .
354.2.3 Usage example . . . . . . . . . . . . . . . . . . . . . .
374.2.4 Choices . . . . . . . . . . . . . . . . . . . . . . . . . . .
374.2.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . .
384.2.6 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . .
384.2.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . .
404.3 Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
404.3.1 Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . .
404.3.2 Case . . . . . . . . . . . . . . . . . . . . . . . . . . . .
414.3.3 Choices . . . . . . . . . . . . . . . . . . . . . . . . . . .
414.3.4 Usage example . . . . . . . . . . . . . . . . . . . . . .
424.3.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . .
424.3.6 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . .
434.4 Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
454.4.1 Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . .
454.4.2 Case . . . . . . . . . . . . . . . . . . . . . . . . . . . .
454.4.3 Choices . . . . . . . . . . . . . . . . . . . . . . . . . . .
464.4.4 Usage example . . . . . . . . . . . . . . . . . . . . . .
474.4.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . .
474.4.6 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . .
474.5 Decorator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
514.5.1 Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . .
514.5.2 Case . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51iv
4.5.3 Usage Example . . . . . . . . . . . . . . . . . . . . . .52
4.5.4 Modeling choices . . . . . . . . . . . . . . . . . . . . .
524.5.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . .
534.5.6 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . .
53IV Discussion and Conclusion 57
5 Analysis 59
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
595.2 Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
595.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
595.2.2 Proportion of Case"s NCLOC . . . . . . . . . . . . . .
605.2.3 Proportion of Language"s NCLOC . . . . . . . . . . .
605.2.4 Relative Size . . . . . . . . . . . . . . . . . . . . . . . .
605.2.5 Relative Verbosity of Language . . . . . . . . . . . . .
615.2.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . .
615.3 Cross case comparison . . . . . . . . . . . . . . . . . . . . . .
615.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
615.3.2 NCLOC . . . . . . . . . . . . . . . . . . . . . . . . . .
615.3.3 Cyclomatic complexity . . . . . . . . . . . . . . . . . .
625.3.4 Tree Related Metrics . . . . . . . . . . . . . . . . . . .
625.3.5 Shallow References . . . . . . . . . . . . . . . . . . . .
635.3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . .
635.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
636 Discussion 65
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
656.2 Core Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
656.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
656.2.2 The Issues . . . . . . . . . . . . . . . . . . . . . . . . .
656.2.3 Relevance . . . . . . . . . . . . . . . . . . . . . . . . .
666.2.4 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . .
676.2.5 Implications . . . . . . . . . . . . . . . . . . . . . . . .
676.3 Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
686.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
686.3.2 Python . . . . . . . . . . . . . . . . . . . . . . . . . . .
686.3.3 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . .
696.3.4 C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
706.3.5 Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
726.3.6 Smalltalk . . . . . . . . . . . . . . . . . . . . . . . . . .
736.3.7 Comparison . . . . . . . . . . . . . . . . . . . . . . . .
756.3.8 Generalization . . . . . . . . . . . . . . . . . . . . . .
766.4 Metric Validity . . . . . . . . . . . . . . . . . . . . . . . . . . .
786.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
786.4.2 Lines of Code . . . . . . . . . . . . . . . . . . . . . . .
796.4.3 Cyclomatic Complexity . . . . . . . . . . . . . . . . .
796.4.4 Tree Metrics . . . . . . . . . . . . . . . . . . . . . . . .
80v
6.4.5 Loose Class Cohesion . . . . . . . . . . . . . . . . . .80
6.4.6 Shallow References . . . . . . . . . . . . . . . . . . . .
816.4.7 Metric Coverage . . . . . . . . . . . . . . . . . . . . .
816.5 Comparing to Literature . . . . . . . . . . . . . . . . . . . . .
826.5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . .
826.5.2 GoHotDraw . . . . . . . . . . . . . . . . . . . . . . . .
826.5.3 Empirical Study of Github . . . . . . . . . . . . . . . .
826.5.4 On the Issue of Language Support . . . . . . . . . . .
836.5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . .
836.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
847 Conclusion 85
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
857.2 Highlights . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
857.3 Revisiting the Problem Statement . . . . . . . . . . . . . . . .
867.3.1 Differences . . . . . . . . . . . . . . . . . . . . . . . . .
867.3.2 Causes . . . . . . . . . . . . . . . . . . . . . . . . . . .
867.3.3 Trends . . . . . . . . . . . . . . . . . . . . . . . . . . .
877.3.4 Suitability . . . . . . . . . . . . . . . . . . . . . . . . .
887.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
898 Future work 91
8.1 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91A Essay 93
A.1 Design Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 94A.1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
A.1.2 Definition . . . . . . . . . . . . . . . . . . . . . . . . . 94
A.1.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
A.1.4 Relation to Implementation . . . . . . . . . . . . . . . 94
A.2 A Preliminary Experiment . . . . . . . . . . . . . . . . . . . . 95
A.2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . 95
A.2.2 Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
A.2.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
A.2.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
A.2.5 Discussion of Implementation Process . . . . . . . . . 97
A.2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . .quotesdbs_dbs20.pdfusesText_26