Welcome to Breweryä 1.0, a graphical software development tool for the Java programming language. Brewery displays class hierarchies and even source code in a graphical, highly intuitive way. This allows the user to concentrate on the design of the code and be visually reminded of how the pieces of his project fit together. This user manual is divided into 4 sections. The first two sections will give you an overview of what you can expect from Brewery, and what you should not expect. The third section is a concession to the old adage that people learn best by doing. The small tutorial will help you to do just that. The fourth section is just a reference that briefly explains how to invoke the commands. Before we move on to the first part of the manual, a few words of advice: the first two sections are short and invaluable. If you skip them, you may be unpleasantly surprised when you find out that Brewery does not do something that you think it should do. The rest of the manual is very concise. The interface is very friendly and the tutorial will walk you through most the functionality of Brewery. The fourth section contains several tidbits and potential pitfalls to look out for. This is also a brief but valuable resource for you as a user of Brewery.
Brewery is a software engineering tool designed to make constructing reasonably large Java programs easy. By providing a graphical user interface in which the user can see, create, modify, and delete the class hierarchy, Brewery allows a much broader view to be taken of the design process. Programmers can see how their classes inherit and implement each other on the screen. This allows the user to focus on each piece of the program while being aware of the larger scope of the project as a whole. Brewery allows Java classes, methods, variables, and interfaces to be declared and written on the screen. In short, everything that can be written in Java can be written in Brewery. When the project is done, Brewery will write the Java source files out to disk for you, which can then be compiled by any Java compiler.
First and foremost, Brewery is not a Java compiler. Brewery will not catch your coding mistakes, spelling mistakes, or any other mistakes. It’s only form of error control is that it does not let the user select invalid attributes for a particular type (such as trying to make an abstract variable). Brewery will let you do pretty much anything else, so it is your responsibility to look over your code carefully to make sure it works. Of course, the Brewery project can be edited, so debugging is simply a matter of having Brewery write the .java files to disk and then trying to compile them. Brewery is a tool that is developed for the experienced Java programmer. It is not equipped with help files for the Java language, and users are expected to be familiar with the syntax and structure of Java programs.
This is a small tutorial to help you get your feet wet with Brewery. In this tutorial, we will create a base class and a class that extends this base class. We will create variables and methods for these classes, import the relevant java files, and write (emit) the Java source code to disk which can then be compiled.
Double-click on the Brewery icon to launch the application. You will be presented with the following screen:

The blank window is where your classes will go. There are pull-down menus with various options that we will be examining later. For now, you want to create a class.
Create a class by right-clicking on the main Brewery window. This brings up a menu with 4 choices, New Class, New Interface, Delete Object, or Edit Properties. Select New Class. You will then be presented with the following dialog box:
This window allows you to specify all the information about your class. First, let’s give this class a name. Write "FirstClass" in the Name section of the dialog box. Now, let’s make this class public and final. Click on the Attributes button in the dialog box. Now simply select the checkboxes for public and final and click OK. Note that the system will not allow you to select attributes like transient and native that do not apply to classes. Now we are ready to add variables and methods to our classes. Click on the New Variable button. You will see the following:
Type "Cabot" in the Name box, put "int" for type, and leave the initial value blank (we will be assigning this variable in our constructor). You may also select attributes for this variable. This is done exactly as you did for the Class above. Make this variable private. You have just declared a private integer Cabot. Now click OK.
You should now see your variable displayed on the class dialog box. Now add a method by clicking on the New Method button. You will see the following:
Let’s create the constructor for this class. Write "FirstClass" in for Name and be sure to specify nothing for Return Type since this is a constructor. We will leave the Parameters and the Throws boxes blank because our constructor will take no arguments and throw no exceptions. Attributes for your method will be assigned just like class and variable attributes. Make this function public, because it is the constructor. Now let’s fill in the function body on the right hand side of the box. For our constructor, we wish to initialize the value of the variable Cabot to 0. Type in "Cabot = 0;" for the function body. Click the Preview button in the lower left corner to view what your function declaration will look like. You should see "public FirstClass()" appear in the text box. Click OK to return to the main Class dialog box.
You should now see both your variable and your method displayed in their respective locations. Your class is now finished. Leave the Parent Class box empty, because this is a base class. Last, you must select files to import. Click on the New Import box. Then write the following in the text box that appears: "java.util.*" . In general, you can select any file to import. It is up to you to ensure that whatever files you import are in the correct format and available. Your class should look like this:

Now you are ready to create a second Java class. Right click on the main window again to bring up the Class editing menu and select New Class again. Fill in "SecondClass" for the name, and make this class public as well. Let’s make this class a sub-class of FirstClass. Click on the arrow by the Parent Class box. Notice that FirstClass is not listed as an option. That’s because we defined FirstClass to be a final class. Click OK to get back to the main window. You should see two class boxes now. Right click on FirstClass and select Edit Properties. This will bring up the class dialog box. Go to Attributes and click on the final checkbox to deselect this attribute. Then click OK to get back to the class dialog, and OK again to get back to the main window. Open up the SecondClass class dialog box again and click on the Parent Class arrow. You should now see FirstClass as an option for the parent class. Click on FirstClass to set the parent class. Now, SecondClass extends FirstClass. Note the "Other…" button by the parent class box. This can be used to manually enter the name of the parent class. This is useful in the case where the class will extend an existing Java class that Brewery knows nothing about – for instance, java.util.Vector.
Now let’s create some variables and methods for this second class. Create a new integer "count" by clicking on the New Variable box in the class dialog. Make this variable private and set its initial value to 0. Now make a String variable called "msg" and make this variable public. Make the initial value "default message".
The quotations around the value are necessary in this case, as the value written for this variable must be in quotes if it is to be interpreted as a String. If you forget the quotes, you will get a compiler error.
Now we’ll create the constructor for this class. First, click the New Method box from the class dialog. The name of this method will be SecondClass. Set the Attributes to public and the Return Type to void. For Parameters, let’s pass an integer param1 and a String param2. Then assign count and msg to
param1 and param2, respectively. Now click the Preview button. You should see the following:
Click OK to close the Method Editor and OK again to exit the Class Editor to return to the main window. Your project should now look like this:

The arrow shows that SecondClass extends FirstClass. Now you are ready to write your simple Java classes to .java files. First, let’s save the project.
You will find all the load, save, and code emitting features under the File menu (see above). As you can see, from the file menu you can save your project (Save Package), open an existing project (Open Package), open a new project window (New Package), and write your project to new Java files (Emit Code). Go to the Options window and select Package Name. Type in the package for the project in the box provided. Brewery will not allow you to save the project without setting the package name. Select Save Package to save your package. Your project will be saved in a file named <package name>.pkg. If your project’s package is "cornell.class.cs501", the package file will be written to "cornell.class.cs501.pkg". Obviously the operating system running Brewery must have support for long filenames.
Before you emit the code, you must set Brewery’s working directory to be the root where you want your Java files to go. Once you have set the working directory and entered the package name as described above, you can go to the File menu and select Emit Code. Brewery will then create a directory structure with the same name as your package and write all the Java source files into this directory.
Brewery also allows you to create interfaces for your classes. First, load your tutorial project. We will create and add an interface to SecondClass. To create a new interface, right-click on the main window. Choose the New Interface option. You will see the following dialog box:

Name your interface "Mike". Now you can select New Method to add methods for your interface. Note that you are not allowed to fill in a method body in the interface. Interface methods must be implemented in the class is which they are implemented. Click OK when you are done adding methods. You will see the interface on the main window as a diamond shape. To add your interface to SecondClass, right-click on it and select Edit Attributes. Select Add Interface and double-click on interface Mike to add it. Note that now you have to define all the methods you declared in Mike in SecondClass. These methods will appear in the Methods section of your class as soon as you add the interface. You should now see the following display:
.

This concludes your Brewery tutorial. Section 6 will give you some general things to keep in mind while you work with Brewery. We hope you enjoy our development tool and find it helpful as a way to organize your thinking and development.
To delete a class or interface, right-click on the object and select Delete Object.
When a class is deleted, all sub-classes are also deleted. If you want to keep some or all of the child classes, make sure you change their parent classes so they are not deleted along with the class you wanted to remove.
Before you delete an interface, remove it from all the classes that implement it. If you do not do this, the old functions will stay with the class and your source code will not compile. After you have removed the interface from all relevant classes (you should see no lines from any classes to the interface), you may right-click on the interface and select Delete Object.
VI. THINGS TO REMEMBER
This is the section to glance through as you are working with Brewery. A few common mistakes that you will make as you learn to use Brewery are covered here. This is basically a checklist section to make sure that you are using the program correctly.
1. Make sure that you use quotations around the characters that you assign to variables of type String. This can also be viewed as a more general warning to type arguments and assignments carefully. Brewery will only write the code outside of braces {} and parentheses (). The code inside must be written by you, exactly as you wish it to appear in the source file.
2. Brewery will not interpret what you type into text boxes at all. If you make mistakes, they will be faithfully copied into your source files. It pays to design carefully and methodically. Brewery will help you to do this, but it will not do it for you.
3. Make sure you save your project before you emit source code. This ensures that your work is saved in current form for debugging purposes, and also ensures that the latest version of your code will be emitted.
4. Make sure you adhere to the Java naming standards. This means that the first character cannot be a number, and the only special character that is allowed is the underscore ( _ ). This is important for 2 reasons. First, your code won’t compile. Second, Brewery itself parses things using special characters, so if you type them into your names, etc. you will get unpredictable results.
5. The abstract keyword is added automatically to the Java files written for interfaces. You will end up typing the function to whatever a given class requires, but Brewery will always add the abstract keyword in the appropriate places regardless.
6. When implementing an interface, be sure to specify all functions for the interface before you implement it in a class. If you add methods to an interface after you implement it, you must remove the interface from the class and add it again in order to get the new methods you added to the interface. This is not a disaster by any means, but it is inconvenient.
7. The interface is very intuitive. Everything you can do is easily accessible through menu options. Brewery was written by experienced Java programmers who hate to read manuals, so the program is designed to allow programmers to dive right in and requires very little training to work with.