Grace: an open source educational OO languageΒΆ

Authors:James Noble
Time:3:50 pm - 4:30 pm

Grace is an open source educational OO language.

The languages currently used to teach programming are adequate, but they’re tailored for industrial sized problems, with features to match. These aren’t always what’s needed for teaching.

Grace is targeted at CS1 or CS2 students, with lots of flexibility for how the instructor wants to teach things. This means optional types to support different teaching orders. In Grace, simple programs should be simple. They should have an understandable semantic model, and it should be a general purpose language. [This sounds a lot like my experience teaching: minimal magic is important when you’re teaching people how to program.] Grace programs are not supposed to have “incantations” [OK, it’s exactly what Vern & I concluded.] Incantations, like “public static void” in your first Java program aren’t meaningless, but they don’t mean anything to the beginning programmer. This leads to things like students marking every method they write public static, which is not what they want.

Grace is not exciting like other languages discussed today. It’s taking old ideas and trying to combine them for a particular purpose.

Grace distinguishes mutable and immutable bindings through the use of different keywords (var, def, respectively). And you can teach either functions or objects first, depending on the pedagogy.

Grace has optional typing, and when used, types come after the name. Things that are “more important” come closer to the beginning of the line.

Grace supports “method requests”: everything (operators, calls, print, control structures, everything) comes down to a method request. This undergirds the consistent semantic model: no exceptions to explain to beginning programmers. This also implies that there are blocks and lambdas, although you don’t have to expose students to them. Finally, because they’re method requests, you can add your own control structures for students (i.e., a while block with an explicit invariant).

method while(c: Block) do(a: Block) {
  c.apply.ifTrue {

Grace provides data hiding support for objects using annotations:

def pt = object {
  var x := 2
  var y is readable := 3
  var z is public, readable, writable := 4

Trying to access x will give no such methods; y will give requested confidential method. And you can also add your own annotations [consistent semantic model].

Grace is designed to prevent null pointer exceptions, to allow students to focus on the basics of writing programs.

Grace is still under development: nothing is set in stone, but some things are “stone adjacent”.

Project Versions

Previous topic


Next topic

Elixir: Modern Programming for the Erlang VM

This Page