Grace

Grace is an object-oriented programming language intended for use in education. It uses gradual structural typing and a pure OO approach.

I built two implementations of Grace, and worked on the design of some language features using the language.

Minigrace is a self-hosted Grace compiler that generates C to run as native code and JavaScript to run in the browser. The design goal of Minigrace was to behave correctly on correct input

Kernan is a reference interpreter that aimed to conform to the Grace specification, and to behave correctly for both correct and incorrect code. Kernan is written in C#, compiles to the CLR, and runs through Mono or the .Net runtime on all platforms.

Tiled Grace is a drag-and-drop combined visual and textual editor for Grace using the Minigrace compiler as a backend. The visual editor is similar to Scratch, but the user can switch to editable textual code by pressing a button, and switch back at will later on.

Object Inheritance Without Classes. Timothy Jones, Michael Homer, James Noble, Kim Bruce. In ECOOP, 2016.

Which comes first: the object or the class? Language designers enjoy the conceptual simplicity of object-based languages (such as Emerald or Self) while many programmers prefer the pragmatic utility of classical inheritance (such as Simula and Java). Programmers in object-based languages have a tendency to build libraries to support traditional inheritance, and language implementations are often contorted to the same end. In this paper, we revisit the relationship between classes and objects. We model various kinds of inheritance in the context of an object-oriented language whose objects are not defined by classes, and explain why class inheritance and initialisation cannot be modelled purely by delegation.

Brand Objects for Nominal Typing. Timothy Jones, Michael Homer, James Noble. In ECOOP, 2015.

Combinations of structural and nominal object typing in systems such as Scala, Whiteoak, and Unity have focused on extending existing nominal, class-based systems with structural subtyping. The typical rules of nominal typing do not lend themselves to such an extension, resulting in major modifications. Adding object branding to an existing structural system integrates nominal and structural typing without excessively complicating the type system. We have implemented brand objects to explicitly type objects, using existing features of the structurally typed language Grace, along with a static type checker which treats the brands as nominal types. We demonstrate that the brands are useful in an existing implementation of Grace, and provide a formal model of the extension to the language.

Graceful Dialects. Michael Homer, Timothy Jones, James Noble, Kim B. Bruce, Andrew P. Black. In ECOOP, 2014.

Programming languages are enormously diverse, both in their essential concepts and in their accidental aspects. This creates a problem when teaching programming. To let students experience the diversity of essential concepts, the students must also be exposed to an overwhelming variety of accidental and irrelevant detail: the accidental differences between the languages are likely to obscure the teaching point. The dialect system of the Grace programming language allows instructors to tailor and vary the language to suit their courses, while staying within the same stylistic, syntactic and semantic framework, as well as permitting authors to define advanced internal domain-specific languages. The dialect system achieves this power though a combination of well-known language features: lexical nesting, lambda expressions, multi-part method names, optional typing, and plug gable checkers. Grace’s approach to dialects is validated by a series of case studies, including both extensions and restrictions of the base language.

Seeking Grace: A New Object-Oriented Language for Novices. Andrew P. Black, Kim B. Bruce, Michael Homer, James Noble, Amy Ruskin, Richard Yannow. In SIGCSE, 2013.

Grace is a new object-oriented language that supports a variety of approaches to teaching programming. It integrates accepted new ideas in programming languages into a simple language that allows students and teachers to focus on the essential complexities of programming rather than the accidental complexities of the language. We motivate Grace, review its design, and evaluate it against Kölling’s criteria.

Grace's Inheritance. James Noble, Andrew P. Black, Kim B. Bruce, Michael Homer, Timothy Jones. In JOT, Volume 16, no. 2, 2017.

This article is an apologia for the design of inheritance in the Grace educational programming language: it explains how the design of Grace’s inheritance draws from inheritance mechanisms in predecessor languages, and defends that design as the best of the available alternatives. For simplicity, Grace objects are generated from object constructors, like those of Emerald, Lua, and Javascript; for familiarity, the language also provides classes and inheritance, like Simula, Smalltalk and Java. The design question we address is whether or not object constructors can provide an inheritance semantics similar to classes.

From APIs to Languages: Generalising Method Names. Michael Homer, Timothy Jones, James Noble. In DLS, 2015.

Method names with multiple separate parts are a feature of many dynamic languages derived from Smalltalk. Generalising the syntax of method names to allow parts to be repeated, optional, or alternatives, means a single definition can respond to a whole family of method requests. We show how generalising method names can support flexible APIs for domain-specific languages, complex initialisation tasks, and control structures defined in libraries. We describe how we have extended Grace to support generalised method names, and prove that such an extension can be integrated into a gradually-typed language while preserving type soundness.

Combining Tiled and Textual Views of Code. Michael Homer, James Noble. In VISSOFT, 2014.

“Jigsaw puzzle” programming environments manipulate programs primarily by drag-and-drop. Generally these environments are based on their own special-purpose languages, meaning students must move on to another language as their programs grow. Tiled Grace is a tile-based editor for Grace, an educational programming language with a conventional textual syntax. Using Tiled Grace, programmers can move seamlessly between visualising their programs as tiles or source code, editing their programs via tiles or text, and continue on to traditional textual environments, all within the same programming language. We conducted a user experiment with Tiled Grace, and present the results of that experiment showing that users find dual views helpful.

A Tile-based Editor for a Textual Programming Language. Michael Homer, James Noble. In VISSOFT, 2013.

“Jigsaw puzzle” programming environments manipulate programs primarily by drag-and-drop. Generally these environments are based on their own special-purpose languages, meaning students must move on to another language as their programs grow. Tiled Grace is a tile-based editor for Grace, an educational programming language with a conventional textual syntax. Using Tiled Grace, programmers can move seamlessly between visualising their programs as tiles or source code, editing their programs via tiles or text, and continuing on to traditional textual environments, all within the same programming language.

Object Creation in Grace. Michael Homer, James Noble. In EuroPLoP, 2013.

We are engaged in the design of Grace, a new object-oriented open source programming language aimed at instructors and students in introductory programming courses. Grace aims to include features that have been found useful in software practice, while allowing multiple different teaching approaches without requiring that concepts be introduced to students before they are ready. While many aspects of Grace’s design will be familiar to most object-oriented programmers, Grace cleanly separates the concepts of “object”, “class”, and “type”, and so Grace offers more options for creating objects than most other languages. We have written these patterns to explain how Grace programmers should go about creating objects.

Patterns as Objects in Grace. Michael Homer, James Noble, Kim B. Bruce, Andrew P. Black, David J. Pearce. In DLS, 2012.

Object orientation and pattern matching are often seen as conflicting approaches to program design. Object-oriented programs place type-dependent behavior inside objects and invoke it via dynamic dispatch, while pattern-matching programs place type-dependent behavior outside data structures and invoke it via multiway conditionals (case statements). Grace is a new, dynamic, object-oriented language designed to support teaching: to this end, Grace needs to support both styles. We explain how this conflict can be resolved grace- fully: by modelling patterns and cases as partial functions, reifying those functions as objects, and then building up complex patterns from simpler ones using pattern combinators. We describe the implementation of this design as an object-oriented framework, and a case study of its effectiveness.

Graceful Patterns for Patterns in Grace. Michael Homer, James Noble. In PLoP, 2012.

Grace is a new object-oriented programming language aimed at education. Here we describe patterns relating to pattern-matching in this language.

Designing Grace: Can an Introductory Programming Language Support the Teaching of Software Engineering?. James Noble, Michael Homer, Kim B. Bruce, Andrew P. Black. In CSEE&T, 2013.

Many programming language constructs that support software engineering in the large — explicit variable declarations, explicit external dependencies, static types, information hiding, invariants — provide little benefit to the small programs written by novice programmers, where every extra syntactic token has to be explained and understood before novices can succeed in running even the simplest program. We are designing Grace, a new educational object-oriented language that we hope will prove useful for teaching both programming and software engineering. This paper describes some of the tradeoffs between teaching programming and teaching software engineering that we faced while designing Grace, and our attempts to address those tradeoffs.

Grace: the Absence of (Inessential) Difficulty. Andrew P. Black, Kim B. Bruce, Michael Homer, James Noble. In Onward!, 2012.

We are engaged in the design of a small, simple programming language for teaching novices object-oriented programming. This turns out to be far from a small, simple task. We focus on three of the problems that we encountered, and how we believe we have solved them. The problems are (1) gracefully combining object initialization, inheritance, and immutable objects, (2) reconciling apparently irreconcilable views on type-checking, and (3) providing a family of languages, each suitable for students at different levels of mastery, while ensuring conceptual integrity of their designs. In each case our solutions are based on existing research; our contribution is, by design, consolidation rather than innovation.

Towards collaborative block-based programming on digital tabletops. Ben Selwyn-Smith, Michael Homer, Craig Anslow. In B&B, 2017.

Block-based programming environments are typically designed for desktop machines or mobile devices. Desktops and mobiles are generally designed for single users to interact with, which makes it hard for multiple users to collaborate effectively. In this paper we explore the possibilities of digital multi-touch tabletops to foster collaborative programming in a block-based paradigm. We note both the different challenges afforded in this new interaction model and the potential benefits unique to collaborative programming with tabletops.

Lessons in Combining Block-Based and Textual Programming. Michael Homer, James Noble. In VLSS, Volume 3, 2017.

Tiled Grace is a block-based programming system backed by a conventional textual language that allows switching back and forth between block-based and textual editing of the same code at any time. We discuss the design choices of Tiled Grace in light of existing research and a user experiment conducted with it. We also examine the sorts of task preferred in each mode by users who had the choice of editing either as blocks or as text, and find both positive and cautionary notes for block-based programming in the results.

Toward Virtual Machine Adaption Rather than Reimplementation. Richard Roberts, Stefan Marr, Michael Homer, James Noble. In MoreVMs, 2017.

We adapt SOMns, a Truffle-based interpreter for Newspeak, to the Grace programming language. We highlight differences between the semantics of these languages and offer preliminary results showing that adaption is possible while retaining performance. The similarities between the languages promote the potential for adaption and code sharing between implementations. Through experimentation we intend to explore how the design of the tailored implementation; the flexibility of the underlying framework; and similarities between languages affect adaptability, and by doing so hope to realize a set of mechanisms that can be easily extended to create optimized virtual machines for object-orientated languages.

Beyond Types: Extending the Gradual Guarantee. James Noble, Michael Homer, Timothy Jones, Sophia Drossopolou, Andrew P. Black, Kim B. Bruce. In STOP, 2016.

The gradual guarantee lets us understand gradual typing: a system is gradually typed if removing a type annotation cannot change the semantics of a correct program. We extend the gradual guarantee beyond types: privacy annotations or inheritance restrictions, for example, may be gradual if changing them does not change the semantics of a correct program.

Modules as Gradually-Typed Objects. Michael Homer, James Noble, Kim B. Bruce, Andrew P. Black. In DYLA, 2013.

Grace is a gradually typed, object-oriented language for use in education. Grace needs a module system for several reasons: to teach students about modular program design, to organise large programs, especially its self-hosted implementation, and to provide access to resources defined in other languages. Grace uses its basic organising construct, objects, to provide modules, and is then able to use its gradual structural typing to obtain a number of interesting features without any additional mechanisms.

Michael Homer — 2018