Previous Attempts to Solve this Problem


The fact that Java is not the easiest or best language for teaching programming has been recognised by a number of people, and there have already been a few attempts to create languages and environments to help with this.

The JMac System

A previous student of the Department of Computing at Imperial College worked on such a system for a project. The result of their work was a system called JMac[4]. The main feature of JMac is a very nice Integrated Development Environment created using the Java Swing classes. This IDE is very well designed and it would be hard to find any substantial improvements to make upon it in terms of usability.

JMac also provides a simple programming language. When a program has been written the system translates the code into Java, compiles and runs it. However, the translation between JMac and Java is not as clean as it perhaps could be. For instance, the following is the code for the "Hello World" program in JMac:

print("Hello World");

This is fine, and perfectly simple, but asking the system to parse this code and create Java produces the following code:

/**
 *  A JMac Program
 */

class JMacProgram extends JMacLibrary {

      ///////////// Variable Declaration ///////////////

      /////////////  Array Declaration   ///////////////

      /** Constructor */
      JMacProgram() {

            //////////////     Program Code  //////////////
            print("Hello World");
      }

      /////////////  Method Declaration /////////////

      /** The main entry */
      public static void main(String[] args) {

          /* Creates a new JMacProgram */
          JMacProgram myJMacProgram = new JMacProgram();
      }

      ///////////// Advanced Program Code /////////////

}

It is not at all obvious to an introductory programmer what this does. Consider this program in terms of the the kinds of concerns previously raised about the problems for an introductory programmer of understanding some of Java's complexities: what is a class? What does extends do? What is a constructor? ...

Even an experienced Java programmer cannot understand from this code alone how the program works, as no source code is shown for the JMacLibrary class and so it is not known what functionality this provides. Also, the JMac program is simply quoted verbatim in the Java program, so it cannot be seen how the same functionality is achieved in Java.

This is not very useful as a step towards learning Java. It would be much better if on parsing the JMac program some Java code was produced that was equivalent in function to the original JMac program and was self contained (i.e. it should be the Java code that a programmer would write if they were trying to solve the same problem in Java as they have just solved using the simpler language.)

BlueJ

BlueJ[5] is a research project, supported by Sun Microsystems, in the "Blue" group at the School of Network Computing, Monash University, Australia. The aim of BlueJ is to provide an easy-to-use teaching environment for the Java language that facilitates its teaching to first year students. The designers of BlueJ have identified several problems with existing environments and aim to overcome these.

BlueJ also overcomes two problems associated with teaching Java caused by the language itself, namely the need to write a main function, and the difficulties with textual input and output. This project will also address these issues.

JJ

JJ[6] is a programming language and environment designed for learning Java. It was developed at Caltech by David Epstein and John Motil. JJ is a subset of Java, and was designed to offer the ideal syntax for teaching programming to first year computer science students. The designers had four main goals:

JJ is an introduction to Java, and shares with this project the technique of translation from the teaching language to Java. The translation is done line by line, one line of JJ translating to one line of Java. However, although JJ is supposed to be a subset of Java, most of the keywords, and some of the syntax, are substantially different. For instance, the designers decided to apply a "command word rule" to the language design. This rule states that every command begins with a reserved keyword. There are no semicolons, each command must be on a separate line. There are no curly brackets. Multiline constructs are defined using If and EndIf, Class and EndClass Routine and EndRoutine etc. The way in which code is indented is also important, as corresponding If and EndIf pairs must be aligned to the same column. JJ's designers have expressed the opinion that students find the word "variable" confusing, and so have used the word "box" in its place. Variable declarations are a case where JJ's syntax is substantially different to Java. JJ uses:

  Box name ofType type

where Java would have:

  type name;

Although I agree with the technique of translating a simple language into a more complex one as an aid to teaching, and will pursue this route in developing a teaching tool in this project, I believe that the weaknesses in JJ are in the dissimilarities between the JJ language and Java. During the time spent working with a language, certain things become ingrained, for instance the use of a certain character (e.g. a semicolon) as a line separator, or the order of the terms in a variable declaration. If a smooth transition between languages is to be ensured then, in my opinion, it would be more sensible to keep a common syntax and style between the two where this will not introduce overly complex constructs. I also think that the need for the student to learn a whole new set of keywords when making the transition will present a barrier to moving easily to Java.

JJ enforces a certain style of indenting. The way that code is laid out is very personal to individual programmers (although perhaps more of an issue to the more experienced programmer) and being forced to use a certain layout may prevent them from thinking about the problem as clearly as they might if it were possible to lay out their code with whatever spacing they wished.