Java0078 Java OOP Callbacks - II *

Similar documents
Java3018: Darkening, Brightening, and Tinting the Colors in a Picture *

OpenStax-CNX module: m Java3002r Review * R.G. (Dick) Baldwin

Java OOP: Java Documentation

Java4340r: Review. R.G. (Dick) Baldwin. 1 Table of Contents. 2 Preface

Java4350: Form Processing with JSP

Hs01006: Language Features, Arithmetic Operators *

Java4320: Web Programming Model *

Java4570: Session Tracking using Cookies *

Java3002: Creating and Manipulating Turtles and Pictures in a World Object

Java3002: Creating and Manipulating Turtles and Pictures in a World Object *

Authoring OpenStax Documents in Apache OpenOffice Writer *

AP Computer Science A, Clarification of the Java Subset. By: R.G. (Dick) Baldwin

INEW Advanced Java Programming. Collection Editor: R.G. (Dick) Baldwin

Accessible Objected-Oriented Programming Concepts for Blind Students using Java. By: R.G. (Dick) Baldwin

Morse1010 Translating Text to Morse Code *

Using Flex 3 in a Flex 4 World *

The json-simple Java Library. By: R.G. (Dick) Baldwin

Polymorphism - The Big Picture *

The Essence of OOP using Java, Nested Top-Level Classes. Preface

GAME : Vector Addition *

GAME Motion Displacement and Vectors

Java OOP: Modifications to the Turtle and SimpleTurtle Classes

Exercise: Singleton 1

Java1486-Fun with Java, Understanding the Fast Fourier Transform (FFT) Algorithm *

The AWT Package, Graphics- Introduction to Images

The AWT Package, Placing Components in Containers, CardLayout. Preface. Introduction

Swing from A to Z Some Simple Components. Preface

The Processing Programming Environment. By: Richard Baldwin

JavaBeans, Properties of Beans, Constrained Properties

The Default Application Container - Flex 3 and Flex 4 *

OS06: Monitors in Java

Chapter Two Bonus Lesson: JavaDoc

Multimedia Programming with Java Getting Started

Swing from A to Z Using Focus in Swing, Part 2. Preface

Position vs Time Graphs *

How to make a "hello world" program in Java with Eclipse *

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

Chapter 4 Defining Classes I

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

CHAPTER. Knowledge Representation

Austin Community College Google Apps Calendars Step-by-Step Guide

Xna0118-The XNA Framework and. the Game Class

Intersection of sets *

PeopleSoft 9.1 PeopleBook: Events and Notifications Framework

Week - 01 Lecture - 04 Downloading and installing Python

The need for interfaces

Exercise 6 - Addressing a Message

Java Classes - Using your classes. How the classes you write are being used

Midterms Save the Dates!

Instance Members and Static Members

Staff Directory & Online Classroom: A Picture Book

Processing Image Pixels, Creating Visible Watermarks in Java. Preface

Part 2: The Material PART 2

COMP200 INTERFACES. OOP using Java, from slides by Shayan Javed

InDesign UX Design Patterns. by Justin Putney

CPSC 320 Sample Solution, Playing with Graphs!

The Law of Reflection *

About 1. Chapter 1: Getting started with oop 2. Remarks 2. Examples 2. Introduction 2. OOP Introduction 2. Intoduction 2. OOP Terminology 3.

USE #4 TO EXPORT FOR SINGLE PETS OR SKIP TO #5 TO EXPORT FOR

Create a Java project named week10

CIS 110: Introduction to Computer Programming. Lecture 2 Decomposition and Static Methods ( 1.4)

AP Computer Science A Summer Assignment 2017

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Adobe InDesign CS6 Revealed (Adobe CS6) PDF

Static, Final & Memory Management

CS 1331 Exam 1. Fall Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score.

C. E. McDowell August 25, Baskin Center for. University of California, Santa Cruz. Santa Cruz, CA USA. abstract

Example: Count of Points

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and More

CS 2112 Lecture 20 Synchronization 5 April 2012 Lecturer: Andrew Myers

Introduction. Paradigm Publishing. SNAP for Microsoft Office SNAP for Our Digital World. System Requirements

COMP 250 Winter 2011 Reading: Java background January 5, 2011

1 10 3:30 5: :30 1:30 206, ICICS/CS

VITA VOLUNTEER TRAINING MANUAL

Summer Assignment for AP Computer Science. Room 302

Tips from the experts: How to waste a lot of time on this assignment

Programming using C# LECTURE 07. Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism

CS1004: Intro to CS in Java, Spring 2005

What is an Affine Transform?

Spring 2019 Discussion 4: February 11, 2019

HAS-A Relationship. If A uses B, then it is an aggregation, stating that B exists independently from A.

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

Database Systems Concepts *

Inheritance and Polymorphism

New Perspectives on Word 2016 Instructor s Manual 1 of 10

Name: Magpie Chatbot Lab: Student Guide. Introduction

G51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

CSCI 201L Written Exam #1 Fall % of course grade

Lesson 2 page 1. ipad # 17 Font Size for Notepad (and other apps) Task: Program your default text to be smaller or larger for Notepad

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations

US Technology Informational Meeting

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

CS506 Web Design & Development Final Term Solved MCQs with Reference

St. Edmund Preparatory High School Brooklyn, NY

Investigate and compare 2-dimensional shapes *

Digital Marketing Manager, Marketing Manager, Agency Owner. Bachelors in Marketing, Advertising, Communications, or equivalent experience

C Language Programming through the ADC and the MSP430 (ESCAPE)

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

Transcription:

OpenStax-CNX module: m59589 1 Java0078 Java OOP Callbacks - II * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract A previous lesson introduced you to the basic Java callback mechanism using interfaces, and walked you through the development of a set of classes that implement a simple multicast form of callback. In that lesson, the denition of the CallBack interface was limited to a single method declaration. In a real program involving callbacks, many dierent objects may ask one object to notify them when any interesting event in a family of interesting events happens, and to identify the specic event that actually happened along with the notication. This lesson will enhance our previous program to accommodate this possibility. Revised: Tue Jul 05 19:16:25 CDT 2016 This page is included in the following Books: ITSE2317 - Java Programming (Intermediate) 1 Object-Oriented Programming (OOP) with Java 2 1 Table of contents Table of contents (p. 1) Preface (p. 2) Viewing tip (p. 2) * Figures (p. 2) * Listings (p. 2) Introduction (p. 2) Sample program (p. 3) Interesting code fragments (p. 3) Summary (p. 6) Complete program listing (p. 7) Miscellaneous (p. 12) * Version 1.3: Jul 5, 2016 7:22 pm -0500 http://creativecommons.org/licenses/by/4.0/ 1 http://cnx.org/contents/rl23r3lw 2 http://cnx.org/contents/-2rmhfs_

OpenStax-CNX module: m59589 2 2 Preface This is a page from the Event Handling 3 section of the book titled ITSE2317 - Java Programming (Intermediate) 4. The Event Handling section explains how to write programs that handle events in Java. This is the second in a series of three consecutive lessons on Callbacks in Java. The three lessons are named Callbacks - I, Callbacks - II, and Callbacks - III. Students in Prof. Baldwin's ITSE 2317 Intermediate Java Programming classes at ACC are responsible for knowing and understanding all of the material in this lesson. 2.1 Viewing tip I recommend that you open another copy of this module in a separate browser window and use the following links to easily nd and view the Figures and Listings while you are reading about them. 2.1.1 Figures Figure 1. (p. 6) Output from the program named Callback03. 2.1.2 Listings Listing 1 (p. 4). The CallBack interface. Listing 2 (p. 4). The callrecess method in the Teacher class. Listing 3 (p. 5). The Dog class. Listing 4 (p. 5). The controlling class named Callback03. Listing 5 (p. 7). The program named Callback03. 3 Introduction Many processes in the standard Java API make use of a mechanism that in other programming environments might be referred to as a callback mechanism. Basically, this is a mechanism where a method in one object asks a method in another object to "call me back" or "notify me" when an interesting event happens. For example, an interesting event might be that the price of a specied stock goes above its previous high value, or the toaster nishes toasting the bread. A previous lesson introduced you to the basic Java callback mechanism using interfaces and walked you through the development of a set of classes that implement a simple multicast form of callback. In that lesson, the denition of the CallBack interface was limited to a single method declaration. In a real program involving callbacks, many dierent objects may ask one object to notify them when any interesting event in a family of interesting events happens, and to identify the specic event that actually happened along with the notication. This lesson will enhance our previous program to accommodate this possibility. As mentioned in the earlier lesson, it is usually easier to understand abstract concepts if they are explained in terms of a meaningful scenario. For that reason, we have conjured up a scenario in which to develop and explain our callback programs. Our scenario consists of a teacher and some students. In the beginning there was only one student. Then we expanded the scenario to include many students and some animals in the classroom as well. The students (and the animals) register themselves on the teachers roll book to be notied of interesting events. Initially the interesting event was simply the teacher taking the roll. In this lesson, we expand that scenario to include notication that it is either time for recess, or it is time for lunch. 3 http://cnx.org/contents/rl23r3lw:qfo9ijx- 4 http://cnx.org/contents/rl23r3lw:jvtd7bx1

OpenStax-CNX module: m59589 3 Initially, only one student received notication of one type of event. In this lesson, all of the students and all of the animals receive notication of both types of event (recess or lunch) but some of those who are notied choose to ignore the notication. Without further discussion, let's look at some code. 4 Sample program In case you just started reading at this point, this program named Callback03 is an enhanced version of the program named Callback02 that you learned about in an earlier 5 lesson. You should familiarize yourself with the earlier program before trying to understand this program. The earlier version of the program dened two dierent classes that implemented the CallBack interface. In order to give us more to work with, this version denes three dierent classes named Student, Dog, and Cat that implement the CallBack interface. Mixed objects of those three types are registered and maintained on a list and notied at callback time. As before, this program denes a CallBack interface. However, this version of the interface declares two dierent methods that can be invoked as callback methods instead of just one. In other words, in this case, the objects register to be notied whenever an interesting event from a family of interesting events occurs (the family has two members). When notied, the objects also need to be advised as to which interesting event actually happened. The methodology for dierentiating between the two dierent kinds of interesting events is to invoke one callback method in the case of one event, and to invoke the other callback method in the case of the other event. All classes that implement the CallBack interface must dene both methods, but it is allowable to dene the method as an empty method. The net eect of dening a callback method as an empty method is to simply ignore the callback associated with that method. Note however, there is some overhead associated with the invocation of an empty method. (Although we haven't discussed the topic yet, I believe that this overhead is the reason that JavaSoft chose to separate the MouseListener and MouseMotionListener interfaces. Perhaps someone will remember to remind me to discuss that when we get to the topic of MouseMotionListener interface in the classroom lecture.) One of the callback methods in this version of our program is named recess and the other callback method is named lunch. Thus, registered objects can be notied either of a recess event, or of a lunch event. The Dog class ignores the recess callback by dening an empty recess method, and the Cat class ignores the lunch callback by dening an empty lunch method. The Student class responds to both types of callbacks with fully- dened methods. The program denes a Teacher class that has the ability to create and maintain a list of objects of the interface type, and to notify those objects that something interesting has happened by invoking either the recess method or the lunch method on all the objects on the list. It is important to note that every object on the list will be notied of both types of callbacks, although as mentioned above, a particular type of callback can be ignored by a class simply by leaving the callback method empty when it is dened. As before, objects can be added to the list and then removed from the list. However, removal of objects from the list was demonstrated in the previous program, so removal is not demonstrated in this program. Notication takes the form of invoking either the recess method or the lunch method on all the objects on the list. Finally, the program denes a controlling class that ties all the pieces together and exercises them. The program was originally tested using JDK 1.1.3 under Win95. The program was more recently retested using JDK 8 and Win7. The output from the program is shown later. 4.1 Interesting code fragments The code in Listing 1 (p. 4) denes an interface named CallBack that will create a new type and that declares two generic methods that can be used to call back any object that is of a class that implements the 5 http://cnx.org/contents/rl23r3lw:0pd-9uyz

OpenStax-CNX module: m59589 4 interface. Listing 1. The CallBack interface. interface CallBack{ public void recess(); public void lunch(); }//end interface CallBack Listing 2 (p. 4) denes a class whose objects can maintain a list of registered objects (registration is the process of placing an object on the list) of type CallBack and can notify all the objects on that list when something interesting happens. This class diers form the one in the earlier lesson in that it has the ability to notify for two dierent types of callbacks: recess and lunch. The name of this class is Teacher. The code to construct the Teacher object, add objects to the list, and remove objects from the list hasn't changed in a signicant way, so we will skip over that code and go straight to the code that is new and dierent. Basically what we now have is two dierent methods in place of one. One of the methods is named callrecess and the other is named calllunch. Except for their names, these methods are almost identical to the single method named calltheroll in the earlier lesson, so a lot of discussion isn't needed. The code in the method makes a copy of the list and then uses a for loop along with some Vector methods to access each object reference. Then the callback method is invoked on each object reference. We will show one of the methods below for reference. Listing 2. The callrecess method in the Teacher class. void callrecess(){ Vector templist;//save a temporary copy of list here //Make a copy of the list. synchronized(this){ templist = (Vector)objList.clone(); }//end synchronized block //Invoke the recess() method on each object on // the list. for(int cnt = 0; cnt < templist.size(); cnt++){ ((CallBack)tempList.elementAt(cnt)).recess(); }//end for loop }//end callrecess() That concludes the discussion of the class named Teacher. The Teacher class is followed by three class denitions that implement the CallBack interface: Student, Dog, and Cat. These class denitions dier from the ones in the earlier lesson in that they dene two callback methods instead of just one: recess and lunch. Recall that I said that a class can ignore a particular type of callback simply by dening the callback method as an empty method. Recall also that I said that the Dog class ignores the recess() callback in just this way. Because of the similarity of these three classes, I am only going to show one of them below. Listing 3 (p. 5) shows the Dog class to illustrate how it denes an empty method to ignore the recess callback.

OpenStax-CNX module: m59589 5 Listing 3. The Dog class. class Dog implements CallBack{ String name; //store name here for later ID Dog(String name){//constructor this.name = name; //save the name to identify the obj }//end constructor //An object of the Teacher class can invoke this method // as the callback mechanism. public void recess(){//announce recess //ignore this callback with an empty method }//end overridden recess() //An object of the Teacher class can also invoke this // method as a callback mechanism. public void lunch(){//announce recess System.out.println(name + " lunch"); }//end overridden lunch() }//end class Dog That brings us to the controlling class that ties all the pieces together and exercises them (see Listing 4 (p. 5) ). Except for the fact that the main method triggers two callbacks instead of just one, and the code to remove an object from the list was deleted for brevity, this code is essentially the same as the code in the earlier lesson. Therefore, I am going to delete some of the redundant code from this fragment and primarily show only the new code. The code in the main method of the controlling class instantiates a Teacher object named missjones, and then instantiates some objects of the three types: Student, Dog, and Cat. These objects are registered for callback by invoking the register method on the Teacher object. Then the code triggers a recess callback and a lunch callback. Listing 4. The controlling class named Callback03. class Callback03{ public static void main(string[] args){ //Instantiate Teacher object Teacher missjones = new Teacher(); //Instantiate some Student objects //... code deleted for brevity //Instantiate some Dog objects. //... code deleted for brevity //Instantiate some Cat objects

OpenStax-CNX module: m59589 6 //... code deleted for brevity //Register some Student, Dog, and Cat objects with // the Teacher object. missjones.register(tom); missjones.register(spot); missjones.register(sue); missjones.register(cleo); missjones.register(fido); missjones.register(peg); missjones.register(kitty); missjones.register(bob); missjones.register(brownie); //Cause the Teacher object to call recess on all // the objects on the list. missjones.callrecess(); //Cause the Teacher object to call lunch on all // the objects on the list. missjones.calllunch(); }//end main() }//end class Callback03 The output produced by this program is shown in Figure 1 (p. 6). Figure 1. Output from the program named Callback03. Tom recess Sue recess CleoCat recess Peg recess KittyKat recess Bob recess Tom lunch SpotDog lunch Sue lunch FidoDog lunch Peg lunch Bob lunch BrownieDog lunch 5 Summary In summary then, we have objects of dierent classes registered on a common callback list where every object on the list receives a callback for every dierent type of callback event associated with the list. The dierent types of callbacks are established by the method declarations in the CallBack interface. Each class of object that registers for callbacks can either respond to all of the dierent types of callbacks by providing full denitions for all of the callback methods, or can selectively ignore some types of callbacks by dening those callback methods as empty methods.

OpenStax-CNX module: m59589 7 6 Complete program listing A complete listing of the program named Callback03 is shown in Listing 5 (p. 7). Listing 5. The program named Callback03. /*File Callback03.java Copyright 1997, R.G.Baldwin The purpose of this program is to develop a callback capability using Interfaces. This is an enhanced version of the program named Callback02. You should familiarize yourself with the earlier program before getting into this program. This version defines three different classes named Student, Dog, and Cat that implement the CallBack interface. Mixed objects of those three types are maintained on a list and notified at CallBack time. As before, this program defines a CallBack interface that can be used to establish a new type of object. This version of the interface declares two different methods that can be invoked as callback methods instead of just one. All classes that implement the interface must define both methods, but it is allowable to define the method as an empty method and ignore the callback associated with a particular method. One of the callback methods is now called recess() and the other is called lunch(). The Dog class ignores the recess() callback by defining an empty method, and the Cat class ignores the lunch() callback by defining an empty method. The Student class responds to both types of callbacks with fullydefined methods. The program defines a Teacher class that has the ability to create and maintain a list of objects of the interface type, and to notify those objects that something interesting has happened by invoking either the recess() method or the lunch() method on all the objects on the list. It is important to note that every object on the list will be notified of both types of callback, although as mentioned above, a particular type of callback can be ignored simply by leaving the method empty when it is defined. Note that objects can be added to the list and then removed from the list. However, removal of objects from

OpenStax-CNX module: m59589 8 the list was demonstrated in the previous program, so removal is not demonstrated in this program. As always, notification takes the form of invoking either the recess() method or the lunch() method on all the objects on the list. Finally, the program defines a controlling class that ties all the pieces together and exercises them. Tested using JDK 1.1.3 under Win95. The output from the program was: Tom recess Sue recess CleoCat recess Peg recess KittyKat recess Bob recess Tom lunch SpotDog lunch Sue lunch FidoDog lunch Peg lunch Bob lunch BrownieDog lunch **********************************************************/ import java.util.*; //First we define an interface that will create a new type // and declare two generic methods that can be used to // callback any object that is of a class that implements // the interface. interface CallBack{ public void recess(); public void lunch(); }//end interface CallBack //=======================================================// //Next we need a class whose objects can maintain a // registered list of objects of type CallBack and can // notify all the objects on that list when something // interesting happens. This class has the ability to // notify of two different types of callbacks, recess() // and lunch(). class Teacher{ Vector objlist; //list of objects of type CallBack

OpenStax-CNX module: m59589 9 Teacher(){//constructor //Instantiate a Vector object to contain the list // of registered objects. objlist = new Vector(); }//end constructor //Method to add objects to the list. synchronized void register(callback obj){ this.objlist.addelement(obj); }//end register() //Method to remove objects from the list. synchronized void unregister(callback obj){ if(this.objlist.removeelement(obj)) System.out.println(obj + " removed"); else System.out.println(obj + " not in the list"); }//end register() //Method to notify all objects on the list that // something interesting has happened regarding recess. void callrecess(){ Vector templist;//save a temporary copy of list here //Make a copy of the list. synchronized(this){ templist = (Vector)objList.clone(); }//end synchronized block //Invoke the recess() method on each object on // the list. for(int cnt = 0; cnt < templist.size(); cnt++){ ((CallBack)tempList.elementAt(cnt)).recess(); }//end for loop }//end callrecess() //Method to notify all objects on the list that // something interesting has happened regarding lunch. void calllunch(){ Vector templist;//save a temporary copy of list here //Make a copy of the list. synchronized(this){ templist = (Vector)objList.clone(); }//end synchronized block //Invoke the lunch() method on each object on // the list.

OpenStax-CNX module: m59589 10 for(int cnt = 0; cnt < templist.size(); cnt++){ ((CallBack)tempList.elementAt(cnt)).lunch(); }//end for loop }//end callrecess() }//end class Teacher //=======================================================// //Class that implements the CallBack interface. Objects // of this class can be registered on the list maintained // by an object of the Teacher class, and will be notified // whenever that object invokes either the recess() method // or the lunch() method on the registered objects on // the list. This method provides a full definition for // both methods. class Student implements CallBack{ String name; //store the object name here for later ID Student(String name){//constructor this.name = name; //save the name to identify the obj }//end constructor //An object of the Teacher class can invoke this method // as a callback mechanism. public void recess(){//announce recess System.out.println(name + " recess"); }//end overridden recess() //An object of the Teacher class can also invoke this // method as a callback mechanism. public void lunch(){//announce recess System.out.println(name + " lunch"); }//end overridden lunch() }//end class Student //=======================================================// //Another Class that implements the CallBack interface. // See description above. This class defines the recess() // method as an empty method. class Dog implements CallBack{ String name; //store name here for later ID Dog(String name){//constructor

OpenStax-CNX module: m59589 11 this.name = name; //save the name to identify the obj }//end constructor //An object of the Teacher class can invoke this method // as the callback mechanism. public void recess(){//announce recess //ignore this callback with an empty method }//end overridden recess() //An object of the Teacher class can also invoke this // method as a callback mechanism. public void lunch(){//announce recess System.out.println(name + " lunch"); }//end overridden lunch() }//end class Dog //=======================================================// //A third Class that implements the CallBack interface, // similar to the other two classes. This class defines // the lunch() method as an empty method. class Cat implements CallBack{ String name; //store name here for later ID Cat(String name){//constructor this.name = name; //save the name to identify the obj }//end constructor //An object of the Teacher class can invoke this method // as the callback mechanism. public void recess(){//announce recess System.out.println(name + " recess"); }//end overridden recess() //An object of the Teacher class can also invoke this // method as a callback mechanism. public void lunch(){//announce recess //ignore this callback with an empty method }//end overridden lunch() }//end class Cat //=======================================================// //Controlling class that ties all the pieces together and // exercises them.

OpenStax-CNX module: m59589 12 class Callback03{ public static void main(string[] args){ //Instantiate Teacher object Teacher missjones = new Teacher(); //Instantiate some Student objects Student tom = new Student("Tom"); Student sue = new Student("Sue"); Student peg = new Student("Peg"); Student bob = new Student("Bob"); Student joe = new Student("Joe"); //Instantiate some Dog objects. Dog spot = new Dog("SpotDog"); Dog fido = new Dog("FidoDog"); Dog brownie = new Dog("BrownieDog"); //Instantiate some Cat objects Cat cleo = new Cat("CleoCat"); Cat kitty = new Cat("KittyKat"); //Register some Student, Dog, and Cat objects with // the Teacher object. missjones.register(tom); missjones.register(spot); missjones.register(sue); missjones.register(cleo); missjones.register(fido); missjones.register(peg); missjones.register(kitty); missjones.register(bob); missjones.register(brownie); //Cause the Teacher object to call recess on all // the objects on the list. missjones.callrecess(); //Cause the Teacher object to call lunch on all // the objects on the list. missjones.calllunch(); }//end main() }//end class Callback03 //=======================================================// 7 Miscellaneous This section contains a variety of miscellaneous information. Housekeeping material Module name: Java0078 Java OOP Callbacks - II File: Java0078.htm

OpenStax-CNX module: m59589 13 Published: 1997 Disclaimers: Financial : Although the Connexions site makes it possible for you to download a PDF le for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF le, you should be aware that some of the HTML elements in this module may not translate well into PDF. I also want you to know that, I receive no nancial compensation from the Connexions website even if you purchase the PDF version of the module. In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If you purchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made and published without my prior knowledge. Aliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX. -end