Thursday, March 18, 2010

Adding events

A big part of JAKE (Java Karel with Events) is that it adds an understandable event model to the Karel mini-paradigm. We know that there are problems with Java's event model [1], and that's part of what JAKE is meant to address. The idea is that the programmer, once they've set up their world, creates event buttons, methods of the control panel.

Adding an event is done with the "Add..." button. This adds a new button to the control panel.



When the programmer clicks on their new event button, a pop-up menu opens, giving them the option to write the method that goes with this button.


This opens the code editor (work on which is still in progress).



Now, when the programmer compiles their work, JAKE copies this method into the program, creates an appropriate JButton, and writes a Listener to connect the JButton to the control panel method. The student programmer doesn't actually see any of the event listeners, and doesn't have to worry about them yet. It's not an ideal solution to have to hide away parts of the program, but hey, it is "broken"...

References

[1] Milner, W. W. A broken metaphor in Java. ACM SIGCSE Bulletin, 41, 4 ( 2010), 76-77.

No comments:

Post a Comment