Compositional Programming

2021 ◽  
Vol 43 (3) ◽  
pp. 1-61
Author(s):  
Weixin Zhang ◽  
Yaozhu Sun ◽  
Bruno C. D. S. Oliveira

Modularity is a key concern in programming. However, programming languages remain limited in terms of modularity and extensibility. Small canonical problems, such as the Expression Problem (EP), illustrate some of the basic issues: the dilemma between choosing one kind of extensibility over another one in most programming languages. Other problems, such as how to express dependencies in a modular way, add up to the basic issues and remain a significant challenge. This article presents a new statically typed modular programming style called Compositional Programming . In Compositional Programming, there is no EP: It is easy to get extensibility in multiple dimensions (i.e., it is easy to add new variants as well as new operations). Compositional Programming offers an alternative way to model data structures that differs from both algebraic datatypes in functional programming and conventional OOP class hierarchies. We introduce four key concepts for Compositional 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.

Author(s):  
Norihiro Yamada ◽  
Samson Abramsky

Abstract The present work achieves a mathematical, in particular syntax-independent, formulation of dynamics and intensionality of computation in terms of games and strategies. Specifically, we give game semantics of a higher-order programming language that distinguishes programmes with the same value yet different algorithms (or intensionality) and the hiding operation on strategies that precisely corresponds to the (small-step) operational semantics (or dynamics) of the language. Categorically, our games and strategies give rise to a cartesian closed bicategory, and our game semantics forms an instance of a bicategorical generalisation of the standard interpretation of functional programming languages in cartesian closed categories. This work is intended to be a step towards a mathematical foundation of intensional and dynamic aspects of logic and computation; it should be applicable to a wide range of logics and computations.


2021 ◽  
Vol 30 (3) ◽  
pp. 1-56
Author(s):  
Mouna Abidi ◽  
Md Saidur Rahman ◽  
Moses Openja ◽  
Foutse Khomh

Nowadays, modern applications are developed using components written in different programming languages and technologies. The cost benefits of reuse and the advantages of each programming language are two main incentives behind the proliferation of such systems. However, as the number of languages increases, so do the challenges related to the development and maintenance of these systems. In such situations, developers may introduce design smells (i.e., anti-patterns and code smells) which are symptoms of poor design and implementation choices. Design smells are defined as poor design and coding choices that can negatively impact the quality of a software program despite satisfying functional requirements. Studies on mono-language systems suggest that the presence of design smells may indicate a higher risk of future bugs and affects code comprehension, thus making systems harder to maintain. However, the impact of multi-language design smells on software quality such as fault-proneness is yet to be investigated. In this article, we present an approach to detect multi-language design smells in the context of JNI systems. We then investigate the prevalence of those design smells and their impacts on fault-proneness. Specifically, we detect 15 design smells in 98 releases of 9 open-source JNI projects. Our results show that the design smells are prevalent in the selected projects and persist throughout the releases of the systems. We observe that, in the analyzed systems, 33.95% of the files involving communications between Java and C/C++ contain occurrences of multi-language design smells. Some kinds of smells are more prevalent than others, e.g., Unused Parameters , Too Much Scattering , and Unused Method Declaration . Our results suggest that files with multi-language design smells can often be more associated with bugs than files without these smells, and that specific smells are more correlated to fault-proneness than others. From analyzing fault-inducing commit messages, we also extracted activities that are more likely to introduce bugs in smelly files. We believe that our findings are important for practitioners as it can help them prioritize design smells during the maintenance of multi-language systems.


Author(s):  
Igor Oblomov ◽  
Vyacheslav Rzhavin ◽  
Natalia Pervova ◽  
Alina Gerasimova

В статье рассматривается модель синтаксически управляемого перевода простых арифметических выражений и ее использование в процессе обучения. Атрибутно-транслируемая грамматика предполагает перевод последовательности актов в последовательность действий, которые, в свою очередь, будут являться исходными данными для следующих этапов трансляции. Раскрываются основные моменты обучения студентов декларативному языку программирования Пролог, делается упор на обработку множества символов действия. Дальнейшие исследования предполагают разработку моделей синтаксического анализа с помощью средств императивных и функциональных языков программирования с целью получения и анализа объективных оценок эффективности полученных моделей в процессе обучения будущих специалистов.This article discusses the model of syntactically controlled translation of simple arithmetic expressions and its use in the learning process. The attribute-translated grammar involves the translation of a sequence of acts into a sequence of actions, which will be the source data for the next stages of translation. The article reveals the main points of teaching students the Prolog programming language, focuses on the processing of many action symbols. Further research involves the development of models of syntactic analysis by means of imperative and functional programming languages in order to obtain and analyze the objective estimates of the effectiveness of the obtained models in the training of future specialists.


1994 ◽  
Vol 4 (1) ◽  
pp. 47-63 ◽  
Author(s):  
Rafael D. Lins ◽  
Simon J. Thompson ◽  
Simon Peyton Jones

AbstractIn this paper we present an equivalence between TIM, a machine developed to implement non-strict functional programming languages, and the set of Categorical Multi-Combinators, a rewriting system developed with similar aims. These two models of computation at first appear to be quite different, but we show a direct equivalence between them, thereby adding some new structure to the ‘design-space’ of abstract machines for non-strict languages.


Sign in / Sign up

Export Citation Format

Share Document