Intro to Grace: an open source educational programming language

No readers like this yet.

When it comes to picking a programming language to use when teaching people how to program, there are many, many options. Scratch is a good choice when teaching the basics because of its drag and drop building block method of programming. Python or Ruby are also good choices—both languages have a straight-forward syntax, are used in major real-world projects, and have excellent communities and supplemental projects built around them. Or there is Java, Objective-C, and C#, which are solid programming languages and marketable job skills. Honestly, they are all good choices, but when it comes to teaching programming in an academic setting, are they really the best way to go about doing it?

At 2015, Michael Homer, Postdoctoral Fellow at Victoria University of Wellington, talked about Grace, an open source programming language specifically designed to meet the needs of teaching and learning programming in an educational setting. Grace is built from the ground up using our current understanding of programming languages and education research on teaching programming. Many of the languages used in college classrooms to teach programming are older languages—the two most popular languages, Java and Python, are now decades old—that have developed a lot of cruft over the years. They are powerful, useful languages, but sometimes they are not beginner friendly and were not designed with teaching programming in mind. Grace is designed to be an educational language, so its design goal is to be as consistent and new-programmer friendly as possible.

Grace is has four major design principles.

  • Simple programs should be simple.
  • The language needs to have an understandable semantic model.
  • The language needs to support different teaching orders.
  • Be a general-purpose language.

For example the basic "Hello world" program in Grace is:

print "Hello world"

By comparison, the same program in Java is:

class HelloWorld {
	public static void main(String[] args) {
	System.out.println("Hello world");

The Grace example is much easier for a new programmer, and although every single part of the more complex Java code has a function, it will be some time before someone just learning to write Java code fully understands what everything means. Until they learn, everything is just an incantation that needs to be followed for the magic to work. This can confuse new programmers who do not yet understand all the rules.

Java can be confusing to new programmers. When I worked as a computer science tutor in college, I honestly spent more time teaching people how to figure out Java compiler error messages than I did helping them learn programming concepts, such as variables and loops. Homer gives an excellent example of just how confusing all this can be with his "favorite Java error":

class Counter {
	int total = 0;
	int add(int n) {
	return ( total += n);
	int addAllNegative(Iterable < Integer > all) {
		for ( int n : all )
		if (n < 0)
			int total = add( -n);
	return total;

In this example, the compiler displays error: ’.class’ expected" for the line "int total = add(-n);. The error message causes students to do what the error says and add .class (which causes an even bigger mess), when the actual problem is that they should not have included int. When they wrote that line of code, they used the same syntax they used in an earlier line of code, but it did not work here. Thankfully, OpenJDK 8 does not feature this problem and returns a much more sane, but not very new-programmer-friendly, error message: error: variable declaration not allowed here. Grace is designed from the ground up to be easy to understand for beginning programmers, whereas Java can sometimes make things confusing for non-experienced Java programmers.

Grace has many, many more features that make it easier to use to teach and learn programming. Watch the video (below) of Homer's talk for more details, especially his live demonstration. The demonstration features an interface for Grace that switches back and forth between a Scratch-like drag and drop functionality and standard text-based coding. Changes made in one mode automatically carry over to the other. It is an interesting learning tool and the two different programming methods for one language means that new programmers can carry over their knowledge of the language as they transition from building-block programming to writing code. The transition between building-block programming and writing code is much smoother if the learner is still using the same language, and being able to see code in two different styles is really helpful.

For an added bonus, check out Victoria University of Wellington's Timothy Jones's talk about implementing Hopper, a Grace interpreter, in Asynchronous JavaScript. It is a fascinating, if rather technical, look at the development of the Hopper interpreter:

Grace is an interesting language. I am not 100% sold on the need for a specialized language for teaching programming, but I do understand Homer's points and agree with many of them. That said, Grace has a lot to offer the diverse world of programming languages, and it could help learners focus on learning to code instead of dealing with some of the nuances and nuisances other languages have due to their lengthy existences. So if you are teaching other people how to code, check out Grace and see if it might work for you and your students. Then leave us a comment here and let us know what you think.

Open Source in

A collection of articles from educators, students, advocates, parents, and more who are implementing open source in education and working toward a more open knowledge base for everyone.

1 Comment

Hi Sir Joshua,

Thank you for sharing! This is the first time I encountered Grace Programming. I'll be rooting this one.

Thank you,


Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.