A java template is a text containing slots and invariant textual information. A java slot is an easily identified marker which is replaced by a filler in the process of transforming a java template into a java program. A java filler is just the java program fragment which replaces a java slot.
The motivation behind the java templates is to ease your burden by eliminating the need to type invariant technical information. This frees you to focus your attention on novel concepts and constructs. By reducing the typing you must do, use of the templates serves to reduce the number of typing errors that you will make, and consequent lexical errors in Java. The basic Java application template is shown below. The current date is automatically entered for you.
// General Information
// ------------------------------------------------------------
// File: <?CLASS>.java
// Type: java application file
// Date: Sun Oct 15, 1995
// Name: <?AUTHOR>
// Line: <?LINE>
// Application Description
// ------------------------------------------------------------
/*
<?DESCRIPTION>
*/
// Required Packages
// ------------------------------------------------------------
import blue.io.*;
<?NEEDS>
// Application Class
// ------------------------------------------------------------
class <?CLASS>
{
static public void main (String args[])
{
<?PROGRAM>
}
}
// Demo
// ------------------------------------------------------------
/*
<?DEMO>
*/
The slots of the simple Java application template represent information as indicated below.The slots are instantiated as follows in the CoffeeApp program.
- <?CLASS> represents the name of the application class being defined.
- <?NAME> represents the name of the author of the program.
- <?LINE> represents a one line description of the program.
- <?DESCRIPTION> represents a multiple line description of the program.
- <?NEEDS> represents information describing classes required by the program.
- <?PROGRAM> represents a demonstration of the Java program.
- <?DEMO> represents a demonstration of the program in action.
- <?CLASS> --> CoffeeApp
- <?NAME> --> BLUE
- <?LINE> --> Variation of "Hello world!", the traditional starter.
- <?DESCRIPTION> --> Program to display "Coffee is good!" to the standard output file.
- <?NEEDS> -->
- <?PROGRAM> --> IO.println("Coffee is good!");
- <?DEMO> -->
indigo> javac CoffeeApp.java
indigo> java CoffeeApp
Coffee is good.
indigo>
You can generate a "Basic Java application template" by issuing the "generate basic Java application template" emacs command. You can move to the next slot by issuing the emacs "jump to next slot" command. You can delete the previous slot by issuing the emacs "Delete Previous Slot" command. The demo will be generated in the context of a "shell". You will replace <?DEMO> with the demo by means of the emacs "transfer demo" command.