Initialization of (Classes and) Objects for the Scheduler Project
The April 5 class discussion considered matters of the initialization of
objects for the Scheduler project. Specificially, when a user (running a
browser) clicks on a URL for a person's schedule, various activities must
take place to set up basic classes for the Scheduler application. This
page clarifies just what work is done by which object(s) in initializing
classes required for this project.
User Applet: The URL from a course's or person's Web page to the
Scheduler project will, in fact, give the URL for the UserApplet class.
-
As with all applets, when loaded by the browser, the UserApplet will begin
running.
-
Initial work for UserApplet will be opening a connection on a specified
socket at the server.
-
As specified below, the "Background Process" will set up one or two sockets
to be used for UserApplet to communicate with InputInterface and
OutputInterface.
-
UserApplet will send owner information to the "Background Process".
(Owner information may need to be hardcoded as a constant string within
UserApplet to allow this transmission.)
-
The "Background Process" will send relevant socket information to
UserApplet through the initial socekt connection.
Background Process
A special/separate server process will run at all times on the Web server.
-
This server will listen to a specified socket for a startup connection from a
UserApplet.
-
Upon contact from UserApplet, the Background Process retrieves
schedule-owner information from the UserApplet through the specified
socket.
-
The UserApplet constructs sockets for UserApplet to communicate with
InputInterface and OutputInterface.
-
Information on this socket will be sent through the original socket to
UserApplet.
-
The Background Process calls constructors for the following
objects, with required parameters as shown:
-
OutputInterface (with constructed socket information as constructor
parameter)
-
LogIn (with OutputInterface and owner as constructor parameters)
-
PersonsSchedule (with schedule-owner, OutputInterface object, and LogIn
object as constructor parameters)
-
InputInterface (with LogIn and PersonsSchedule as constructor parameters.
PersonsSchedule
-
PersonsSchedule creates a FileHandler object (with schedule-owner
as constructor parameter)
-
PersonsSchedule creates two weeks (with starting date, FileHandler, and
OutputInterface as constructor parameters)
Week
-
Week creates seven days (with date, FileHandler, and
OutputInterface as constructor parameters)
Day
-
Day creates Appointments as needed, starting at 8:00 am. (Each Appointment
[regardless of subclass] has date, starting time, FileHandler, and
OutputInterface as constructor parameters)
Diagram
Graphically, this initialization may be considered as the following graph,
where nodes are classes and where edges represent calls to constructors,
and labels on edges identify constructor parameters.
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/223.sp02/project/class.object-init.html