Programming Journal, Volume 6, Issue 3
The Art, Science, and Engineering of Programming
Powered by
Conference Publishing Consulting

PROGJC – Journal Issue

Contents - Abstracts - Authors


Title Page

Message from the Chairs




Figuring and Drawing: A Visual Approach to Principled Programming
Elpida Keravnou-Papailiou
(University of Cyprus, Cyprus)
A standing challenge in undergraduate Computer Science curricula is the teaching and learning of computer programming. Through this paper which is an essay about programming, we aim to contribute to the plethora of existing pedagogies, approaches and philosophies, by discussing a specific feature of our approach in teaching principled programming to undergraduate students, in their first semester of studies, namely the utilization of pictures, both text-based and raster-based graphics. Although the given course has evolved substantially over the thirty years of its delivery regarding the programming languages (Miranda, C, C++, Java) and paradigms (functional, imperative, object-oriented, combination of procedural and object-oriented) used, the discussed visual feature has been maintained and steadily strengthened.
We list abstraction, problem decomposition and synthesis, information hiding, reusability, modularity and extensibility as key principles of problem solving and algorithmic thinking. These principles are closely aligned with the advocated computational thinking techniques of problem decomposition, pattern recognition, pattern generalization and algorithm design. We aim for our students to familiarize themselves with all the above principles through practical problem solving. Our ongoing inquiry has been whether the problem domain of pictures is contributing valuably towards this aim. Moreover, an added-value is that students get a glimpse of computational complexity in a visual, empirical way.
The presented work is not related to visual programming, since the students write their programs textually and not graphically; it's the output of their programs which is in visual form. Our approach though is loosely related to the classical paradigm of turtle graphics. However, our focus is Computer Science majors, who should be able to design and build turtles and other objects and not just use them. Indeed, the programming principles course helps them to do both and also to appreciate the multitude of algorithmic ways for producing the same visual output. Currently the given programming principles are approached both from a procedural, process-based and an object-oriented, concept-based perspective and the course uses the Java language. Through the presented example problems, we aim to show the appropriateness of the visual domain of pictures for supporting the learning of principled programming. The problem domain of pictures is abundantly rich with potential examples to draw from. Moreover, as reported in the literature, female students may show higher interest towards visual problem domains in programming classes, in relation to other problem domains. We plan to investigate this conjecture in the context of our broader aim to encourage more females to follow university studies in computer science; in this paper only a cursory finding is presented, that bears some relation to what is reported in the literature.

Publisher's Version
United Monoids: Finding Simplicial Sets and Labelled Algebraic Graphs in Trees
Andrey Mokhov
(Jane Street, UK; Newcastle University, UK)
Graphs and various graph-like combinatorial structures, such as preorders and hypergraphs, are ubiquitous in programming. This paper focuses on representing graphs in a purely functional programming language like Haskell. There are several existing approaches; one of the most recently developed ones is the “algebraic graphs” approach (2017). It uses an algebraic data type to represent graphs and has attracted users, including from industry, due to its emphasis on equational reasoning and making a common class of bugs impossible by eliminating internal invariants.
The previous formulation of algebraic graphs did not support edge labels, which was a serious practical limitation. In this paper, we redesign the main algebraic data type and remove this limitation. We follow a fairly standard approach of parameterising a data structure with a semiring of edge labels. The new formulation is both more general and simpler: the two operations for composing graphs used in the previous work can now be obtained from a single operation by fixing the semiring parameter to zero and one, respectively.
By instantiating the new data type with different semirings, and working out laws for interpreting the resulting expression trees, we discover an unusual algebraic structure, which we call “united monoids”, that is, a pair of monoids whose unit elements coincide. We believe that it is worth studying united monoids in their full generality, going beyond the graphs which prompted their discovery. To that end, we characterise united monoids with a minimal set of axioms, prove a few basic theorems, and discuss several notable examples.
We validate the presented approach by implementing it in the open-source algebraic-graphs library. Our theoretical contributions are supported by proofs that are included in the paper and have also been machine-checked in Agda. By extending algebraic graphs with support for edge labels, we make them suitable for a much larger class of possible applications. By studying united monoids, we provide a theoretical foundation for further research in this area.

Publisher's Version
Debootstrapping without Archeology: Stacked Implementations in Camlboot
Nathanaëlle Courant ORCID logo, Julien Lepiller ORCID logo, and Gabriel Scherer ORCID logo
(Inria, France; Yale University, USA)
Context It is common for programming languages that their reference implementation is implemented in the language itself. This requires a “bootstrap”: a copy of a previous version of the implementation is provided along with the sources, to be able to run the implementation itself.
Those bootstrap files are opaque binaries; they could contain bugs, or even malicious changes that could reproduce themselves when running the source version of the language implementation – this is called the “trusting trust attack”. For this reason, a collective project called Bootstrappable was launched in 2016 to remove those bootstraps, providing alternative build paths that do not rely on opaque binaries.
Inquiry Debootstrapping generally combines a mix of two approaches. The “archaeological” approach works by locating old versions of systems, or legacy alternative implementations, that do not need the bootstrap, and by preserving or restoring the ability to run them. The “tailored” approach re-implements a new, non-bootstrapped implementation of the system to debootstrap. Currently, the “tailored” approach is dominant for low-level system components (C, coreutils), and the “archaeological” approach is dominant among the few higher-level languages that were debootstrapped.
Approach We advocate for the benefits of “tailored” debootstrapping implementations of high-level languages. The new implementation needs not be production-ready, it suffices that it is able to run the reference implementation correctly. We argue that this is feasible with a reasonable development effort, with several side benefits besides debootstrapping.
Knowledge We propose a specific design of composing/stacking several implementations: a reference interpreter for the language of interest, implemented in a small subset of the language, and a compiler for this small subset (in another language). Developing a reference interpreter is valuable independently of debootstrapping: it may help clarify the language semantics, and can be reused for other purposes such as differential testing of the other implementations.
Grounding We present Camlboot, our project to debootstrap the OCaml compiler, version 4.07. Once we converged on this final design, the last version of Camlboot took about a person-month of implementation effort, demonstrating feasibility. Using diverse double-compilation, we were able to prove the absence of trusting trust attack in the existing bootstrap of the standard OCaml implementation.
Importance To our knowledge, this document is the first scholarly discussion of “tailored” debootstrapping for high-level programming languages. Debootstrapping is an interesting problem which recently grew an active community of free software contributors, but so far the interactions with the programming-language research community have been minimal. We share our experience on Camlboot, trying to highlight aspects that are of interest to other language designers and implementors; we hope to foster stronger ties between the Bootstrappable project and relevant academic communities. In particular, the debootstrapping experience has been an interesting reflection on OCaml design and implementation, and we hope that other language implementors would find it equally valuable.

Publisher's Version
Topology-Level Reactivity in Distributed Reactive Programs: Reactive Acquaintance Management using Flocks
Sam Van den Vonder ORCID logo, Thierry Renaux ORCID logo, and Wolfgang De Meuter ORCID logo
(Vrije Universiteit Brussel, Belgium)
Reactive programming is a popular paradigm to program event-driven applications, and it is often proposed as a paradigm to write distributed applications. One such type of application is prosumer applications, which are distributed applications that both produce and consume many events. We analyse the problems that occur when using a reactive programming language or framework to implement prosumer applications. We find that the assumption of an open network, which means prosumers of various types spontaneously join and leave the network, can cause a lot of code complexity or run-time inefficiency. At the basis of these issues lies acquaintance management: the ability to discover prosumers as they join and leave the network, and correctly maintaining this state throughout the reactive program. Most existing reactive programming languages and frameworks have limited support for managing acquaintances, resulting in accidental complexity of the code or inefficient computations.
In this paper we present acquaintance management for reactive programs. First, we design an acquaintance discovery mechanism to create a flock that automatically discovers prosumers on the network. An important aspect of flocks is their integration with reactive programs, such that a reactive program can correctly and efficiently maintain its state. To this end we design an acquaintance maintenance mechanism: a new type of operator for functional reactive programming languages that we call “deploy-*”. The deploy-* operator enables correct and efficient reactions to time-varying collections of discovered prosumers.
The proposed mechanisms are implemented in a reactive programming language called Stella, which serves as a linguistic vehicle to demonstrate the ideas of our approach. Our implementation of acquaintance management results in computationally efficient and idiomatic reactive code. We evaluate our approach quantitatively via benchmarks that show that our implementation is efficient: computations will efficiently update whenever a new prosumer is discovered, or a connected prosumer is dropped. To evaluate the distributed capabilities of our prototype implementation, we implement a use-case that simulates the bike-sharing infrastructure of Brussels, and we run it on a Raspberry Pi cluster computer.
We consider our work to be an important step to use functional reactive programming to build distributed systems for open networks, in other words, distributed reactive programs that involve many prosumer devices and sensors that spontaneously join and leave the network.

Publisher's Version

proc time: 1.99