Archives for : jake

Setting up "situations"

Karel programs are built on “situations”. Similarly, Greenfoot programs use pre-built scenarios. So JAKE programs, also, use Pattis’s situation model.


Up until now, it’s been possible to add robots, beepers and walls by clicking on the buttons down the side of the world editor. These objects were stationary and appeared, by default, in the centre of the World. As of this week’s latest version, the objects can be moved; this lets us set up complex scenarios, like the one below.

World objects can be moved around using a tool window that appears only when one is selected.

These screenshots are from the JAKE IDE. When the JAKE program is run (from the toolbar or with F5), the program represented in the world editor is transcribed into Java and compiled. The resulting program, running in Java, looks like this:

Thus, we can now create situations in JAKE, and see them running in Java.

Dynamic class diagrams in JAKE

It’s been noted [e.g. 1] that showing the static class structure is important in teaching materials and tools. BlueJ, for instance, places a lot of emphasis on this.
The JAKE IDE dynamically compiles a class diagram as classes are added to the JAKE program. Every program starts with a default class diagram that shows all the classes in the main JAKE package: World, Mover, Robot, and so on.

The diagram uses a variant UML notation, with arrows for generalisations. The classes themselves, however, don’t have methods or attributes. Instead, they’re represented by a box with an icon and caption.

The class diagram is shown alongside the main program editors in JAKE, but it can also be maximised. In later versions, the maximised diagram could be printed through the File menu. The diagram window automatically scrolls if the diagram becomes too large, but JAKE’s simple class structure makes this unlikely.

References
[1] Börstler, J., Hall, M. S., Nordström, M., Paterson, J., Sanders, K., Schulte, C. and Thomas, L. An Evaluation of the State-of-the-Art of Object-Oriented Example Programs in Introductory Programming Textbooks. In inroads SIGCSE Bulletin. (July 6-9 2009). ACM New York, NY, USA, , 2009, 126-143.

Debugging: Class, interface, or enum expected.

Java’s error messages aren’t always very meaningful – to novices at least. Take this, what we might imagine to be a fairly common error:

Class, interface, or enum expected.

Now, I know what it means, but would a new programmer? To understand this message, you surely need to know what an interface or an enum is – neither of which are likely to be taught in the first few lessons.

Therefore, JAKE aims to make debugging a bit easier. When a JAKE program is compiled, the IDE reads the feedback from javac and tries to translate it into simpler language. Obviously, it’s important to maintain parity with the Java error itself, so the actual error message is always shown. It’s just that JAKE also gives a short, plain-English explanation too.

Since JAKE’s being developed to research teaching programming, it’s not going to include an explanation for every possible javac error. However, the system is designed in such a way that it’s modular; the explanations are taken from text files, and JAKE just looks for a file that matches the javac error description. See below, where there’s no matching explanation for the error:

The explanations, where they do exist, are also quite short, so it’s feasible that the novice programmer might want more help. To get around either of these problems, there’s a link to Google. Yes, this might sound overly simple, but it seems like a good, quick (since this is only a demonstrator) way of providing extra help. Why duplicate help content that can be found on the web? When the user clicks on the link (either link, if there’s no explanation and a link appears instead), their default browser opens and they’re taken to a Google search page about their error:

New robot graphics

Up until now Jake’s had to make do with a clipart-based outfit. His new ensemble has now arrived, and it comes in several stylish colours…

The new drawings are courtesy of Miriam Lowrie.

Ghosts!

JAKE is an objects-first tool, built using the object-oriented Java language.
One of the advantages of using robots is that there’s a clear model for inheritance. In the current build, the JAKE architecture has a number of classes. The World owns several WorldObjects. There are different kinds of world object: Walls, Beepers and Movers. Walls are solid structures that block off paths in the World. Beepers are just that – little devices that “beep” so that they can be detected by the robots. For now, Movers are the most interesting class.
Just like there are different kinds of WorldObject – one of which is the Mover – there are different kinds of Mover. All Movers can, well, move. Different kinds of Movers behave in different ways, but all have a move() method. The first type of Mover to be created was the Robot. The Robot class represents a basic robot that can move forwards, turn, and do some other (similarly exciting) things. Jake – our main character – is one of these Robots.

To demonstrate the different kinds of Mover, the JAKE library now includes Ghosts. Remember PacMan? PacMan’s ghosts have found their way into Jake’s world, and they’re scaring him! Robots respond to instructions from the programmer, but Ghosts don’t. Instead, they wander around the world randomly. Ghosts run on a timer and keep going until the program ends. They won’t pass through a wall or off the edge of the screen, and they turn themselves around every once in a while. Unlike normal Robots, Ghosts can’t be passed through – like Walls. Ghosts don’t really do any useful tasks, but they illustrate how the Mover class can be extended to do different things, and to look different.

It’s alive!

The robot has a name: Jake. Jake stands for “Java Karel with Events”. Jake is based on Karel the robot, with an objects-first approach and some new button-based event interfaces.

Today the first prototype is complete: Jake can move, turn and bump into walls. He’s programmable in Java using the “jaketherobot” package. There are world, robot, beeper and wall classes.
So far Jake only exists as a collection of classes. The JAKE IDE is planned for development within the next couple of months.