File Download
Supplementary
-
Citations:
- Appears in Collections:
postgraduate thesis: Modularity beyond compositionality
Title | Modularity beyond compositionality |
---|---|
Authors | |
Advisors | Advisor(s):Dos Santos Oliveira, BC |
Issue Date | 2021 |
Publisher | The University of Hong Kong (Pokfulam, Hong Kong) |
Citation | Zhang, W. [张炜昕]. (2021). Modularity beyond compositionality. (Thesis). University of Hong Kong, Pokfulam, Hong Kong SAR. |
Abstract | Modern software becomes increasingly complex and rapid-evolving. The cost of developing and maintaining software systems is extremely high. To reduce the engineering effort involved in developing and maintaining software systems, modularity plays an important role. A modular way to develop software will subdivide a software system into a bunch of smaller components. Each of those components can then be of a manageable size, can be developed in parallel with isolated functionality assigned to specific programmers. The components should be extensible so that new functionality can be added easily without affecting other existing components. However, such a modular extensible style of component-based software development is not widely applicable in practice due to inadequate support from the modularization techniques in programming languages.
This thesis aims at investigating techniques on programming languages that support modular extensible software development from three perspectives: plain design patterns, metaprogramming-based design patterns, and novel language designs. Plain design patterns can be directly applied in existing programming languages. Existing languages have an advantage that programmers are already familiar with, allowing a wider application of the modularization technique without a steep learning curve. With the help of metaprogramming, the boilerplate code associated with the design patterns can be automated. However, existing languages are sometimes too restrictive in terms of syntax and semantics, which might not be expressive or concise enough for certain cases. For such cases, new programming languages (features) suit better.
The first part of the thesis focuses on plain design patterns. We connect shallow embeddings to Object-Oriented Programming (OOP) via procedural abstraction. We argue that common OOP mechanisms increase the modularity and reuse of shallow EDSLs. We make our arguments by using Gibbons and Wu’s examples, where procedural abstraction is used in Haskell to model a simple shallow EDSL. We recode that EDSL in Scala and with an improved OO-inspired Haskell encoding. We further illustrate our approach with a case study on refactoring a deep external SQL query processor to make it more modular, shallow, and embedded.
The second part of the thesis turns to metaprogramming-based design patterns. We present Castor, a Scala framework for programming with extensible, generative visitors. Castor has several advantages over previous approaches including its support for pattern matching, type-safe interpreters, imperative style visitors, and graphs. The applicability of Castor is shown by several examples and two case studies on modularizing interpreters from the “Types and Programming Languages” book and UML activity diagrams.
The last part of the thesis is on novel language designs. We propose a programming style called Compositional Programming. We introduce four key concepts for Composi- tional Programming: compositional interfaces, compositional traits, method patterns, and nested trait composition. Altogether these concepts allow us to naturally solve challenges such as the Expression Problem, model attribute-grammar-like programs, and generally deal with modular programs with complex dependencies. We present a language design, called CP, which is proved to be type-safe, together with several examples and three case studies. |
Degree | Doctor of Philosophy |
Subject | Programming languages (Electronic computers) |
Dept/Program | Computer Science |
Persistent Identifier | http://hdl.handle.net/10722/301072 |
DC Field | Value | Language |
---|---|---|
dc.contributor.advisor | Dos Santos Oliveira, BC | - |
dc.contributor.author | Zhang, Weixin | - |
dc.contributor.author | 张炜昕 | - |
dc.date.accessioned | 2021-07-16T14:38:46Z | - |
dc.date.available | 2021-07-16T14:38:46Z | - |
dc.date.issued | 2021 | - |
dc.identifier.citation | Zhang, W. [张炜昕]. (2021). Modularity beyond compositionality. (Thesis). University of Hong Kong, Pokfulam, Hong Kong SAR. | - |
dc.identifier.uri | http://hdl.handle.net/10722/301072 | - |
dc.description.abstract | Modern software becomes increasingly complex and rapid-evolving. The cost of developing and maintaining software systems is extremely high. To reduce the engineering effort involved in developing and maintaining software systems, modularity plays an important role. A modular way to develop software will subdivide a software system into a bunch of smaller components. Each of those components can then be of a manageable size, can be developed in parallel with isolated functionality assigned to specific programmers. The components should be extensible so that new functionality can be added easily without affecting other existing components. However, such a modular extensible style of component-based software development is not widely applicable in practice due to inadequate support from the modularization techniques in programming languages. This thesis aims at investigating techniques on programming languages that support modular extensible software development from three perspectives: plain design patterns, metaprogramming-based design patterns, and novel language designs. Plain design patterns can be directly applied in existing programming languages. Existing languages have an advantage that programmers are already familiar with, allowing a wider application of the modularization technique without a steep learning curve. With the help of metaprogramming, the boilerplate code associated with the design patterns can be automated. However, existing languages are sometimes too restrictive in terms of syntax and semantics, which might not be expressive or concise enough for certain cases. For such cases, new programming languages (features) suit better. The first part of the thesis focuses on plain design patterns. We connect shallow embeddings to Object-Oriented Programming (OOP) via procedural abstraction. We argue that common OOP mechanisms increase the modularity and reuse of shallow EDSLs. We make our arguments by using Gibbons and Wu’s examples, where procedural abstraction is used in Haskell to model a simple shallow EDSL. We recode that EDSL in Scala and with an improved OO-inspired Haskell encoding. We further illustrate our approach with a case study on refactoring a deep external SQL query processor to make it more modular, shallow, and embedded. The second part of the thesis turns to metaprogramming-based design patterns. We present Castor, a Scala framework for programming with extensible, generative visitors. Castor has several advantages over previous approaches including its support for pattern matching, type-safe interpreters, imperative style visitors, and graphs. The applicability of Castor is shown by several examples and two case studies on modularizing interpreters from the “Types and Programming Languages” book and UML activity diagrams. The last part of the thesis is on novel language designs. We propose a programming style called Compositional Programming. We introduce four key concepts for Composi- tional Programming: compositional interfaces, compositional traits, method patterns, and nested trait composition. Altogether these concepts allow us to naturally solve challenges such as the Expression Problem, model attribute-grammar-like programs, and generally deal with modular programs with complex dependencies. We present a language design, called CP, which is proved to be type-safe, together with several examples and three case studies. | - |
dc.language | eng | - |
dc.publisher | The University of Hong Kong (Pokfulam, Hong Kong) | - |
dc.relation.ispartof | HKU Theses Online (HKUTO) | - |
dc.rights | The author retains all proprietary rights, (such as patent rights) and the right to use in future works. | - |
dc.rights | This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. | - |
dc.subject.lcsh | Programming languages (Electronic computers) | - |
dc.title | Modularity beyond compositionality | - |
dc.type | PG_Thesis | - |
dc.description.thesisname | Doctor of Philosophy | - |
dc.description.thesislevel | Doctoral | - |
dc.description.thesisdiscipline | Computer Science | - |
dc.description.nature | published_or_final_version | - |
dc.date.hkucongregation | 2021 | - |
dc.identifier.mmsid | 991044390191103414 | - |