Content area
Full Text
J is a programming language and environment designed for learning Java. Although a subset of Java, JJ includes advanced programming features, such as support for Design by Contract, complete with a class invariant, preconditions, and postconditions. We developed JJ after witnessing the rapid move to Java in introductory computer-science courses. It seemed that if an appropriate compiler existed with educational-based error messages, a subset of Java would more easily help programmers get started with Java. Since we also felt that the ideal educational language would not necessarily look like Java, we settled on a subset that uses a different syntax. After all, even though a C++/C-like syntax was selected for Java (primarily to attract experienced programmers), Java could just as easily have had a syntax similar to Pascal, Eiffel, or Basic. In a nutshell, JJ is based on Java, has some of Eiffel's features, and sports a syntax designed for ease of learning.
One reason behind this approach is that Java has features typically not taught to novice programmers. For example, JJ does not support inheritance, because most introductory programming courses do not get into inheritance. JJ does support classes as a mechanism for data encapsulation, but students should move from JJ to Java when they're ready for inheritance.
Another goal of JJ is to remove features that may lead to poor programming habits. For example, allowing modification of a public class data from another class is prohibited in JJ, as in Eiffel. Another way to describe this restriction is that public data can be seen, but not modified.
The JJ Language Definition
JJ consists of about three dozen commands, each beginning with a reserved word that must be the first word on a fine. There is no need for a semicolon to end a command. For each construct, there is a unique End command. There is no need for curly brackets, or the dangling else problem (something found in C, C++, Java, and even Pascal). Mismatched constructs can be reported accurately, which can save beginning programmers hours of debugging.
It may be difficult for experienced programmers to remember how frequently beginners tend to misplace semicolons and curly braces. Even worse, it is truly impossible to predict the resulting error message. The error messages...