
Polyglot Programming A business perspective Hans-Christian Fjeldberg Master of Science in Computer Science Submission date: June 2008 Supervisor: Hallvard Trætteberg, IDI Co-supervisor: Carl Christensen, Bekk Consulting AS Norwegian University of Science and Technology Department of Computer and Information Science Problem Description Polyglot programming is the activity of using several programming languages in a software system. This is commonly used in the industry, for example when embedding SQL in code, but not much research has been done on this topic. The goal of this master thesis is twofold: 1. Get an understanding of methods and techniques for polyglot programming and integration, when these are applicable, and positive and negative effects of polyglot programming. 2. Showing how polyglot programming is used in industrial projects today, and formulate guidelines for the use of polyglot programming based on these experiences. This master thesis should give the industry in general, and Bekk Consulting AS in particular better measures for deciding whether polyglot programming is the right choice for a particular project. It should also give polyglot programming more credibility by researching scenarios that give business value, not only confirming that something is possible. Assignment given: 15. January 2008 Supervisor: Hallvard Trætteberg, IDI Acknowledgements First of all would I like to thank Christian Schwarz, whose help has been es- sential in organising this master thesis. The supervisor for this thesis has been Hallvard Trætteberg at NTNU, and co-superviser has been Carl Christensen at BEKK. Thank you both for guiding me through this process. For excellent proof reading, I would like to thank Liv Marie Gustavson. The case study could not have been done without some willing interview sub- jects. For this, I would like to thank consultants at BEKK and representatives of the customers. Additional interviews have also been conducted to get a broader view of poly- glot programming, and I would like to thank Neal Ford, Ola Bini and Jay Fields, and finally Aslak Hellesøy who put me in touch with these three. Trondheim, June 10th, 2008 Hans-Christian Fjeldberg i Abstract Polyglot programming is the activity of programming in more than one lan- guage within the same context. Much like humans use different languages to make expressions more effective, the goal of polyglot programming is to render simpler solutions by combining the best solutions from different pro- gramming languages. Because the term polyglot programming has been coined only recently, no aca- demic research has been done on polyglot programming before. This research has therefore consisted of a literature study to synthesise the opinions of those who have discussed polyglot programming, and an explorative case study to research how polyglot programming is used in a Norwegian consulting firm. The focus of the research has been business benefits and problems. During the literature study, the expected advantages and disadvantages were found, in addition to examples were polyglot programming can give business value. A part of the literature study has also been a description of the different language paradigms, and a layered description of how they can be organised. The case study consisted of three smaller case studies, which were analysed based on the theoretical propositions discovered in the literature study, namely the perceived advantages and disadvantages. Using pattern matching, poly- glot programming was found to offer increased productivity, and in the only case where it was addressed, easier maintenance. In addition, the use of poly- glot programming helped motivate and change the developers’ perspective. It was also found that the frameworks written in the new languages were easy to learn because they offered a more natural solution to the problem, discrediting the perceived disadvantage of lack of knowledge. The disadvantage of tool support was, however, confirmed. Based on the literature study and case study, guidelines for how to utilise poly- glot programming are also described, and as a compromise between having free and no language choice, it is suggested that a set of languages should be used. This set should consist of different types of languages, and will give the developers more flexibility, and at the same time give management control over which languages are used. iii Contents Acknowledgements i Abstract iii 1 Introduction 1 1.1 Research method . .2 1.2 Research contributions . .2 2 Research context 3 2.1 Research goal . .3 2.2 Research questions . .4 2.3 Research approach . .4 2.3.1 Literature study . .4 3 Polyglot programming 5 3.1 Definition . .5 3.2 Advantages associated with polyglot programming . .6 3.2.1 Productivity . .7 3.2.2 Maintainability . .8 3.3 Disadvantages associated with polyglot programming . .8 3.3.1 Knowledge . .9 3.3.2 Maintainability . .9 3.3.3 Developer tools support . .9 3.4 Summary . 10 v 4 Technical platforms 11 4.1 The business platforms . 11 4.1.1 The .NET platform . 12 4.1.2 The Java platform . 13 4.1.3 Comparison of the polyglot programming support in the .NET and the Java platforms . 15 4.2 Language classification . 15 4.2.1 The imperative paradigm . 16 4.2.2 The object oriented paradigm . 16 4.2.3 The functional paradigm . 17 4.2.4 The logical paradigm . 19 4.2.5 Statically or dynamically typed languages . 19 4.2.6 Domain specific languages . 20 4.2.7 The language layers . 21 4.3 Summary . 22 5 Examples 23 5.1 Web development . 23 5.2 Testing . 24 5.3 Concurrency . 26 5.4 Business rules . 27 5.5 Summary . 28 6 Research process 29 6.1 Case study research . 29 6.1.1 Data collection . 30 6.1.2 Data analysis . 31 6.2 Case study design . 32 6.2.1 Data collection . 32 6.2.2 Data analysis . 33 6.3 Case study implementation . 33 vi 6.3.1 Data collection . 33 7 Bekk Consulting AS - A case study 35 7.1 Web development . 35 7.1.1 Buypass . 36 7.1.2 Web based extranet solution . 37 7.2 Testing . 39 7.2.1 Statens vegvesen . 39 7.3 Summary . 39 8 Discussion 41 8.1 Polyglot programming context of the cases . 41 8.2 Advantages . 42 8.2.1 Productivity . 42 8.2.2 Maintainability . 42 8.2.3 Motivation and change of perspective . 43 8.3 Disadvantages . 43 8.3.1 Knowledge . 43 8.3.2 Maintainability . 44 8.3.3 Tool support . 45 8.4 Critique of polyglot programming . 46 8.5 Research questions . 46 8.5.1 RQ1: How is polyglot programming used today? . 46 8.5.2 RQ2: Guidelines for using polyglot programming . 46 9 Conclusion 49 References 51 A Interviews 57 A.1 Neal Ford . 58 A.2 Ola Bini . 61 vii A.3 Jay Fields . 64 B Technologies used in the case studies 67 B.1 Ruby . 67 B.2 Ruby on Rails . 68 B.3 RSpec . 68 B.4 Watir . 69 C Abbreviations 71 viii List of Figures 4.1 The relationship between DLR, CLR, CTS and CLS . 12 4.2 The relationship between different parts of the Java platform . 14 4.3 The relationship between the stable, dynamic and domain layer. 22 7.1 Buypass’ architecture . 37 ix List of Tables 3.1 Levels of polyglot programming of the example architectures .7 xi Chapter 1 Introduction Throughout much of the last decade, the focus in business has been on one standard language for software development, mainly C# or Java. The ratio- nale for this is that it makes things easier, both for the developers, manage- ment when tutoring and hiring employees and the system administrators. The rationale is not wrong, but ignores one important aspect. In enterprise de- velopment, the programming environment is partly language, but more so frameworks. Normally, frameworks for XML, SQL, web development and web services are used to make it easier for the developers. So even though all these frameworks are written in the same language, they introduce new ab- stractions and normally require extensive knowledge on how to configure the framework. It is therefore a good idea to look for languages that can do the same job as the framework, but better. If it is more naturally implemented in the other language, the cost of learning a new language will be equivalent to learning a new framework (Fowler, 2007a). This approach has been coined polyglot programming. To be a polyglot is to know or use several languages, and is manifested with the introduction of English words in non-English languages, like for example Norwegian. One extreme example of polyglotism is the upper class Lebanese, who speak a mix of French, English and Arabic at the same time. Even though this is not al- ways useful, sometimes expressions in another language are more effective than translating the expression to the native language. Applied to software engineering, to be a polyglot is to use several program- ming languages when creating software. This is used extensively in practise, for example SQL and HTML embedded in PHP code, but only limited research has been conducted on this topic. Even though polyglot programming is pos- sible, it is more important to emphasise the real business benefits of using it. Possible examples include testing, concurrency, and web development. Prob- lems to consider include management issues like training and support for new 1 CHAPTER 1. INTRODUCTION languages. It is also important to have a good framework for choosing the correct language to solve the problem at hand. 1.1 Research method The chosen research methods for this research are a literature study to get an extensive overview of the field, and an explorative case study to investigate how polyglot programming is used in a Norwegian consulting firm.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages91 Page
-
File Size-