Search

Keyword

# The Probability/Statistics Object Library

## Reusable Components

The applets in the PSOL are constructed from programmatic components that are themselves intended to be reusable. Play with the Dice Experiment applet again (or look at the picture above) and note the basic elements. The visible components of this applet are

• The basic shell with the main toolbar
• The dice
• The table that displays the values of the random variables
• The table that displays the true and empirical distributions of the selected random variable.
• The graph that displays the true and empirical distributions of the selected random variable.
• The scroll bar for changing the number of dice.
• The dialog box for specifying the probabilities that govern the dice.

In addition, the applet includes a number of components that are not visible, but rather correspond to mathematical elements:

• The probability distribution that governs the dice
• The probability distribution of each of the random variables
• A general data structure for collecting and processing empirical data from the random variables

All of these components, and many more, are available in the library. Each component is available in two forms:

• A Java Archive (JAR) file that includes all Java class and resource files for the object, in most cases packaged as a Java "bean". The JAR file is all that is needed to use the object as is.
• A compressed ZIP file that includes all source and resource files for the object.

You can import a Java bean into a "builder tool" to expose the properties and methods of the object. A builder tool allows you to include objects in another project in a point-and-click fashion, with relatively little coding. The free integrated design environment (IDE) from NetBeans.org is an example of such a builder tool. The source code, on the other hand, allows you to modify the object or study its programming.

Thus, if you have programming experience, you could modify an applet from the library, or you could construct a custom applet using components from the library. In both cases, you could do this in a fraction of the time needed to build the applet from scratch. For example, modifying the Dice Experiment applet to explore other random variables (such as the range of the dice scores or the number of two's) would be relatively simple -- only a few objects would need slight modification. Assembling a custom applet from components would require significantly more work. However, the objects in the library spare you much of the tedious, low-level programming that has little pedagogical value. For example, programming a die so that the spots are in the proper location and scale with the size of the die is clearly not a good use of an instructor's time. The PSOL provides a virtual die that has all of the functionality needed for educational projects.

I do not want to suggest, however, that programming a Java applet is easy, even with the help of the components in the PSOL. All programming is difficult, and learning any programming language, Java included, requires a significant investment in time. On the other hand, I will argue in Section 8 that higher level programming can be a valuable educational experience.  First, however, I will guide you through the construction of a very simple applet, the ubiquitous Hello World! example.